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

I have created a custom village, and have just copied minecraft's code for now to get things to work. But I'm unsure on how to get the structure to actually generate. I have done the

MapGenStructureIO.registerStructure...

and the

StructureVillagePieces.registerVillagePieces();

in my main mod class. But what more do I have to do? The vanilla structures are generated in ChunkProviderGenerate.class from what I understand, how do I get my structure to spawn? Would InitMapGenEvent help with this? If so, how do I use it properly?

 

EDIT: I created a custom world type, so things work now. I have a new question though, about these two fields in MapGenVillage:

this.field_82665_g = 32;
this.field_82666_h = 8;

Anyone knows what these do? I think the first one has something to do with distance to other villages, but I'm not sure about the other one.

Do you want to add buildings to existing villages or create your own villages from scratch?

 

If it's the former, I explain how to do that briefly here.

 

If it's the latter, you may be able to use FML's IWorldGenerator as a wrapper for your MapGenStructure class (since MapGenStructure sets blocks in the World directly rather than using the Block array like other MapGen classes).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author

Do you want to add buildings to existing villages or create your own villages from scratch?

 

If it's the former, I explain how to do that briefly here.

 

If it's the latter, you may be able to use FML's IWorldGenerator as a wrapper for your MapGenStructure class (since MapGenStructure sets blocks in the World directly rather than using the Block array like other MapGen classes).

 

I'm creating my own custom village separate from the vanilla one.

 

Would this be the only way or is there any other way you can think of which doesn't have anything to do with IWorldGenerator (like the vanilla structures as far as I know)?

ChunkProviderGenerate has a fixed number of fields containing the vanilla structures to generate, but you can replace them with your own using InitMapGenEvent. You may be able to extend MapGenVillage to generate both vanilla villages and your own villages, but it would probably be a fairly hackish solution.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

  • Author

ChunkProviderGenerate has a fixed number of fields containing the vanilla structures to generate, but you can replace them with your own using InitMapGenEvent. You may be able to extend MapGenVillage to generate both vanilla villages and your own villages, but it would probably be a fairly hackish solution.

Thanks for your help, I ended up creating a new WorldType with a custom ChunkProviderGenerate instead.

 

I have one more thing to ask, maybe you (or someone else who reads this) know the answer. In MapGenVillage, there are two fields:

this.field_82665_g = 32;
this.field_82666_h = 8;

I think the first one has something to to with distance to other villages, correct me if I'm wrong. But I have no idea what the second one does, can anyone help me here?

If you use your IDE to open the Call Hierarchy on those fields, you can find out where they are used. ;)

 

field_82665_g and field_82666_h are both used to determine if a village can generate in a chunk (x, z) - see MapGenVillage#canSpawnStructureAtCoords for the nitty-gritty.

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.