#Get a Specific Enchantment that an itemstack Has (if it has it, if not then no) And Get The Level

22 messages · Page 1 of 1 (latest)

zenith hamlet
#

It's basically about getting the knockback enchantment of an item stack, detecting if it has it with a conditional if statement, and getting the enchantment level of the knockback on that same item stack. 🙂

valid token
#

Get the ItemEnchantmentComponent from the ItemStack's components, then you have access to getLevel which queries the enchant->level hashmap

#

It'll return 0 if the enchant doesn't exist, or the level itself if it exists

zenith hamlet
#

im in that 🙏

valid token
#

Check the other errors, what went wrong?

zenith hamlet
#

idk what could be

valid token
#

Don't just widen the error, the stack trace is useful

zenith hamlet
#

if hope to god it isnt that warning on the RegistryEntry Enchantment of the level value

valid token
#

It probably is

zenith hamlet
#

debug?

valid token
#

You can't really just cast an RegistryKey to an RegistryEntry

#

The key is how you get the entry from the registry

zenith hamlet
valid token
#

Can you click on the :runClient tab and copy-paste the whole stacktrace