I'm creating an item that, when thrown, spawns a baby of any peaceful mob it hits. It seems to be working for every other mob, but when it hits a Mooshroom, it just spawns a baby cow. Here is the code associated with the Mooshroom. Can anyone tell me what I'm doing wrong?
if (movingobjectposition.entityHit instanceof EntityMooshroom) {
EntityMooshroom babyMooshroom = new EntityMooshroom(this.worldObj);
babyMooshroom.setGrowingAge(-24000);
babyMooshroom.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(babyMooshroom);
}
Ive actually never seen a baby mooshroom, just try to make one with wheat to see if its even possible.. If its not.. You could create your own entity of a baby mooshroom
Ive actually never seen a baby mooshroom, just try to make one with wheat to see if its even possible.. If its not.. You could create your own entity of a baby mooshroom
I used a "Spawn Mooshroom" on an adult Mooshroom and it spawned a baby Mooshroom, so they're definitely there. Speaking of which, I was trying to find the code for entity eggs in hopes that the answer would be there (since they're clearly capable of spawning a baby Mooshroom), but I can't find it. Can someone tell me where that code is?
I meant the code in Minecraft's source code responsible for entity eggs in general.
im not too sure about that.. they are sometimes really tricky to find out..
but a little hint
the first word is lowercase for the first letter, the second words first letter is upper case..
it took me about 30 mins to find this out for my mod haha
e.g
Item.netherQuartz
Can you not set the EntityMooshoom to spawnBabyAnimal?
I'm almost certain I tried that (not sure if it was that or 'createChild', both seem to do the exact same thing though), but the result was still a baby cow. Notably a similar thing occurred later on when I tried to spawn a baby pigman zombie. the result was just a regular baby zombie. In any case, I'm just giving up on this for now. I'll try to address it in a later update of my mod.
In case it helps anyone else, I found the solution. I was placing the mooshroom after the cow in the code. Because EntityMooshroom extends EntityCow, instaceof EntityCow was true when hitting a mooshroom, meaning the code didn't continue on to instanceof EntityMooshroom like it normally would. Same thing for Pigman Zombies.
I used a "Spawn Mooshroom" on an adult Mooshroom and it spawned a baby Mooshroom, so they're definitely there. Speaking of which, I was trying to find the code for entity eggs in hopes that the answer would be there (since they're clearly capable of spawning a baby Mooshroom), but I can't find it. Can someone tell me where that code is?
tell me if you need any other egg ids
I meant the code in Minecraft's source code responsible for entity eggs in general.
im not too sure about that.. they are sometimes really tricky to find out..
but a little hint
the first word is lowercase for the first letter, the second words first letter is upper case..
it took me about 30 mins to find this out for my mod haha
e.g
Item.netherQuartz
Thank you. I looked in there but didn't find anything helpful, unfortunately.
I'm almost certain I tried that (not sure if it was that or 'createChild', both seem to do the exact same thing though), but the result was still a baby cow. Notably a similar thing occurred later on when I tried to spawn a baby pigman zombie. the result was just a regular baby zombie. In any case, I'm just giving up on this for now. I'll try to address it in a later update of my mod.