Fix missed patch for loading modded dimensions on Dedicated Server start (#8555)

This commit is contained in:
Wyn Price authored and GitHub committed 2022-04-17 14:41:31 -07:00
1 parent bafaf90329
commit 17bd0c4f91
6 files changed
+135

No files matched your search

@@ -66,6 +66,15 @@
LevelSummary levelsummary = levelstoragesource$levelstorageaccess.m_78308_();
if (levelsummary != null) {
if (levelsummary.m_193020_()) {
@@ -160,6 +_,8 @@
worldgensettings = optionset.has(optionspec3) ? dedicatedserverproperties.m_180927_(registryaccess$writable).m_64671_() : dedicatedserverproperties.m_180927_(registryaccess$writable);
}
+ // Forge: Deserialize the WorldGenSettings to ensure modded dims are loaded on first server load. Vanilla behavior only loads from the server.properties and deserializes only after the 2nd server load.
+ worldgensettings = WorldGenSettings.f_64600_.encodeStart(dynamicops, worldgensettings).flatMap(nbt -> WorldGenSettings.f_64600_.parse(dynamicops, nbt)).getOrThrow(false, errorMsg -> {});
PrimaryLevelData primaryleveldata = new PrimaryLevelData(levelsettings, worldgensettings, Lifecycle.stable());
return Pair.of(primaryleveldata, registryaccess$writable.m_203557_());
}
@@ -181,22 +_,33 @@
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.debug.world;
import net.minecraftforge.fml.common.Mod;
/**
* Used to test that modded dimension types and dimensions are loaded on
* a clean dedicated server launch.
*
* To test, start a clean dedicated server (no level.dat), and validate that the dimension
* `server_world_creation_test:server_world_creation_test` exists.
* This can be done with the `execute in` command. For example:
* `execute in server_world_creation_test:server_world_creation_test run say working correctly`
* will say `working correctly` in the chat if successful.
*/
@Mod(ServerWorldCreationTest.MODID)
public class ServerWorldCreationTest
{
static final String MODID = "server_world_creation_test";
public ServerWorldCreationTest()
{
}
}
+2
View File
@@ -214,5 +214,7 @@ license="LGPL v2.1"
modId="hide_neighbor_face_test"
[[mods]]
modId="living_get_projectile_event_test"
[[mods]]
modId="server_world_creation_test"
# ADD ABOVE THIS LINE
@@ -0,0 +1,12 @@
{
"type": "server_world_creation_test:server_world_creation_test",
"generator": {
"type": "minecraft:noise",
"seed": -831522711,
"settings": "server_world_creation_test:server_world_creation_test_noise",
"biome_source": {
"type": "minecraft:fixed",
"biome": "minecraft:plains"
}
}
}
@@ -0,0 +1,17 @@
{
"ultrawarm": false,
"natural": false,
"coordinate_scale": 1,
"has_skylight": true,
"has_ceiling": false,
"ambient_light": 0.1,
"piglin_safe": true,
"bed_works": false,
"respawn_anchor_works": false,
"has_raids": false,
"logical_height": 256,
"min_y": 0,
"height": 256,
"infiniburn": "#minecraft:infiniburn_overworld",
"effects": "minecraft:overworld"
}
@@ -0,0 +1,67 @@
{
"sea_level": 22,
"disable_mob_generation": false,
"aquifers_enabled": true,
"ore_veins_enabled": true,
"legacy_random_source": false,
"default_block": {
"Name": "minecraft:stone"
},
"default_fluid": {
"Name": "minecraft:water",
"Properties": {
"level": "0"
}
},
"noise": {
"min_y": -64,
"height": 384,
"size_horizontal": 1,
"size_vertical": 2,
"sampling": {
"xz_scale": 0.9999999814507745,
"y_scale": 0.9999999814507745,
"xz_factor": 80,
"y_factor": 160
},
"bottom_slide": {
"target": 0.1171875,
"size": 3,
"offset": 0
},
"top_slide": {
"target": -0.078125,
"size": 2,
"offset": 8
},
"terrain_shaper": {
"offset": 0,
"factor": 0,
"jaggedness": 0
}
},
"noise_router": {
"barrier": 0,
"fluid_level_floodedness": 0,
"fluid_level_spread": 0,
"lava": 0,
"temperature": 0,
"vegetation": 0,
"continents": 0,
"erosion": 0,
"depth": 0,
"ridges": 0,
"initial_density_without_jaggedness": 0,
"final_density": {
"type": "minecraft:interpolated",
"argument": "minecraft:overworld/base_3d_noise"
},
"vein_toggle": 0,
"vein_ridged": 0,
"vein_gap": 0
},
"surface_rule": {
"type": "minecraft:sequence",
"sequence": []
}
}