Jump to content

Recommended Posts

Posted

I made my own custom Chicken Entity to learn how to make a mob.  The mob functions how it is supposed to. I can use a spawner egg to spawn my chicken.

 

I'm guessing if I tried to have these chicken occur naturally in the world that it would crash too.  I don't know why I can use a spawner egg, but not spawn them in using other means.

 

The problem is when I try to spawn it using a custom egg class. I am using the exactly same code with the exception that I changed

 

EntityChicken entityChicken = new EntityChicken(this.worldobj)

 

to match my chicken class.

 

 

  Reveal hidden contents

 

 

When I throw my egg and a chicken spawns I crash And get that error report.

 

 

Thanks for your help

Posted

I can also breed my special chickens, and baby ones will spawn no problem,  But I cant figure out how to do it through a throwable egg.

 

Before the crash it says "Skipping Entity with id 0" I don't know why it says this.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.