#selectedSlot does not seem to work for me :(

1 messages · Page 1 of 1 (latest)

high ember
#

world.beforeEvents.playerBreakBlock.subscribe((event) => {
const p = event.player;
const b = event.block;
let container = p.getComponent(EntityComponentTypes.Inventory).container;
let heldItem = inventory.getItem(p.selectedSlot);
let lore = heldItem.getLore();
if (lore[0].includes("§r§l§4Wand")) {
system.run(() => {
world.sendMessage(${b.x} ${b.y} ${b.z});
})

    event.cancel = true;
} else {
    return;
};

}
);

#

@exotic osprey

#

So basically p.selectedSlot doesn't seem to be returning anything and in Dingsel's tutorial he used selectedSlot. So I wanna know why it doesn't work for me.

warped cypress
#

selectedSlotIndex

#

It has been changed. You should always be aware in the update when using the beta modules.

exotic osprey
#

I’m in stable

#

1.9.0 I believe

warped cypress
#

That's not what I meant

exotic osprey
#

Is there an equivalent to it?

exotic osprey
warped cypress
exotic osprey
#

What did u mean then?

exotic osprey
#

I shall test it

#

Thx u :))

warped cypress
#

selectedSlot was beta api which now moved in stable api and become selectedSlotIndex .

exotic osprey
warped cypress
#

Just read changelog of Minecraft