I made an item that when you right click on an animal it drops the egg for that animal. For some reason when this happens it drops the actual egg that the player can pick up, but it also drops another egg that the player can't do anything to.
Here's the main interaction code I have.
public boolean itemInteractionForEntity(ItemStack itemstack, EntityLiving entity)
{
if(entity instanceof EntityAnimal || entity instanceof EntityWaterMob)
{
int spawnID = 0;
if(entity instanceof EntityBat)
spawnID = 65;
else if(entity instanceof EntityChicken)
spawnID = 93;
else if(entity instanceof EntityCow)
spawnID = 92;
else if(entity instanceof EntityMooshroom)
spawnID = 96;
else if(entity instanceof EntityOcelot)
spawnID = 98;
else if(entity instanceof EntityPig)
spawnID = 90;
else if(entity instanceof EntitySheep)
spawnID = 91;
else if(entity instanceof EntitySquid)
spawnID = 94;
else if(entity instanceof EntityWolf)
spawnID = 95;
else
return false;
entity.setDead();
entity.entityDropItem(new ItemStack(383, 1, spawnID), 0.0F);
return true;
}
return false;
}