Attempting to build a simple item that can be crafted (I have the crafting path set up and all) and used as a permanent egg essentially. I'm hoping for it to be able to spawn any random monster on whatever ground is right clicked with it. My current code is basically this
public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffSet)
{
if (world.getBlockId(x, y + 1, z) == 0 && (world.getBlockId(x, y, z) == Block.grass.blockID || world.getBlockId(x, y, z) == Block.stone.blockID || world.getBlockId(x, y, z) == Block.dirt.blockID || world.getBlockId(x, y, z) == Block.sand.blockID))
{
int x = math.random();
if(x<0.05) {
EntitySkeleton ent = new EntitySkeleton(world);
ent.setLocationAndAngles(x, y + 1, z, MathHelper.wrapAngleTo180_float(world.rand.nextFloat() * 360.0F), 0.0F);
ent.initCreature();
world.spawnEntityInWorld(ent);
}
else if(x<0.1) {
...and so on
}
return true;
}
I keep on coming up with these errors:
and my full code is
Thanks in advance for any help/suggestion that you could provide. I'd like to finish this ASAP, so a quick response would be greatly appreciated.