mirror of
https://github.com/Minestom/Minestom.git
synced 2025-01-08 01:17:47 +01:00
fix: correctly handle clientside single block replacement
(cherry picked from commit 219f52bd58
)
This commit is contained in:
parent
f4a123192b
commit
271e3f4e91
@ -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.
|
//todo it feels like it should be possible to have better replacement rules than this, feels pretty scuffed.
|
||||||
Point placementPosition = blockPosition;
|
Point placementPosition = blockPosition;
|
||||||
var interactedPlacementRule = BLOCK_MANAGER.getBlockPlacementRule(interactedBlock);
|
var interactedPlacementRule = BLOCK_MANAGER.getBlockPlacementRule(interactedBlock);
|
||||||
if (interactedPlacementRule == null || !interactedPlacementRule.isSelfReplaceable(
|
if (!interactedBlock.isAir() && (interactedPlacementRule == null || !interactedPlacementRule.isSelfReplaceable(
|
||||||
new BlockPlacementRule.Replacement(interactedBlock, blockFace, cursorPosition, useMaterial))) {
|
new BlockPlacementRule.Replacement(interactedBlock, blockFace, cursorPosition, useMaterial)))) {
|
||||||
// If the block is not replaceable, try to place next to it.
|
// 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 offsetX = blockFace == BlockFace.WEST ? -1 : blockFace == BlockFace.EAST ? 1 : 0;
|
||||||
final int offsetY = blockFace == BlockFace.BOTTOM ? -1 : blockFace == BlockFace.TOP ? 1 : 0;
|
final int offsetY = blockFace == BlockFace.BOTTOM ? -1 : blockFace == BlockFace.TOP ? 1 : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user