package darkknight.jewelrycraft.affixes; import darkknight.jewelrycraft.api.ModifierEffect; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class HealthAffix extends ModifierEffect { private int health; public HealthAffix(int health) { super(null); this.health = health; } @Override public void onJewelryEquipped(ItemStack item, Item jewelry, EntityPlayer player) { player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() + health); player.setHealth(player.getHealth() + health); } @Override public void onJewelryUnequipped(ItemStack item, Item jewelry, EntityPlayer player) { player.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(player.getMaxHealth() - health); player.setHealth(player.getHealth() - health); } }