Entity ent = new EntityCow(world);
//ent.posX = player.posX;
//ent.posZ = player.posZ;
//ent.posY = player.posY;
ent.setPosition(player.posX, player.posY, player.posZ);
world.spawnEntityInWorld(ent);
this code spawn 2 cows, one is normal, another is untouchable
Entity ent = new EntityCow(world);
ent.posX = player.posX;
ent.posZ = player.posZ;
ent.posY = player.posY;
world.spawnEntityInWorld(ent);
return super.onItemRightClick(itemStackIn, world, player, hand);
i use this code