Posted July 29, 201411 yr Hello, i made an item that if you right click it a mob spawns. I would like to spawn different mobs for each biome (example: plains=cow desert=creeper...) What i should do? Thanks
July 29, 201411 yr Author Use world.getBiomeGenForCoords to get the biome at a position. EDIT: My bad, now it's working, thanks
July 29, 201411 yr Author Sorry for multipost, but i don't understand why this thing doesn't work. If the item is right clicked in plains, it will give you a lighting. This is my code: public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entity, int chunkX, int chunkZ, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ float var4 = 1.0F; int i = (int)(entity.prevPosX + (entity.posX - entity.prevPosX) * (double)var4); int j = (int)(entity.prevPosY + (entity.posY - entity.prevPosY) * (double)var4 + 1.62D - (double)entity.yOffset); int k = (int)(entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double)var4); BiomeGenBase b = world.getBiomeGenForCoords(chunkX, chunkZ); if(b.biomeName.equals("Plains")) { world.spawnEntityInWorld(new EntityLightningBolt(world, i, j, k)); } return itemstack; }
July 29, 201411 yr Author That is not the method that exist in Item. Your method needs to have the exact same parameters as the one you are overriding. What do you mean?
July 29, 201411 yr Author The method signature is as follows: public ItemStack onItemRightClick(ItemStack, World, EntityPlayer) Your's is different. You can't just add or remove parameters. How am i supposed to do it? Im still learing java, so excuse me.
July 30, 201411 yr Author I know i have to implement IWorldGenerator, but that gives me this error: IWorldGenerator is not abstract and does not override abstract method generate this because i don't have to generate anything.
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.