Jump to content

[1.18.2] How to extend Overworld depth beyond -64 using code?


Endgineer

Recommended Posts

I'm new to modding, but I've been able to figure out a lot of stuff alone, using the Forge forums, documentation, open-source mods, tutorials. So far so good. But I've now run into an issue that I can't seem to find a solution for on my own. Hoping someone who understands the minecraft worldgen to pitch in.

 

I've been able to extend Overworld depth (using data packs) by providing a data folder within my mod. Namely, I've had to provide a minecraft/dimension_type/overworld.json and a minecraft/noise_settings/overworld.json, only changing the logical_height, min_y, height fields.

 

The issue is, a lot of the logic in my mod relies on the world depth, which I would like to be configurable by the mod user. I could have the config affect only my mod logic and leave it to the user to also provide their own datapack, but that's 2 steps. If it was possible to just have 1 step (i.e. config only or datapack only), I would want to implement that. So I would have to find a way where the datapack's fields get their values from config (doesn't seem possible) or I would have to do this in code.

 

I looked into net.minecraft.world.level.levelgen.NoiseSettings and tried to shadow overworldNoiseSettings and looked into net.minecraft.world.level.dimension.DimensionType and tried to shadow DEFAULT_OVERWORLD. The shadow implementation is simply a copy-paste of the original, save for changing the -64 and 384 values to be fetched from config. This did not work; the world still ends at -64. I know the shadowing works though, because inputting an invalid height in the config causes the game to crash with the invalid height message. It's just that when the world loads under a valid height, it doesn't go beyond -64. I then did a long search and found net.minecraft.world.level.dimension.DimensionDefaults and tried to shadow the OVERWORLD variables. This did not work either; same problem. I looked into so many other classes related to world gen, but they all seemed to directly or indirectly fetch their value from NoiseSettings; so I figured I shouldn't mess with those. I was suspicious of Y_SIZE, MAX_Y, MIN_Y in DimensionType, but when I tried to shadow those, the game crashed at the world creation screen (as soon as you click Singleplayer) with the error saying something about an unbound registry key. If you would like the error log, please let me know. I didn't provide it because I feel like those variables aren't meant to be shadowed.

 

I feel like I'm doing this very wrong. It's like there is some variable I need to shadow somewhere; but I have very little knowledge of any of this game's code, let alone world gen. Hoping someone with more knowledge could point me somewhere. Is what I'm looking for even possible?

 

UNRELATED (but might be of help for someone searching the forums in the future):

If you run into the MC-237017 issue, where lava aquifers would fill the deeper parts of the world, you can fix it using a mixin to shadow globalFluidPicker of NoiseBasedChunkGenerator.

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.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.