-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSwordItem.java
More file actions
27 lines (23 loc) · 932 Bytes
/
SwordItem.java
File metadata and controls
27 lines (23 loc) · 932 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
package gregtech.common.tools;
import gregtech.api.items.toolitem.ToolItem;
import gregtech.api.items.toolitem.ToolItemSettings;
import gregtech.api.items.toolitem.ToolItemType;
import gregtech.api.unification.material.Material;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
public class SwordItem extends ToolItem {
public SwordItem(ToolItemSettings settings, ToolItemType toolItemType, Material material) {
super(settings, toolItemType, material);
}
@Override
public boolean canApplyEnchantment(Enchantment enchantment) {
return enchantment.type == EnchantmentTarget.WEAPON ||
enchantment.type.isAcceptableItem(this);
}
@Override
protected boolean isCorrectToolForBlock(BlockState state) {
return state.isOf(Blocks.COBWEB);
}
}