Java Code Examples for net.minecraft.entity.EntityLivingBase#heal()
The following examples show how to use
net.minecraft.entity.EntityLivingBase#heal() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemTofuForceCore.java From TofuCraftReload with MIT License | 6 votes |
@Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { super.onUpdate(stack, worldIn, entityIn, itemSlot, isSelected); if (entityIn instanceof EntityLivingBase) { EntityLivingBase entityLivingBase = (EntityLivingBase) entityIn; if (entityLivingBase.ticksExisted % 400 == 0 && isUsable(stack)) { if (entityLivingBase.getHealth() < entityLivingBase.getMaxHealth()) { if (getEnergy(stack) >= 5) { drain(stack, 5, false); } else { stack.damageItem(1, (EntityLivingBase) entityIn); } entityLivingBase.heal(1); } } } }
Example 2
Source File: BlockSoyMilk.java From TofuCraftReload with MIT License | 6 votes |
@Override public void onEntityCollidedWithBlock(World par1World, BlockPos pos, IBlockState state, Entity par5Entity) { if (!par1World.isRemote) { int heat = this.getHeatStrength(par1World, pos); if (par5Entity instanceof EntityLivingBase) { EntityLivingBase entityLiving = (EntityLivingBase)par5Entity; if (entityLiving.ticksExisted % 20 == 0) { switch (heat) { case 1: entityLiving.heal(1f); break; case 2: entityLiving.attackEntityFrom(DamageSource.ON_FIRE, 1f); break; default: break; } } } } }
Example 3
Source File: ItemDiamondTofuSword.java From TofuCraftReload with MIT License | 5 votes |
@Override public boolean hitEntity(ItemStack itemStack, EntityLivingBase targetEntity, EntityLivingBase attacker) { // Drain Float healthBeforeAttack = (float) attacker.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue(); float damage = healthBeforeAttack - targetEntity.getHealth(); if (damage > 0.0f) { int lvl = EnchantmentHelper.getEnchantmentLevel(EnchantmentLoader.Drain, itemStack); attacker.heal(damage * (lvl * 0.1f + 0.1f)); } return super.hitEntity(itemStack, targetEntity, attacker); }
Example 4
Source File: PotionFluxTaint.java From AdvancedMod with GNU General Public License v3.0 | 5 votes |
@Override public void performEffect(EntityLivingBase target, int par2) { if (target instanceof ITaintedMob) { target.heal(1); } else if (!target.isEntityUndead() && !(target instanceof EntityPlayer)) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } else if (!target.isEntityUndead() && (target.getMaxHealth() > 1 || (target instanceof EntityPlayer))) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } }
Example 5
Source File: PotionFluxTaint.java From Chisel-2 with GNU General Public License v2.0 | 5 votes |
@Override public void performEffect(EntityLivingBase target, int par2) { if (target instanceof ITaintedMob) { target.heal(1); } else if (!target.isEntityUndead() && !(target instanceof EntityPlayer)) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } else if (!target.isEntityUndead() && (target.getMaxHealth() > 1 || (target instanceof EntityPlayer))) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } }
Example 6
Source File: PotionFluxTaint.java From GardenCollection with MIT License | 5 votes |
@Override public void performEffect(EntityLivingBase target, int par2) { if (target instanceof ITaintedMob) { target.heal(1); } else if (!target.isEntityUndead() && !(target instanceof EntityPlayer)) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } else if (!target.isEntityUndead() && (target.getMaxHealth() > 1 || (target instanceof EntityPlayer))) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } }
Example 7
Source File: PotionFluxTaint.java From ForbiddenMagic with Do What The F*ck You Want To Public License | 5 votes |
@Override public void performEffect(EntityLivingBase target, int par2) { if (target instanceof ITaintedMob) { target.heal(1); } else if (!target.isEntityUndead() && !(target instanceof EntityPlayer)) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } else if (!target.isEntityUndead() && (target.getMaxHealth() > 1 || (target instanceof EntityPlayer))) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } }
Example 8
Source File: PotionFluxTaint.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void performEffect(EntityLivingBase target, int par2) { if (target instanceof ITaintedMob) { target.heal(1); } else if (!target.isEntityUndead() && !(target instanceof EntityPlayer)) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } else if (!target.isEntityUndead() && (target.getMaxHealth() > 1 || (target instanceof EntityPlayer))) { target.attackEntityFrom(DamageSourceThaumcraft.taint, 1); } }