Jump to content

Recommended Posts

Posted

Hi, i'm doing a school project regarding terrain generation in minecraft and i'm having some problems.

 

I already managed to generate structures ingame but i also need to override minecraft generation to generate the entire world and i can't figure out how.

I know that i can create a new dimension to generate my world but i really would like to do it in the overworld if possible.

 

How can i achieve that?

 

Thank you. 

Posted

You need to create a new world type or overwrite the default and in the new WorldType.class you create you can specify a custom ChunkProviderGenerate - look at the default version that is where the generation is done.

Posted

Thank you very much it worked.

But now i have another question...

 

I looked into the ChunkProvider and i noticed two methods to generate terrain :

1)

The first one is to create an array of bytes and send it to this method

public Chunk(World world, byte[] ids, byte[] metadata, int chunkX, int chunkZ)

 

Wich doesn't seem too complicated

 

2)

The second is (i think) to generate the terrain data after creating the chunk like this

 

// Generate extended block storage
                for (int y=0; y<16; y++) {
                        chunk.getBlockStorageArray()[y] = new ExtendedBlockStorage(y << 4, true);
                }
                // Generate 16x16 square of grass blocks at y value of 63.
                for (int x=0; x<16; x++) {
                        for (int z=0; z<16; z++) {
                                chunk.getBlockStorageArray()[3].setExtBlockID(x, 15/*y*/, z, Block.grass.blockID);
                        }
                }

 

i don't really understand how it works but it does

 

Which one is the best to use?

Thanks again.

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.