2
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5 KiB
Java

package com.zivilon.cinder_loe.enchants;
import lotr.common.enchant.LOTREnchantmentProtectionRanged;
import lotr.common.enchant.LOTREnchantmentProtectionSpecial;
import lotr.common.item.LOTRMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.StatCollector;
public class LOTREnchantmentWeakProtectionRanged extends LOTREnchantmentProtectionSpecial {
public LOTREnchantmentWeakProtectionRanged(String s, int level) {
super(s, level);
}
@Override
public String getDescription(ItemStack itemstack) {
return StatCollector.translateToLocalFormatted((String)"lotr.enchant.protectRanged.desc", (Object[])new Object[]{this.formatAdditiveInt(this.calcIntProtection())});
}
@Override
public boolean canApply(ItemStack itemstack, boolean considering) {
if (super.canApply(itemstack, considering)) {
Item item = itemstack.getItem();
return !(item instanceof ItemArmor) || ((ItemArmor)item).getArmorMaterial() != LOTRMaterial.GALVORN.toArmorMaterial();
}
return false;
}
@Override
public boolean isBeneficial() {
// This enchantment is detrimental, so return false
return false;
}
@Override
protected boolean protectsAgainst(DamageSource damageSource) {
return false;
}
@Override
protected int calcIntProtection() {
return this.protectLevel;
}
}