Question above
What I tried: if (player.getComponent().get Equipment().itemStack) {} Same error message.
Error message: [Scripting][error]-TypeError: not a function at <anonymous> (o.js:13)
module v 1.8.0
Import {
world,
system,
Entity,
Player
} from "@minecraft/server";
function mainTick() {
world.afterEvents.playerBreakBlock.subscribe((ev) => {
const player = world.getPlayers();
const getEntityEquippableComponent = player.GetComponent('equippable');
if (getEntityEquippableComponent.getEquipment('Offhand').itemStack.typeId == "minecraft:totem_of_undying") {
console.warn("C");
} else {
console.warn("D");
}
});
}
system.run(mainTick);