Posted February 5, 20169 yr I made an Ore Generator but it don't work. My own Ore isn't anywhere in the World. Here my Ore Generator: public class OreGenerator implements IWorldGenerator { @Override public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,IChunkProvider chunkProvider) { switch(world.provider.dimensionId){ case -1: generateNether(world, random, chunkX * 16, chunkZ * 16); case 0: generateSurface(world, random, chunkX * 16, chunkZ * 16); case 1: generateEnd(world, random, chunkX * 16, chunkZ * 16); } } private void generateSurface(World world, Random random, int x, int z) { } private void generateEnd(World world, Random random, int x, int z) { } private void generateNether(World world, Random random, int x, int z) { oreGen(ChemMix.leavyumOre, world, random, x, z, 16, 16, 100, 15, 100, 60); } public void oreGen(Block b, World w, Random r, int posX, int posZ, int maxX, int maxZ, int maxAder, int spawnChance, int minY, int maxY){ int diffMinMaxY = maxY - minY; for(int i = 0; i < spawnChance; i++){ int posiX = posX + r.nextInt(maxX); int posiY = minY + r.nextInt(diffMinMaxY); int posiZ = posZ + r.nextInt(maxZ); (new WorldGenMinable(b, maxAder)).generate(w, r, posiX, posiY, posiZ); } } } I registered the Generator in the postInit part: GameRegistry.registerWorldGenerator(new OreGenerator(), 1);
February 5, 20169 yr Just to check: You know your ore is only generating in the nether, right? And WorldgenMinable only replaces stone, right? Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
February 6, 20169 yr What you could do is make your ore as common as possible by removing the "int spawnChance" and replacing it with a random integer or a specific integer. That's what I do to test my ores, but I have that in my generateSurface() method; private void generateSurface(World world, Random random, int i, int j) { for(int k = 0; k < random.nextInt(124) + 1; k++) { int firstBlockXCoord = i + random.nextInt(16); int firstBlockYCoord = random.nextInt(44); int firstBlockZCoord = j + random.nextInt(16); new WorldGenMinable(TaserItemsAndBlocks.Salt_Ore, random.nextInt(10)).generate(world, random, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord); } } Try playing around with the y-coord integer too, to see if it can spawn. Everyone has their own way of doing things, and I've found this to work 100% of the time for me, but I hope this helps you. Thanks, Will. EDIT: Since you're using 1.7.10 this code may be different, so just be aware, I'm using 1.8 code. -Will. PLEASE do not send me messages with your problems, instead just post a thread first, and then other people can help you too. Thanks for the consideration.
February 6, 20169 yr Author Now I changed it to generateSurface but now my Minecraft crashes: http://pastebin.com/xVdaDFQs
February 6, 20169 yr You passed a non-positive number to Random#nextInt in OreGenerator#oreGen (line 44). The code in your original post uses 100 as the minimum y position and 60 as the maximum y position, so maxY - minY is negative. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 6, 20169 yr Author Now there is a NullPointerException but why?! http://pastebin.com/rsD0LpUZ
February 6, 20169 yr You created a WorldGenMinable with a null Block on line 47 of OreGenerator . Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
February 6, 20169 yr Author But the block isn't null this is my own Block which I registered int the preInit Part
February 6, 20169 yr Author I solved it on my own....I didn't set an Unlocalized Name for the Block so that it was null
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.