package com.zivilon.cinder_loe.enchants; import lotr.common.enchant.*; import lotr.common.item.LOTRItemBalrogWhip; import lotr.common.item.LOTRItemThrowingAxe; import lotr.common.item.LOTRMaterial; import net.minecraft.entity.EntityLivingBase; 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 LOTREnchantmentExtraSpecial extends LOTREnchantmentWeaponSpecial { private final float baseDamageBoost; private boolean compatibleBane = true; private boolean compatibleOtherSpecial = false; public LOTREnchantmentExtraSpecial(String s, float boost) { super(s); this.baseDamageBoost = boost; setValueModifier(3.0F); } public float getBaseDamageBoost() { return this.baseDamageBoost; } public float getEntitySpecificDamage(EntityLivingBase entity) { return 0.0f; } @Override public String getDescription(ItemStack itemstack) { if (itemstack != null && itemstack.getItem() instanceof LOTRItemThrowingAxe) { return StatCollector.translateToLocalFormatted((String)"lotr.enchant.damage.desc.throw", (Object[])new Object[]{this.formatAdditive(this.baseDamageBoost)}); } return StatCollector.translateToLocalFormatted((String)"lotr.enchant.damage.desc", (Object[])new Object[]{this.formatAdditive(this.baseDamageBoost)}); } @Override public boolean canApply(ItemStack itemstack, boolean considering) { if (super.canApply(itemstack, considering)) { Item item = itemstack.getItem(); return !(item instanceof LOTRItemBalrogWhip) || this != LOTREnchantment.fire && this != LOTREnchantment.chill; } return false; } @Override public boolean isBeneficial() { return this.baseDamageBoost >= 0.0f; } @Override public boolean isCompatibleWith(LOTREnchantment other) { if (!this.compatibleBane && other instanceof LOTREnchantmentBane) { return false; } return this.compatibleOtherSpecial || !(other instanceof LOTREnchantmentWeaponSpecial) || ((LOTREnchantmentExtraSpecial)other).compatibleOtherSpecial; } }