fix: correctly handle clientside single block replacement

This commit is contained in:
mworzala 2023-12-01 22:51:48 +02:00
parent 666bb98957
commit 219f52bd58
No known key found for this signature in database
GPG Key ID: B148F922E64797C7

View File

@ -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;