Allow HFB to be enchanted at table directly
This commit is contained in:
parent
09111a87d9
commit
06bd41946c
@ -18,6 +18,9 @@ import net.minecraft.world.item.Item
|
|||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.Rarity
|
import net.minecraft.world.item.Rarity
|
||||||
import net.minecraft.world.item.TooltipFlag
|
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.Level
|
||||||
import net.minecraft.world.level.block.Blocks
|
import net.minecraft.world.level.block.Blocks
|
||||||
import net.minecraft.world.level.block.state.BlockState
|
import net.minecraft.world.level.block.state.BlockState
|
||||||
@ -56,7 +59,7 @@ fun getSweepingDamageRatioHook(ply: LivingEntity): Float? {
|
|||||||
return null
|
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<Attribute, AttributeModifier>
|
val chargedAttributes: Multimap<Attribute, AttributeModifier>
|
||||||
val dischargedAttributes: Multimap<Attribute, AttributeModifier>
|
val dischargedAttributes: Multimap<Attribute, AttributeModifier>
|
||||||
|
|
||||||
@ -80,6 +83,14 @@ class EnergySwordItem : Item(Properties().stacksTo(1).rarity(Rarity.RARE).tab(Ov
|
|||||||
return p_41456_.count == 1
|
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 {
|
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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user