private Packet<?> createSpawnPacket()
{
if (this.trackedEntity.isDead)
{
LOGGER.warn("Fetching addPacket for removed entity");
}
Packet pkt = net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.trackedEntity);
if (pkt != null) return pkt;
if (this.trackedEntity instanceof EntityItem)
{
return new SPacketSpawnObject(this.trackedEntity, 2, 1);
}
else if (this.trackedEntity instanceof EntityPlayerMP)
{
return new SPacketSpawnPlayer((EntityPlayer)this.trackedEntity);
}
else if (this.trackedEntity instanceof EntityMinecart)
{
EntityMinecart entityminecart = (EntityMinecart)this.trackedEntity;
return new SPacketSpawnObject(this.trackedEntity, 10, entityminecart.getType().getId());
}
else if (this.trackedEntity instanceof EntityBoat)
{
return new SPacketSpawnObject(this.trackedEntity, 1);
}
else if (this.trackedEntity instanceof IAnimals)
{
this.lastHeadMotion = MathHelper.floor_float(this.trackedEntity.getRotationYawHead() * 256.0F / 360.0F);
return new SPacketSpawnMob((EntityLivingBase)this.trackedEntity);
}
else if (this.trackedEntity instanceof EntityFishHook)
{
Entity entity2 = ((EntityFishHook)this.trackedEntity).angler;
return new SPacketSpawnObject(this.trackedEntity, 90, entity2 != null ? entity2.getEntityId() : this.trackedEntity.getEntityId());
}
else if (this.trackedEntity instanceof EntitySpectralArrow)
{
Entity entity1 = ((EntitySpectralArrow)this.trackedEntity).shootingEntity;
return new SPacketSpawnObject(this.trackedEntity, 91, 1 + (entity1 != null ? entity1.getEntityId() : this.trackedEntity.getEntityId()));
}
else if (this.trackedEntity instanceof EntityTippedArrow)
{
Entity entity = ((EntityArrow)this.trackedEntity).shootingEntity;
return new SPacketSpawnObject(this.trackedEntity, 60, 1 + (entity != null ? entity.getEntityId() : this.trackedEntity.getEntityId()));
}
else if (this.trackedEntity instanceof EntitySnowball)
{
return new SPacketSpawnObject(this.trackedEntity, 61);
}
else if (this.trackedEntity instanceof EntityPotion)
{
return new SPacketSpawnObject(this.trackedEntity, 73);
}
else if (this.trackedEntity instanceof EntityExpBottle)
{
return new SPacketSpawnObject(this.trackedEntity, 75);
}
else if (this.trackedEntity instanceof EntityEnderPearl)
{
return new SPacketSpawnObject(this.trackedEntity, 65);
}
else if (this.trackedEntity instanceof EntityEnderEye)
{
return new SPacketSpawnObject(this.trackedEntity, 72);
}
else if (this.trackedEntity instanceof EntityFireworkRocket)
{
return new SPacketSpawnObject(this.trackedEntity, 76);
}
else if (this.trackedEntity instanceof EntityFireball)
{
EntityFireball entityfireball = (EntityFireball)this.trackedEntity;
SPacketSpawnObject spacketspawnobject = null;
int i = 63;
if (this.trackedEntity instanceof EntitySmallFireball)
{
i = 64;
}
else if (this.trackedEntity instanceof EntityDragonFireball)
{
i = 93;
}
else if (this.trackedEntity instanceof EntityWitherSkull)
{
i = 66;
}
if (entityfireball.shootingEntity != null)
{
spacketspawnobject = new SPacketSpawnObject(this.trackedEntity, i, ((EntityFireball)this.trackedEntity).shootingEntity.getEntityId());
}
else
{
spacketspawnobject = new SPacketSpawnObject(this.trackedEntity, i, 0);
}
spacketspawnobject.setSpeedX((int)(entityfireball.accelerationX * 8000.0D));
spacketspawnobject.setSpeedY((int)(entityfireball.accelerationY * 8000.0D));
spacketspawnobject.setSpeedZ((int)(entityfireball.accelerationZ * 8000.0D));
return spacketspawnobject;
}
else if (this.trackedEntity instanceof EntityShulkerBullet)
{
SPacketSpawnObject spacketspawnobject1 = new SPacketSpawnObject(this.trackedEntity, 67, 0);
spacketspawnobject1.setSpeedX((int)(this.trackedEntity.motionX * 8000.0D));
spacketspawnobject1.setSpeedY((int)(this.trackedEntity.motionY * 8000.0D));
spacketspawnobject1.setSpeedZ((int)(this.trackedEntity.motionZ * 8000.0D));
return spacketspawnobject1;
}
else if (this.trackedEntity instanceof EntityEgg)
{
return new SPacketSpawnObject(this.trackedEntity, 62);
}
else if (this.trackedEntity instanceof EntityTNTPrimed)
{
return new SPacketSpawnObject(this.trackedEntity, 50);
}
else if (this.trackedEntity instanceof EntityEnderCrystal)
{
return new SPacketSpawnObject(this.trackedEntity, 51);
}
else if (this.trackedEntity instanceof EntityFallingBlock)
{
EntityFallingBlock entityfallingblock = (EntityFallingBlock)this.trackedEntity;
return new SPacketSpawnObject(this.trackedEntity, 70, Block.getStateId(entityfallingblock.getBlock()));
}
else if (this.trackedEntity instanceof EntityArmorStand)
{
return new SPacketSpawnObject(this.trackedEntity, 78);
}
else if (this.trackedEntity instanceof EntityPainting)
{
return new SPacketSpawnPainting((EntityPainting)this.trackedEntity);
}
else if (this.trackedEntity instanceof EntityItemFrame)
{
EntityItemFrame entityitemframe = (EntityItemFrame)this.trackedEntity;
return new SPacketSpawnObject(this.trackedEntity, 71, entityitemframe.facingDirection.getHorizontalIndex(), entityitemframe.getHangingPosition());
}
else if (this.trackedEntity instanceof EntityLeashKnot)
{
EntityLeashKnot entityleashknot = (EntityLeashKnot)this.trackedEntity;
return new SPacketSpawnObject(this.trackedEntity, 77, 0, entityleashknot.getHangingPosition());
}
else if (this.trackedEntity instanceof EntityXPOrb)
{
return new SPacketSpawnExperienceOrb((EntityXPOrb)this.trackedEntity);
}
else if (this.trackedEntity instanceof EntityAreaEffectCloud)
{
return new SPacketSpawnObject(this.trackedEntity, 3);
}
else
{
throw new IllegalArgumentException("Don\'t know how to add " + this.trackedEntity.getClass() + "!");
}
}