File tree Expand file tree Collapse file tree 1 file changed +1
-2
lines changed
src/main/kotlin/com/lambda/util Expand file tree Collapse file tree 1 file changed +1
-2
lines changed Original file line number Diff line number Diff line change @@ -40,13 +40,12 @@ object EnchantmentUtils {
4040 get() = ! getOrDefault(DataComponentTypes .ENCHANTMENTS , ItemEnchantmentsComponent .DEFAULT ).isEmpty
4141 || getOrDefault(DataComponentTypes .STORED_ENCHANTMENTS , ItemEnchantmentsComponent .DEFAULT ).isEmpty
4242
43- // FixMe: doesn't work with, at least, efficiency on pickaxes
4443 /* *
4544 * Returns the given enchantment level from a [net.minecraft.item.ItemStack]
4645 */
4746 fun ItemStack.getEnchantment (key : RegistryKey <Enchantment >) =
4847 getOrDefault(DataComponentTypes .ENCHANTMENTS , ItemEnchantmentsComponent .DEFAULT )
49- .enchantmentEntries.find { it.key == key }
48+ .enchantmentEntries.find { it.key?.matchesKey(key) == true }
5049 ?.intValue
5150 ? : 0
5251
You can’t perform that action at this time.
0 commit comments