001 package net.minecraft.entity.item; 002 003 import cpw.mods.fml.relauncher.Side; 004 import cpw.mods.fml.relauncher.SideOnly; 005 import net.minecraft.entity.EntityLiving; 006 import net.minecraft.entity.player.EntityPlayerMP; 007 import net.minecraft.entity.projectile.EntityThrowable; 008 import net.minecraft.util.DamageSource; 009 import net.minecraft.util.MovingObjectPosition; 010 import net.minecraft.world.World; 011 012 public class EntityEnderPearl extends EntityThrowable 013 { 014 public EntityEnderPearl(World par1World) 015 { 016 super(par1World); 017 } 018 019 public EntityEnderPearl(World par1World, EntityLiving par2EntityLiving) 020 { 021 super(par1World, par2EntityLiving); 022 } 023 024 @SideOnly(Side.CLIENT) 025 public EntityEnderPearl(World par1World, double par2, double par4, double par6) 026 { 027 super(par1World, par2, par4, par6); 028 } 029 030 /** 031 * Called when this EntityThrowable hits a block or entity. 032 */ 033 protected void onImpact(MovingObjectPosition par1MovingObjectPosition) 034 { 035 if (par1MovingObjectPosition.entityHit != null) 036 { 037 par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0); 038 } 039 040 for (int var2 = 0; var2 < 32; ++var2) 041 { 042 this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(), 0.0D, this.rand.nextGaussian()); 043 } 044 045 if (!this.worldObj.isRemote) 046 { 047 if (this.getThrower() != null && this.getThrower() instanceof EntityPlayerMP) 048 { 049 EntityPlayerMP var3 = (EntityPlayerMP)this.getThrower(); 050 051 if (!var3.playerNetServerHandler.connectionClosed && var3.worldObj == this.worldObj) 052 { 053 this.getThrower().setPositionAndUpdate(this.posX, this.posY, this.posZ); 054 this.getThrower().fallDistance = 0.0F; 055 this.getThrower().attackEntityFrom(DamageSource.fall, 5); 056 } 057 } 058 059 this.setDead(); 060 } 061 } 062 }