Fix block being transformed to AIR on interaction when in adventure mode

This commit is contained in:
TheMode 2021-05-07 00:15:16 +02:00
parent f7f381a54e
commit 9a4fdae38a

View File

@ -99,13 +99,15 @@ public class BlockPlacementListener {
blockPosition.add(offsetX, offsetY, offsetZ);
if (!canPlaceBlock) {
//Send a block change with AIR as block to keep the client in sync,
//using refreshChunk results in the client not being in sync
//after rapid invalid block placements
BlockChangePacket blockChangePacket = new BlockChangePacket();
blockChangePacket.blockPosition = blockPosition;
blockChangePacket.blockStateId = Block.AIR.getBlockId();
player.getPlayerConnection().sendPacket(blockChangePacket);
if (usedItem.getMaterial().isBlock()) {
//Send a block change with AIR as block to keep the client in sync,
//using refreshChunk results in the client not being in sync
//after rapid invalid block placements
BlockChangePacket blockChangePacket = new BlockChangePacket();
blockChangePacket.blockPosition = blockPosition;
blockChangePacket.blockStateId = Block.AIR.getBlockId();
player.getPlayerConnection().sendPacket(blockChangePacket);
}
return;
}