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 e857b9bbc..248b2cffd 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/item/EnergySwordItem.kt @@ -18,6 +18,9 @@ import net.minecraft.world.item.Item import net.minecraft.world.item.ItemStack import net.minecraft.world.item.Rarity import net.minecraft.world.item.TooltipFlag +import net.minecraft.world.item.Vanishable +import net.minecraft.world.item.enchantment.Enchantment +import net.minecraft.world.item.enchantment.EnchantmentCategory import net.minecraft.world.level.Level import net.minecraft.world.level.block.Blocks import net.minecraft.world.level.block.state.BlockState @@ -56,7 +59,7 @@ fun getSweepingDamageRatioHook(ply: LivingEntity): Float? { return null } -class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)) { +class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE).tab(OverdriveThatMatters.INSTANCE.CREATIVE_TAB)), Vanishable { val chargedAttributes: Multimap val dischargedAttributes: Multimap @@ -80,6 +83,14 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE).tab(Ov return p_41456_.count == 1 } + override fun canApplyAtEnchantingTable(stack: ItemStack, enchantment: Enchantment): Boolean { + return enchantment.category == EnchantmentCategory.WEAPON + } + + override fun getEnchantmentValue(stack: ItemStack): Int { + return 12 + } + override fun getDestroySpeed(itemStack: ItemStack, blockState: BlockState): Float { val energy = itemStack.getCapability(MatteryCapability.ENERGY).orNull() ?: return 1f