diff --git a/src/main/java/net/minestom/server/instance/Chunk.java b/src/main/java/net/minestom/server/instance/Chunk.java index 1597ee613..83b8d8dbf 100644 --- a/src/main/java/net/minestom/server/instance/Chunk.java +++ b/src/main/java/net/minestom/server/instance/Chunk.java @@ -182,6 +182,15 @@ public class Chunk implements Viewable { this.customBlocksId[blockIndex] = customId; } + protected void refreshBlockId(int x, int y, int z, short blockId) { + int blockIndex = getBlockIndex(x, y, z); + if (blockIndex < 0 || blockIndex >= blocksId.length) { + return; + } + + this.blocksId[blockIndex] = blockId; + } + protected void refreshBlockValue(int x, int y, int z, short blockId) { CustomBlock customBlock = getCustomBlock(x, y, z); short customBlockId = customBlock == null ? 0 : customBlock.getCustomBlockId(); diff --git a/src/main/java/net/minestom/server/instance/InstanceContainer.java b/src/main/java/net/minestom/server/instance/InstanceContainer.java index fcc5c747f..7fbfb1eee 100644 --- a/src/main/java/net/minestom/server/instance/InstanceContainer.java +++ b/src/main/java/net/minestom/server/instance/InstanceContainer.java @@ -97,7 +97,7 @@ public class InstanceContainer extends Instance { public void refreshBlockId(BlockPosition blockPosition, short blockId) { Chunk chunk = getChunkAt(blockPosition.getX(), blockPosition.getZ()); synchronized (chunk) { - chunk.refreshBlockValue(blockPosition.getX(), blockPosition.getY(), + chunk.refreshBlockId(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ(), blockId); sendBlockChange(chunk, blockPosition, blockId);