Move block height to static constant

This commit is contained in:
nucker 2023-01-05 18:18:28 +00:00
parent d226c3994a
commit 6ca2be1067

View File

@ -28,6 +28,7 @@ import net.minestom.server.utils.validate.Check;
public class BlockPlacementListener {
private static final BlockManager BLOCK_MANAGER = MinecraftServer.getBlockManager();
private static final double BLOCK_HEIGHT = 320.0;
public static void listener(ClientPlayerBlockPlacementPacket packet, Player player) {
final PlayerInventory playerInventory = player.getInventory();
@ -131,7 +132,7 @@ public class BlockPlacementListener {
// BlockPlacementRule check
Block resultBlock = playerBlockPlaceEvent.getBlock();
final BlockPlacementRule blockPlacementRule = BLOCK_MANAGER.getBlockPlacementRule(resultBlock);
if(placementPosition.y() >= 320) return;
if(placementPosition.y() >= BLOCK_HEIGHT) return;
if (blockPlacementRule != null) {
// Get id from block placement rule instead of the event
resultBlock = blockPlacementRule.blockPlace(instance, resultBlock, blockFace, blockPosition, player);