From 219f52bd58a6476f502f8ba2c5979aa831a99fd9 Mon Sep 17 00:00:00 2001 From: mworzala Date: Fri, 1 Dec 2023 22:51:48 +0200 Subject: [PATCH] fix: correctly handle clientside single block replacement --- .../net/minestom/server/listener/BlockPlacementListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/minestom/server/listener/BlockPlacementListener.java b/src/main/java/net/minestom/server/listener/BlockPlacementListener.java index ed3811e07..8d931529e 100644 --- a/src/main/java/net/minestom/server/listener/BlockPlacementListener.java +++ b/src/main/java/net/minestom/server/listener/BlockPlacementListener.java @@ -95,8 +95,8 @@ public class BlockPlacementListener { //todo it feels like it should be possible to have better replacement rules than this, feels pretty scuffed. Point placementPosition = blockPosition; var interactedPlacementRule = BLOCK_MANAGER.getBlockPlacementRule(interactedBlock); - if (interactedPlacementRule == null || !interactedPlacementRule.isSelfReplaceable( - new BlockPlacementRule.Replacement(interactedBlock, blockFace, cursorPosition, useMaterial))) { + if (!interactedBlock.isAir() && (interactedPlacementRule == null || !interactedPlacementRule.isSelfReplaceable( + new BlockPlacementRule.Replacement(interactedBlock, blockFace, cursorPosition, useMaterial)))) { // If the block is not replaceable, try to place next to it. final int offsetX = blockFace == BlockFace.WEST ? -1 : blockFace == BlockFace.EAST ? 1 : 0; final int offsetY = blockFace == BlockFace.BOTTOM ? -1 : blockFace == BlockFace.TOP ? 1 : 0;