package net.minecraft.world.item; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.block.Block; public class DiggerItem extends Item { protected DiggerItem(ToolMaterial material, TagKey mineableBlocks, float attackDamage, float attackSpeed, Item.Properties properties) { super(material.applyToolProperties(properties, mineableBlocks, attackDamage, attackSpeed)); } @Override public boolean hurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { return true; } @Override public void postHurtEnemy(ItemStack stack, LivingEntity target, LivingEntity attacker) { stack.hurtAndBreak(2, attacker, EquipmentSlot.MAINHAND); } }