Skip to content

Commit 1e8e357

Browse files
committed
fix: fix BlockEntityAPI
1 parent fcb2429 commit 1e8e357

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/legacy/api/BlockEntityAPI.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ BlockActor* BlockEntityClass::extract(Local<Value> v) {
5050
// 成员函数
5151
Local<Value> BlockEntityClass::getPos() {
5252
try {
53-
return IntPos::newPos(blockEntity->getPosition(), dim);
53+
return IntPos::newPos(blockEntity->mPosition, dim);
5454
}
5555
CATCH("Fail in getBlockEntityPos!")
5656
}
@@ -64,7 +64,7 @@ Local<Value> BlockEntityClass::getName() {
6464

6565
Local<Value> BlockEntityClass::getType() {
6666
try {
67-
return Number::newNumber((int)blockEntity->getType());
67+
return Number::newNumber((int)blockEntity->mType);
6868
}
6969
CATCH("Fail in getBlockEntityType!")
7070
}
@@ -95,9 +95,10 @@ Local<Value> BlockEntityClass::setNbt(const Arguments& args) {
9595

9696
Local<Value> BlockEntityClass::getBlock(const Arguments&) {
9797
try {
98-
BlockPos bp = blockEntity->getPosition();
99-
auto& bl = ll::service::getLevel()->getDimension(dim)->getBlockSourceFromMainChunkSource().getBlock(bp);
100-
return BlockClass::newBlock(bl, bp, dim);
98+
BlockPos blockPos = blockEntity->mPosition;
99+
auto& block =
100+
ll::service::getLevel()->getDimension(dim).lock()->getBlockSourceFromMainChunkSource().getBlock(blockPos);
101+
return BlockClass::newBlock(block, blockPos, dim);
101102
}
102103
CATCH("Fail in getBlock!")
103104
}

0 commit comments

Comments
 (0)