#checking armor slots for elytra
1 messages · Page 1 of 1 (latest)
// === Check for Elytra in chest slot ===
let isWearingElytra = false;
const eqComp = player.getComponent("minecraft:equipment_inventory");
if (eqComp?.container) {
const chestSlot = eqComp.container.getItem(1); // chest slot index
if (chestSlot?.typeId === "minecraft:elytra") {
isWearingElytra = true;
}
}
player.sendMessage(`Tried but ${isWearingElytra}`)
You might want to use equippable instead of inventory
like just replace it with minecraft:equipable?
okay it works but i have no idea how to access the chest slot for elytra
Works completely differently from this (not really but they are not the same)
Here's an example
const item = player.getComponent('equippable').getEquipment('Chest')
If (item?.typeId == "elytra") { ...}```
thanks man
i actually figured it out but i spent like an hour this morning trying to figure out what is wrong and it turned out to be the fact that there has to be an uppercase C in chest
No problem
I had that same problem when I used this on my first try, too
It's so unbelievably annoying
ikr
my mod is almost done
i just need to figure out a way to randomly cancel player's activities to "gaslight" them
Lol
i tried to subscribe to before events inside a function but first the subscription stacks if you call it in a loop and second before events don't exist for many things like damage and block breaking
i can probably fix the subscription problem by using a dynamic property but i have no idea about the rest
Well I wish you good luck 👍