Mark energy sword as enchantable

still, you can't enchant it, because enchants don't recognize it as appropriate item to enchant
This commit is contained in:
DBotThePony 2022-11-24 22:02:07 +07:00
parent 56789d0e40
commit 09111a87d9
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -76,6 +76,10 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE).tab(Ov
dischargedAttributes = builder.build() dischargedAttributes = builder.build()
} }
override fun isEnchantable(p_41456_: ItemStack): Boolean {
return p_41456_.count == 1
}
override fun getDestroySpeed(itemStack: ItemStack, blockState: BlockState): Float { override fun getDestroySpeed(itemStack: ItemStack, blockState: BlockState): Float {
val energy = itemStack.getCapability(MatteryCapability.ENERGY).orNull() ?: return 1f val energy = itemStack.getCapability(MatteryCapability.ENERGY).orNull() ?: return 1f