From 09111a87d929e6b1ee0db9352019c064d20f915b Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Thu, 24 Nov 2022 22:02:07 +0700 Subject: [PATCH] Mark energy sword as enchantable still, you can't enchant it, because enchants don't recognize it as appropriate item to enchant --- src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt index d8ad325eb..e857b9bbc 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt @@ -76,6 +76,10 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE).tab(Ov dischargedAttributes = builder.build() } + override fun isEnchantable(p_41456_: ItemStack): Boolean { + return p_41456_.count == 1 + } + override fun getDestroySpeed(itemStack: ItemStack, blockState: BlockState): Float { val energy = itemStack.getCapability(MatteryCapability.ENERGY).orNull() ?: return 1f