The bug
ItemStack.matches checks if the given item matches the provided identifier. When the given item is a block item and the provided identifier is not a block, it should simply return false. However, it also currently produces a content log error:
[Json][error]-Unknown block during Deferred BlockDescriptor resolution: <identifier>How to reproduce
Download and open the attached world
Ensure content logs are enabled in creator settings
Select the dirt block in your inventory
Expected results
Nothing should happen
Observed results
Content log error appears
Notes
The relevant scripting code is provided here:
import { world } from "@minecraft/server"
world.afterEvents.playerHotbarSelectedSlotChange.subscribe(e => {
if (e.itemStack !== undefined && e.itemStack.matches("minecraft:diamond")) {
world.sendMessage("diamond");
}
});
Attachments
Comments 3
[media]