I'm trying to use the world.beforeEvents.itemUse to cancel the setting of a custom item, but when I try to do it the item is blocked in the slot where it should be equipped, this only happens if the player is in creative and with custom items apparently
code:
world.beforeEvents.itemUse.subscribe((eventData) => {
let player = eventData.source
system.run(() => {
let chestplate = player.getComponent('equippable').getEquipmentSlot('Chest')
player.runCommand('say hi-' + chestplate.typeId)
if (chestplate.typeId == 'backpack:backpack_c') {
player.runCommand('/replaceitem entity @s slot.armor.chest 0 air')
player.runCommand('say place')
}
})
eventData.cancel = true;
})
Evidence:
https://drive.google.com/file/d/1fiprPu54LJJ4h9OzXqvYtHwo1KvcnY4w/view?usp=sharing
Comments 3
If this is still an issue in the latest release, could you please provide a sample behavior pack for testing purposes?
This issue is being temporarily resolved as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
I forgot to post the video in public, I've done it.