Jump to content

[1.12] Modifying a Vanilla World Generation Feature


FilthyNoob

Recommended Posts

Hello all -

I'm trying to add a particular world generation feature and I would like some input from the veterans here as to the best way to approach it.

I would like to add to/alter/modify/replace the vanilla WorldGenLakes WorldGenerator so that when a lava lake is generated, a particular ore block is placed nearby. I am interested in, in order of importance:

1) Placing these ore blocks above or immediately adjacent to the edges of the lava lake.

2) Adding this feature to all generated lava lakes

3) Adding this feature in such a way that vanilla generation is otherwise unchanged - that is, for a given seed, the lava lakes would be found in identical places regardless of whether my mod is installed.

4) Respecting the vanilla ChunkGeneratorOverworld settings, particularly lavaLakeChance and useLavaLakes.

I have tried the following approaches:
- I've looked into the PopulateChunkEvent family, but as this event seems to be a gatekeeper only, the event does not give me the ultimate location of the lava lake, only the coordinates of the chunk the feature could be placed in.

- I've tried canceling the aforementioned event and replacing it with my own generator (extending vanilla WorldGenLakes). This gives me access to the position, but I still don't have access to the ChunkGeneratorOverworld settings from the event, effectively changing the position of all vanilla lava lakes (since I don't know how to access lavaLakeChance or useLavaLakes). Furthermore this seems like a brittle approach as if I want the lakes to generate in the same place as vanilla, I will have to copy-paste vanilla code (as the actual feature positioning logic is in ChunkGeneratorOverworld).

- I've tried simply adding a new generator object, but I'm not very satisfied with this approach as it not only creates an overabundance of lava lakes, but creates lava lakes without the ore blocks as vanilla will still be generating.

I'm sure there's something I'm overlooking or missing here, thank you for reading.

Link to comment
Share on other sites

Thank you for the reply.

I've tried that approach, but since I don't know how to access the ChunkGeneratorOverworld settings object, the lakes I generate will be in a different place than in vanilla. The fields lavaLakeChance and useLavaLakes are of particular interest. If I could figure out how to respect vanilla settings this approach would work fine.

Link to comment
Share on other sites

6 hours ago, FilthyNoob said:

Thank you for the reply.

I've tried that approach, but since I don't know how to access the ChunkGeneratorOverworld settings object, the lakes I generate will be in a different place than in vanilla. The fields lavaLakeChance and useLavaLakes are of particular interest. If I could figure out how to respect vanilla settings this approach would work fine.

 

Check if the event's IChunkGenerator is an instance of ChunkGeneratorOverworld, then use reflection to access the ChunkGeneratorOverworld#settings field.

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.

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.