22 lines
728 B
Java
22 lines
728 B
Java
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 toolMaterial, TagKey<Block> tagKey, float f, float g, Item.Properties properties) {
|
|
super(toolMaterial.applyToolProperties(properties, tagKey, f, g));
|
|
}
|
|
|
|
@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);
|
|
}
|
|
}
|