package fyresmodjam.blessings.marks; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraftforge.event.entity.living.LivingHurtEvent; public class FalseLifeMark extends Mark { @Override public String name() { return "False Life"; } @Override public String description() { return "BENEFIT - Rally from a fatal injury\nDRAWBACK - Lose permanent health to do so"; } @Override public float onIncomingDamage(LivingHurtEvent event, float damageMultiplier) { float totalAmount = Math.max(0.5f, event.getAmount() * damageMultiplier); if (totalAmount > event.getEntityLiving().getMaxHealth()) { event.setCanceled(true); event.getEntityLiving().getEntityAttribute( SharedMonsterAttributes.MAX_HEALTH) .setBaseValue(event.getEntityLiving() .getMaxHealth() / 0.75f); event.getEntityLiving().setHealth( event.getEntityLiving().getMaxHealth()); // TODO figure out potions /* event.getEntityLiving() .addPotionEffect(new PotionEffect( Potion.moveSpeed.id, 30, 1)); event.getEntityLiving() .addPotionEffect(new PotionEffect( Potion.resistance.id, 20, 1)); event.getEntityLiving() .addPotionEffect(new PotionEffect( Potion.damageBoost.id, 20, 1)); */ return 0; } return damageMultiplier; } }