They can spawn naturally in the world with out it crashing, I just cant seem to spawn them though a throwable egg. So I'm guessing there is something wrong with my code when I asked it to spawn the chicken through the egg.
protected void onImpact(MovingObjectPosition par1MovingObjectPosition)
{
if (par1MovingObjectPosition.entityHit != null)
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.worldObj.isRemote && this.rand.nextInt( == 0)
{
byte b0 = 1;
if (this.rand.nextInt(32) == 0)
{
b0 = 4;
}
for (int i = 0; i < b0; ++i)
{
EntityBlingChicken entitychicken = new EntityBlingChicken(this.worldObj);
entitychicken.setGrowingAge(-24000);
entitychicken.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(entitychicken);
}
}
for (int j = 0; j < 8; ++j)
{
this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
This is my code for my throwable egg.