Compatibility with mods and data packs that change vanilla dimension heights
Builderb0y opened this issue ยท 2 comments
Is it a mod compatibility issue?
Yes
Minecraft version
1.20.1
Describe the issue
Background:
Since MC 1.18, mods and data packs have been able to change the height of worlds, including the heights of vanilla overworld, nether, and end. This information is stored in the height
and min_y
properties of the dimension type, and the dimension type is referenced from the world preset.
Cause:
ClientWorldLoader.createSecondaryClientWorld()
calls upon DimensionTypeSync.getDimensionTypeKey()
to infer the dimension type from the world's registry key. This method assumes vanilla dimensions will have vanilla dimension types. However, this assumption can be invalidated with mods and data packs that add a new world preset (or override one of the vanilla world presets) with one which uses vanilla dimensions, but non-vanilla dimension types.
Effect:
The client world will have the wrong dimension type. If the client dimension type has a different height than the server dimension type, then the client world will create chunks which have a different height than the server chunks. Then, when the server tries to sync those chunks to the client, the client will ignore them. This results in the client still believing the chunks are empty after syncing, and no blocks are rendered through portals.
Potential solution:
The server could manually sync the map of world key -> dimension type key to the client on login, and DimensionTypeSync.getDimensionTypeKey()
could query that map instead of checking for hard-coded vanilla dimensions.
Testing:
Here is a data pack which adds a new world type (world type: generator.minecraft.short_nether
in the world creation menu) which changes the nether dimension height from 256 to 128, effectively removing the region above the bedrock ceiling. While using the world type provided by this data pack, nether portals will not display any blocks on the nether side when the portal is opened from the overworld.
Versions:
This issue was initially tested and diagnosed in a dev environment in version 3.1.0 for MC 1.20.1, and that's also where I traced the cause to. I have since reproduced this issue in a production environment in version 2.7.3 for MC 1.19.4 with no other mods using the attached data pack, but I did not verify that the cause was the same. The attached data pack was made in MC 1.19.4, but should still load on 1.20.1. I did not test this issue in any other MC versions.
Mod compatibility disclosure (AKA the only reason why I stated that this is a mod compatibility issue):
Fixing this issue is necessary for compatibility with my own mod, Big Globe, as it provides a new world preset with vastly taller worlds than vanilla. Big Globe can also be used for testing if desired. The attached data pack is simply the minimal setup required to reproduce this issue.