Fix PlayerUseItemOnBlockEvent being called with the wrong block position

This commit is contained in:
themode 2021-03-12 04:23:27 +01:00
parent d91fcde798
commit ee36853f41

View File

@ -183,7 +183,8 @@ public class BlockPlacementListener {
}
} else {
// Player didn't try to place a block but interacted with one
PlayerUseItemOnBlockEvent event = new PlayerUseItemOnBlockEvent(player, hand, usedItem, blockPosition, direction);
final BlockPosition usePosition = blockPosition.clone().subtract(offsetX, offsetY, offsetZ);
PlayerUseItemOnBlockEvent event = new PlayerUseItemOnBlockEvent(player, hand, usedItem, usePosition, direction);
player.callEvent(PlayerUseItemOnBlockEvent.class, event);
refreshChunk = true;
}