#checking armor slots for elytra

1 messages · Page 1 of 1 (latest)

stable scaffold
#

what is the counterpart of minecraft:inventory for armor slots. i tried equipment_inventory but it didnt work. i'm leaving the code here

#

// === 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}`)
golden torrent
#

You might want to use equippable instead of inventory

stable scaffold
stable scaffold
#

okay it works but i have no idea how to access the chest slot for elytra

golden torrent
#
const item = player.getComponent('equippable').getEquipment('Chest')
If (item?.typeId == "elytra") { ...}```
stable scaffold
#

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

golden torrent
stable scaffold
#

ikr

#

my mod is almost done

#

i just need to figure out a way to randomly cancel player's activities to "gaslight" them

golden torrent
#

Lol

stable scaffold
#

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

golden torrent
#

Well I wish you good luck 👍