Naddox Posted March 31, 2013 Posted March 31, 2013 Hey all, I am trying to get some of my blocks to generate in my worlds. I have made a world gen class and registered it within my main class and have no issues at all there or in my world gen class, but nothing new generates in my worlds. Can someone please help me out? I am using this tutorial as a semi-base: http://www.minecraftforge.net/wiki/Adding_World_Generation and using the generated code from MCreator for the code to generate: http://pastebin.com/aMH988h3 Main Class: http://pastebin.com/330u2s3w World Gen Class: http://pastebin.com/ThDu7qci Quote
coolboy4531 Posted March 31, 2013 Posted March 31, 2013 In your main class add: public void generateSurface() { case 0: //generation stuff overworld case -1: //nether generation case 1: //the end generation } Quote
Naddox Posted March 31, 2013 Author Posted March 31, 2013 So I am guessing that should go in the @Init area and does this remove the need of having the generation class? and could you give an example generation using this method please? Quote
Draco18s Posted April 1, 2013 Posted April 1, 2013 One thing: int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(250)+0; int randPosZ = chunkZ + rand.nextInt(16); ChunkX = 5 randPosX = 5 + [0-15] Gee, I wonder where it's going to end up. (You have to multiply your chunk X/Z by 16). Quote 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.
Naddox Posted April 1, 2013 Author Posted April 1, 2013 dont know where you got that 5 or the 5(0+15) but it is multiplied by 16... Quote
Draco18s Posted April 1, 2013 Posted April 1, 2013 dont know where you got that 5 or the 5(0+15) but it is multiplied by 16... No it's not. chunkX is not premultiplied and it's certainly not being muliplied before it gets passed on WorldGenMinable. Oh, and if it's magically getting multiplied after you add the random value, you're still doing it wrong. Quote 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.
Naddox Posted April 1, 2013 Author Posted April 1, 2013 Here is where I got the code, mod generated from MCreator, and this works 100% perfectly fine. http://pastebin.com/66cgUXMJ line 142-149 public void generateSurface(World world, java.util.Random rand, int chunkX, int chunkZ){ for(int i = 0; i < 40; i++){ int randPosX = chunkX + rand.nextInt(16); int randPosY = rand.nextInt(256)+0; int randPosZ = chunkZ + rand.nextInt(16); (new WorldGenMinable(mod_quartzOverworld.block.blockID, 40)).generate(world, rand, randPosX, randPosY, randPosZ); } } Quote
Draco18s Posted April 1, 2013 Posted April 1, 2013 Do this: System.out.println("RandPosX: " + randPosX); (or use whatever printing statement you like) and run it. Check the outputted values and insure that they're within the expected range. Quote 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.
Recommended Posts
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.