Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

In your main class add:

 

public void generateSurface()

{

case 0:

//generation stuff overworld

case -1:

//nether generation

case 1:

//the end generation

}

  • Author

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?

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).

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.

  • Author

dont know where you got that 5 or the 5(0+15) but it is multiplied by 16...

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.

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.

  • Author

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);
}
}

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.

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.