Jump to content

Recommended Posts

Posted (edited)

Can someone explain the base concept of generating structures like end cities or woodland mansions? I know they use different components to build it together, but how does the base concept work and what classes do I need to set such a generation up? I already know how to write structures from ingame to nbt.

Edited by ArmamentHaki
Posted
9 hours ago, deerangle said:

look at 


net.minecraft.world.gen.structure.StructureVillagePieces

 

I noticed that but I was asking for a general overview because there are so many different classes that Minecraft uses and it is hard to keep track of what is where. In my case, I want to generate Villages aswell, but I think Minecraft Villages dont use NBT but hard coded files.

Posted

Although there are ways of generating structures from NBT files Minecraft uses min and max x, y, and z coordinates to decide which blocks go where. The StructureVillagePieces class is an example of this. In order to create a new village component (building) create a class that extends StructureVillagePieces.Village which will be your code for the building itself. An example of this can be found here. You will also need to create a handler the implements IVillageCreationHandler in which you will refer to your new village component class. In your main class preInit you will then need to use 

VillagerRegistry.instance().registerVillageCreationHandler();

to register your handler and

MapGenStructureIO.registerStructureComponent();

to register the component itself.

 

If you want to create an entirely new village instead of single buildings I recommend looking at Galacticraft's code for Moon Villages.

 

Although I haven't look into them much I imagine End Cities and Woodlands are similar to this.

  • Like 3

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.