Jump to content

[1.11.2] How to generate structures bigger than a chunk


GooberGunter

Recommended Posts

What is the best way to generate structures bigger than a chunk? Are there tutorials for it?

I've looked it up online and I know that WorldGenerator shouldn't be used for things bigger than a chunk, and I've seen that the bigger structures in minecraft like strongholds and the woodland mansion have chunkproviders, but I haven't found any tutorials on those.

Edited by GooberGunter
Link to comment
Share on other sites

Use Structure Blocks. You can look at Igloos and newer Minecraft structures for example. Basically, all you need to do is build your structure, save it to NBT using Structure Blocks, and load it in through a Template.

 

If you want a structure bigger than 32x32, you can make multiple Structure Blocks and when you spawn the structure in you can the multiple files in and just offset positions depending on the piece. I have some code on my GitHub as well using Structure Blocks.

Developer of Levels and Lost Eclipse

Link to comment
Share on other sites

Yes - instead of having a bunch of setBlockState calls specifying every single block in your structure, you can load your structure from NBT in a very few lines of code. Just call the template method to set the blocks in the world in your WorldGenerator class.

Developer of Levels and Lost Eclipse

Link to comment
Share on other sites

4 hours ago, TheXFactor117 said:

you can load your structure from NBT in a very few lines of code

And that "structure" can include the air you want as a buffer around and/or above.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

On 7/15/2017 at 8:14 PM, TheXFactor117 said:

Use Structure Blocks. You can look at Igloos and newer Minecraft structures for example. Basically, all you need to do is build your structure, save it to NBT using Structure Blocks, and load it in through a Template.

 

If you want a structure bigger than 32x32, you can make multiple Structure Blocks and when you spawn the structure in you can the multiple files in and just offset positions depending on the piece. I have some code on my GitHub as well using Structure Blocks.

Is this method also supported in 1.10.2? If so, can I still have some randomization in structures?

Link to comment
Share on other sites

Yes, I believe structure blocks were added in 1.10.

 

As for randomization, what exactly do you want randomized? One draw back of loading from NBT that I found is you can't change the blocks that are saved in the NBT. I haven't looked into it too much though, so there might be a way. You can use Data Blocks to put on top of chests or other important blocks to load loot tables for example too.

Developer of Levels and Lost Eclipse

Link to comment
Share on other sites

When saving your structure, place a monster spawner (the default one) and place a data block on top of it and name it like monster_spawner or something. When you add the blocks to the world, you can call a method which will handle the data blocks. Here is my method for handling data blocks for an example.

 

Essentially you just need to loop through all data blocks in the structure - if the data block name matches the one you are looking for, you can do stuff with the block underneath. For example in my structures, I'm setting the loot table for the chest. For monster spawners, you can get an instance of the Tile Entity and modify it there. After you are done modifying it, simply set the data block to an air block or whatever block you want (or else it'll spawn a random block based on where it is located).

  • Like 1

Developer of Levels and Lost Eclipse

Link to comment
Share on other sites

  • 1 year later...
On 7/16/2017 at 2:14 AM, TheXFactor117 said:

Use Structure Blocks. You can look at Igloos and newer Minecraft structures for example. Basically, all you need to do is build your structure, save it to NBT using Structure Blocks, and load it in through a Template.

 

If you want a structure bigger than 32x32, you can make multiple Structure Blocks and when you spawn the structure in you can the multiple files in and just offset positions depending on the piece. I have some code on my GitHub as well using Structure Blocks.

Hey TheXFactor, did you move the code to somewhere else?  I wanted to look at some code examples with multiple structure blocks in only one structure but the link that you posted is no longer available. 

Do you know other tutorials/code that can help me?

Link to comment
Share on other sites

10 minutes ago, JDL said:

Hey TheXFactor, did you move the code to somewhere else?  I wanted to look at some code examples with multiple structure blocks in only one structure but the link that you posted is no longer available. 

Do you know other tutorials/code that can help me?

He still has some old tutorials posted on GitHub: https://github.com/doctorhealt3/TheXFactor117s-Forge-Tutorials/blob/master/OldTutorials.md but I can't find anything relevant to this topic. 

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.