BiomesOPlenty/common/biomesoplenty/entities/projectiles/EntityMudball.java

55 lines
1.5 KiB
Java
Raw Normal View History

2013-07-03 07:51:39 +00:00
package biomesoplenty.entities.projectiles;
2013-05-03 13:00:44 +00:00
2013-07-03 00:56:13 +00:00
import net.minecraft.entity.EntityLivingBase;
2013-05-03 13:00:44 +00:00
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.ClientProxy;
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
public class EntityMudball extends EntityThrowable
2013-05-03 13:00:44 +00:00
{
boolean isClient = BiomesOPlenty.proxy instanceof ClientProxy;
2013-05-31 10:34:02 +00:00
2013-05-03 13:00:44 +00:00
public EntityMudball(World par1World)
{
super(par1World);
}
2013-07-03 00:56:13 +00:00
public EntityMudball(World par1World, EntityLivingBase par2EntityLivingBase)
2013-05-03 13:00:44 +00:00
{
2013-07-03 00:56:13 +00:00
super(par1World, par2EntityLivingBase);
2013-05-03 13:00:44 +00:00
}
public EntityMudball(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
@Override
2013-05-31 10:34:02 +00:00
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
2013-05-03 13:00:44 +00:00
{
if (par1MovingObjectPosition.entityHit != null)
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0);
if (par1MovingObjectPosition.entityHit instanceof EntityLivingBase)
{
((EntityLivingBase)par1MovingObjectPosition.entityHit).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 400, 2));
2013-05-31 10:34:02 +00:00
}
2013-05-03 13:00:44 +00:00
}
2013-05-31 10:34:02 +00:00
for (int i = 0; i < 16; ++i)
{
BiomesOPlenty.proxy.spawnParticle("mud", posX, posY, posZ);
}
2013-05-03 13:00:44 +00:00
2013-05-31 10:34:02 +00:00
if (!worldObj.isRemote)
2013-05-03 13:00:44 +00:00
{
this.setDead();
}
}
2013-05-31 10:34:02 +00:00
}