#getEnchantment - Stable

1 messages · Page 1 of 1 (latest)

dreamy flint
#

How can I get the sharpness level of a weapon?
I am trying to use:
world.afterEvents.entityHitEntity.subscribe((general) => {
const player = general.damagingEntity
const weapon = player.getComponent("equippable")?.getEquipment("Mainhand")
const sharpness = weapon?.getComponent("enchantable")?.getEnchantment("sharpness").level
player.runCommand(say ${sharpness})
})
but I always get "undefined", what am I doing wrong?
I am using 1.20.71 - 1.9.0 stable

honest pollen
#

enchantable component is not stable

#

only food, durability and cooldown item components are stable for now

#

enchantable will most likely be in 1.20.80