/
EnchantmentShieldFire.java
36 lines (30 loc) · 1.21 KB
/
EnchantmentShieldFire.java
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
30
31
32
33
34
35
36
package knightminer.inspirations.tools.enchantment;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentFireAspect;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.init.Enchantments;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemShield;
import net.minecraft.item.ItemStack;
import java.util.List;
public class EnchantmentShieldFire extends EnchantmentFireAspect {
public EnchantmentShieldFire(Rarity rarityIn, EntityEquipmentSlot... slots) {
super(rarityIn, slots);
}
@Override
public boolean canApplyAtEnchantingTable(ItemStack stack) {
return stack.getItem() instanceof ItemShield || super.canApplyAtEnchantingTable(stack);
}
@Override
public List<ItemStack> getEntityEquipment(EntityLivingBase entity) {
// shields in hand should not give fire, just on hit
List<ItemStack> items = super.getEntityEquipment(entity);
items.removeIf((stack) -> stack.getItem() instanceof ItemShield);
return items;
}
@Override
public boolean canApplyTogether(Enchantment ench) {
// thorns or fire, never needed this choice before
return super.canApplyTogether(ench) && ench != Enchantments.THORNS;
}
}