mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-15 15:16:46 +01:00
fix custom block state id being ignored in PlayerBlockPlaceEvent
This commit is contained in:
parent
bde027432a
commit
5ffd44449d
@ -95,7 +95,7 @@ public class BlockPlacementListener {
|
||||
|
||||
blockPosition.add(offsetX, offsetY, offsetZ);
|
||||
|
||||
if(!canPlaceBlock) {
|
||||
if (!canPlaceBlock) {
|
||||
//Send a block change with AIR as block to keep the client in sync,
|
||||
//using refreshChunk results in the client not being in sync
|
||||
//after rapid invalid block placements
|
||||
@ -143,10 +143,13 @@ public class BlockPlacementListener {
|
||||
if (!playerBlockPlaceEvent.isCancelled()) {
|
||||
|
||||
// BlockPlacementRule check
|
||||
final Block resultBlock = Block.fromStateId(playerBlockPlaceEvent.getBlockStateId());
|
||||
short blockStateId = playerBlockPlaceEvent.getBlockStateId();
|
||||
final Block resultBlock = Block.fromStateId(blockStateId);
|
||||
final BlockPlacementRule blockPlacementRule = BLOCK_MANAGER.getBlockPlacementRule(resultBlock);
|
||||
final short blockStateId = blockPlacementRule == null ? resultBlock.getBlockId() :
|
||||
blockPlacementRule.blockPlace(instance, resultBlock, blockFace, blockPosition, player);
|
||||
if (blockPlacementRule != null) {
|
||||
// Get id from block placement rule instead of the event
|
||||
blockStateId = blockPlacementRule.blockPlace(instance, resultBlock, blockFace, blockPosition, player);
|
||||
}
|
||||
final boolean placementRuleCheck = blockStateId != BlockPlacementRule.CANCEL_CODE;
|
||||
|
||||
if (placementRuleCheck) {
|
||||
|
Loading…
Reference in New Issue
Block a user