When placing a block in the world, world.afterEvents.itemUse event only happens when the ItemStack quantity is 2 or more.
This is a nuisance inconsistency affecting valid use cases.
world.afterEvents.playerPlaceBlock event will fire every time but certain information is only available on the ItemStack (like .itemName) before the block is placed.
Scenarios
Scenario 1: multi-item behavior (expected behavior)
Player active slot is a stack of named minecraft:chest items
Player places (uses) one minecraft:chest item on a valid open location
world.afterEvents.itemUse event fires, allowing examination in script of the itemStack properties
world.afterEvents.playerPlaceBlock event fires, allowing interaction via script with the new block
Scenario 2: single-item behavior
Player active slot is a single named minecraft:chest item
Player places (uses) one minecraft:chest item on a valid open location
world.afterEvents.itemUse does not fire
world.afterEvents.playerPlaceBlock event fires, allowing interaction via script with the new block, but knowledge of the properties of the itemStack used to place the block is not available
Workaround
Store information about the current itemStack in the player’s active hotbar slot every tick just in case they place the block so we can map it all together.
Comments 0
No comments.