-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMiningToolItem.java
More file actions
29 lines (24 loc) · 972 Bytes
/
MiningToolItem.java
File metadata and controls
29 lines (24 loc) · 972 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package gregtech.api.items.toolitem;
import gregtech.api.unification.material.Material;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.tag.Tag;
public class MiningToolItem extends ToolItem {
Tag<Block> effectiveBlocks;
public MiningToolItem(ToolItemSettings settings, ToolItemType toolItemType, Material material,
Tag<Block> effectiveBlocks) {
super(settings, toolItemType, material);
this.effectiveBlocks = effectiveBlocks;
}
@Override
public boolean canApplyEnchantment(Enchantment enchantment) {
return enchantment.type == EnchantmentTarget.DIGGER ||
enchantment.type.isAcceptableItem(this);
}
@Override
protected boolean isCorrectToolForBlock(BlockState state) {
return state.isIn(this.effectiveBlocks);
}
}