Fixed some potion effects being applied

This commit is contained in:
Adubbz 2013-07-03 11:25:33 +10:00
parent e6ef53746a
commit 9257b7a0db
4 changed files with 23 additions and 15 deletions

View File

@ -1,6 +1,5 @@
package biomesoplenty.items.projectiles;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.Potion;
@ -36,8 +35,10 @@ public class EntityMudball extends EntityThrowable
if (par1MovingObjectPosition.entityHit != null)
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
if (par1MovingObjectPosition.entityHit instanceof EntityLiving) {
((EntityLiving)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 400, 2));
if (par1MovingObjectPosition.entityHit instanceof EntityLivingBase)
{
((EntityLivingBase)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 400, 2));
}
}

View File

@ -5,6 +5,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@ -167,7 +168,7 @@ public class EntityPoisonDart extends EntityArrow
f2 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
int i1 = MathHelper.ceiling_double_int(f2 * damage);
((EntityLiving)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
((EntityLivingBase)movingobjectposition.entityHit).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
if (this.getIsCritical())
{
@ -194,7 +195,7 @@ public class EntityPoisonDart extends EntityArrow
{
if (movingobjectposition.entityHit instanceof EntityLiving)
{
EntityLiving entityliving = (EntityLiving)movingobjectposition.entityHit;
EntityLivingBase entityliving = (EntityLivingBase)movingobjectposition.entityHit;
if (shootingEntity != null && movingobjectposition.entityHit != shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer && shootingEntity instanceof EntityPlayerMP)
{

View File

@ -4,7 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.Icon;
@ -58,10 +58,10 @@ public class BlockFluidLiquidPoison extends BlockFluidClassic implements ILiquid
{
int meta = par1World.getBlockMetadata(x, y, z);
if (par5Entity instanceof EntityLiving)
if (par5Entity instanceof EntityLivingBase)
{
((EntityLiving)par5Entity).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
((EntityLiving)par5Entity).addPotionEffect(new PotionEffect(Potion.hunger.id, 100));
((EntityLivingBase)par5Entity).addPotionEffect(new PotionEffect(Potion.poison.id, 100));
((EntityLivingBase)par5Entity).addPotionEffect(new PotionEffect(Potion.hunger.id, 100));
}
}

View File

@ -6,7 +6,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
@ -77,12 +77,18 @@ public class BlockFluidSpringWater extends BlockFluidClassic implements ILiquid
{
int meta = par1World.getBlockMetadata(x, y, z);
if (par5Entity instanceof EntityLiving) {
((EntityLiving)par5Entity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 1));
}
if (!par1World.isRemote)
{
if (par5Entity instanceof EntityLivingBase)
{
((EntityLivingBase)par5Entity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 1));
}
if (par5Entity instanceof EntityPlayer) {
((EntityPlayer)par5Entity).addPotionEffect(new PotionEffect(Potions.nourishment.get().id, 1));
if (par5Entity instanceof EntityPlayer)
{
((EntityPlayer)par5Entity).addPotionEffect(new PotionEffect(Potions.nourishment.get().id, 1));
}
}
}