Jump to content

[Solved] [1.8] How does World Generation Work


Nephroid

Recommended Posts

After trying all sorts of things (IWorldGenerator, various events, etc.) that didn't work or caused massive slowdowns, I'm wondering if anybody has gotten world generation to work in 1.8, or otherwise knows anything about world generation. If so, can you share an example of your code or some documentation that you used that helped?

 

If I wanted to make a ceiling of glass at y level 200 in the overworld, what would I do? It seems like this should be really simple, but apparently I can't figure it out, and the "tutorials" that I've found are either out dated, incomplete, or wrong.

Link to comment
Share on other sites

The furthest progress I made is on the bottom post of this thread: http://www.minecraftforge.net/forum/index.php/topic,26378.0.html

 

But that slows down the game way too much to be useful.

 

I've also tried using the DecorateBiome.Post event, but I'd rather not have world generation be dependent on the position of flowers/trees. I couldn't actually figure out when the Post event actually gets fired either. I could only get the Decorate event to fire.

  @SubscribeEvent(receiveCanceled = true)
  public void onEvent(DecorateBiomeEvent.Pre event) {
    BlockPos pos = event.pos;
    World world = event.world;
    
    System.out.format("[DEBUG] (Pre) %s\n", pos);
  }
  
  @SubscribeEvent(receiveCanceled = true)
  public void onEvent(DecorateBiomeEvent.Decorate event) {
    BlockPos pos = event.pos;
    World world = event.world;
    
    System.out.format("[DEBUG] (Decorate) %s\n", pos);
  }
  
  @SubscribeEvent(receiveCanceled = true)
  public void onEvent(DecorateBiomeEvent.Post event) {
    BlockPos pos = event.pos;
    World world = event.world;
    
    System.out.format("[DEBUG] (Post) %s\n", pos);
  }

The code above produces the following console output:

760e2defcc.png

Link to comment
Share on other sites

Uh huh.  Because every decorator gets its own Decorate event.  There should only be 1 pre and 1 post, though.

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.

Link to comment
Share on other sites

After commenting out the print in the decorate event, here's the console output:

[15:04:17] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
[15:04:17] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:nephroid_cloudcraft
[15:04:17] [Client thread/INFO]: SoundSystem shutting down...
[15:04:17] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[15:04:17] [sound Library Loader/INFO]: Starting up SoundSystem...
[15:04:18] [Thread-9/INFO]: Initializing LWJGL OpenAL
[15:04:18] [Thread-9/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[15:04:18] [Thread-9/INFO]: OpenAL initialized.
[15:04:18] [sound Library Loader/INFO]: Sound engine started
[15:04:19] [Client thread/INFO]: Created: 512x512 textures-atlas
[15:04:26] [Client thread/INFO]: Deleting level New World
[15:04:26] [Client thread/INFO]: Attempt 1...
[15:04:30] [server thread/INFO]: Starting integrated minecraft server version 1.8
[15:04:30] [server thread/INFO]: Generating keypair
[15:04:30] [server thread/INFO]: Converting map!
[15:04:30] [server thread/INFO]: Scanning folders...
[15:04:30] [server thread/INFO]: Total conversion count is 0
[15:04:30] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance
[15:04:30] [server thread/INFO] [FML]: Applying holder lookups
[15:04:30] [server thread/INFO] [FML]: Holder lookups applied
[15:04:30] [server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@63198870)
[15:04:30] [server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@63198870)
[15:04:30] [server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@63198870)
[15:04:30] [server thread/INFO]: Preparing start region for level 0
[15:04:31] [server thread/INFO]: Preparing spawn area: 7%
[15:04:32] [server thread/INFO]: Preparing spawn area: 15%
[15:04:33] [server thread/INFO]: Preparing spawn area: 28%
[15:04:34] [server thread/INFO]: Preparing spawn area: 41%
[15:04:35] [server thread/INFO]: Preparing spawn area: 54%
[15:04:36] [server thread/INFO]: Preparing spawn area: 66%
[15:04:37] [server thread/INFO]: Preparing spawn area: 77%
[15:04:38] [server thread/INFO]: Preparing spawn area: 90%
[15:04:39] [server thread/INFO]: Changing view distance to 12, from 10
[15:04:40] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 1
[15:04:40] [Netty Server IO #1/INFO] [FML]: Client protocol version 1
[15:04:40] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : [email protected],[email protected],[email protected],[email protected]
[15:04:40] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established
[15:04:40] [server thread/INFO] [FML]: [server thread] Server side modded connection established
[15:04:40] [server thread/INFO]: Player954[local:E:913afe8b] logged in with entity id 320 at (-58.5, 72.0, 246.5)
[15:04:40] [server thread/INFO]: Player954 joined the game
[15:04:43] [server thread/INFO]: Saving and pausing game...
[15:04:43] [server thread/INFO]: Saving chunks for level 'New World'/Overworld
[15:04:46] [server thread/INFO]: Saving chunks for level 'New World'/Nether
[15:04:46] [server thread/INFO]: Saving chunks for level 'New World'/The End
[15:04:46] [server thread/WARN]: Can't keep up! Did the system time change, or is the server overloaded? Running 6587ms behind, skipping 131 tick(s)

 

(The prints in the pre and post events don't happen.)

Link to comment
Share on other sites

Ah, I can't believe I didn't realize this earlier. You have to use

setBlockState

with flag 2, otherwise it will want to do tons of block updates or something. (I remember seeing a list of what the flags were, but I can't seem to find it anymore...)

I.e.

  @Override
  public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
    for (int i = 0; i < 16; i++) {
      for (int j = 0; j < 16; j++) {
        world.setBlockState(new BlockPos(chunkX*16 + i, 127, chunkZ*16 + j), Blocks.glass.getDefaultState(), 2);
      }
    }
  }

 

This creates a glass ceiling:

0cc3a36a0d.jpg

Link to comment
Share on other sites

Uh huh.  Because every decorator gets its own Decorate event.  There should only be 1 pre and 1 post, though.

Yep, and for some strange reason Decorate.Pre and Decorate.Post fire on a different event bus (the normal one) than Decorate itself does (the terrain gen one), which explains why the OP was not getting anywhere with those.

Link to comment
Share on other sites

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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