mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-01 00:10:19 +01:00
fix: correctly handle clientside single block replacement
This commit is contained in:
parent
666bb98957
commit
219f52bd58
@ -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