mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-04 23:47:59 +01:00
Move position of check
This commit is contained in:
parent
ae454a7402
commit
ff7c4c108f
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user