Skip to content

Commit c0ebe7c

Browse files
committed
fix: fix mc.getBlock (#252)
1 parent 875c215 commit c0ebe7c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/legacy/api/BlockAPI.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,9 @@ Local<Value> McClass::getBlock(const Arguments& args) {
468468
if (!lc) {
469469
return {};
470470
}
471-
auto& block = lc->getBlock(ChunkBlockPos{(uchar)pos.x, (uchar)pos.z, minHeight});
471+
auto& block = lc->getBlock(
472+
ChunkBlockPos{(uchar)(pos.x & 0xf), (uchar)(pos.z & 0xf), ChunkLocalHeight{(short)pos.y - minHeight}}
473+
);
472474
return BlockClass::newBlock(block, pos.getBlockPos(), pos.dim);
473475
}
474476
CATCH("Fail in GetBlock!")

0 commit comments

Comments
 (0)