Move position of check

This commit is contained in:
nucker 2023-01-05 21:30:22 +00:00
parent ae454a7402
commit ff7c4c108f
1 changed files with 3 additions and 2 deletions

View File

@ -83,12 +83,15 @@ public class BlockPlacementListener {
canPlaceBlock = usedItem.meta().canPlaceOn(interactedBlock);
}
// Get the newly placed block position
final int offsetX = blockFace == BlockFace.WEST ? -1 : blockFace == BlockFace.EAST ? 1 : 0;
final int offsetY = blockFace == BlockFace.BOTTOM ? -1 : blockFace == BlockFace.TOP ? 1 : 0;
final int offsetZ = blockFace == BlockFace.NORTH ? -1 : blockFace == BlockFace.SOUTH ? 1 : 0;
final Point placementPosition = blockPosition.add(offsetX, offsetY, offsetZ);
if(placementPosition.y() >= instance.getDimensionType().getMaxY()) return;
if (!canPlaceBlock) {
// Send a block change with the real block in the instance to keep the client in sync,
// using refreshChunk results in the client not being in sync
@ -128,8 +131,6 @@ public class BlockPlacementListener {
return;
}
if(placementPosition.y() >= instance.getDimensionType().getMaxY()) return;
// BlockPlacementRule check
Block resultBlock = playerBlockPlaceEvent.getBlock();
final BlockPlacementRule blockPlacementRule = BLOCK_MANAGER.getBlockPlacementRule(resultBlock);