public void performEffect(EntityLivingBase p_76394_1_, int p_76394_2_) { if (this.id == REGENERATION.id) { if (p_76394_1_.getHealth() < p_76394_1_.getMaxHealth()) { p_76394_1_.heal(1.0F); } } else if (this.id == POISON.id) { if (p_76394_1_.getHealth() > 1.0F) { p_76394_1_.attackEntityFrom(DamageSource.magic, 1.0F); } } else if (this.id == WITHER.id) { p_76394_1_.attackEntityFrom(DamageSource.wither, 1.0F); } else if (this.id == HUNGER.id && p_76394_1_ instanceof EntityPlayer) { ((EntityPlayer) p_76394_1_).addExhaustion(0.025F * (float) (p_76394_2_ + 1)); } else if (this.id == SATURATION.id && p_76394_1_ instanceof EntityPlayer) { if (!p_76394_1_.worldObj.isRemote) { ((EntityPlayer) p_76394_1_).getFoodStats().addStats(p_76394_2_ + 1, 1.0F); } } else if ((this.id != INSTANT_HEALTH.id || p_76394_1_.isEntityUndead()) && (this.id != INSTANT_DAMAGE.id || !p_76394_1_.isEntityUndead())) { if (this.id == INSTANT_DAMAGE.id && !p_76394_1_.isEntityUndead() || this.id == INSTANT_HEALTH.id && p_76394_1_.isEntityUndead()) { p_76394_1_.attackEntityFrom(DamageSource.magic, (float) (6 << p_76394_2_)); } } else { p_76394_1_.heal((float) Math.max(4 << p_76394_2_, 0)); } }
@Override public boolean itemInteractionForEntity( ItemStack itemStack, EntityPlayer player, EntityLivingBase entity) { if (entity.worldObj.isRemote) { return false; } else { ItemStack container; switch (itemStack.getItemDamage()) { case 0: break; case 1: container = LifeSystem.findFilledLifeContainer(player.inventory.mainInventory); if (container != null && entity.getHealth() < entity.getMaxHealth()) { if (((ILifeContainer) container.getItem()).takeLife(container, 1) > 0) { entity.heal(1f); player.addStat(ModAchievements.useLP, 1); return true; } } break; case 2: break; } } return false; }
public void func_180793_a( Entity p_180793_1_, Entity p_180793_2_, EntityLivingBase p_180793_3_, int p_180793_4_, double p_180793_5_) { int var7; if ((this.id != INSTANT_HEALTH.id || p_180793_3_.isEntityUndead()) && (this.id != INSTANT_DAMAGE.id || !p_180793_3_.isEntityUndead())) { if (this.id == INSTANT_DAMAGE.id && !p_180793_3_.isEntityUndead() || this.id == INSTANT_HEALTH.id && p_180793_3_.isEntityUndead()) { var7 = (int) (p_180793_5_ * (double) (6 << p_180793_4_) + 0.5D); if (p_180793_1_ == null) { p_180793_3_.attackEntityFrom(DamageSource.magic, (float) var7); } else { p_180793_3_.attackEntityFrom( DamageSource.causeIndirectMagicDamage(p_180793_1_, p_180793_2_), (float) var7); } } } else { var7 = (int) (p_180793_5_ * (double) (4 << p_180793_4_) + 0.5D); p_180793_3_.heal((float) var7); } }
@Override public void onHit( float damage, ItemStack weapon, EntityLivingBase target, EntityLivingBase attacker) { if (getMaterial() == ToolMaterialMedieval.DRAGONFORGE) { target.setFire(20); } if (getMaterial() == ToolMaterialMedieval.IGNOTUMITE) { attacker.heal(1F); } }
public boolean hitEntity( ItemStack par1ItemStack, EntityLivingBase targetEntity, EntityLivingBase entityActed) { // Drain float damage = EntityInfo.instance().<Float>get(entityActed.getEntityId(), DataType.DiamondSwordAttack) - targetEntity.getHealth(); if (damage > 0.0f) { int lvl = TcEnchantmentHelper.getDrainModifier(entityActed); entityActed.heal(damage * (lvl * 0.1f + 0.1f)); } EntityInfo.instance().remove(entityActed.getEntityId(), DataType.DiamondSwordAttack); return super.hitEntity(par1ItemStack, targetEntity, entityActed); }