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

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

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

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.

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.