Skip to content

Commit 574a469

Browse files
authored
Update to 1.18.2 (#511)
* Initial update attempt to 1.18.2 * Fix dimension reregistration code
1 parent fcd45a6 commit 574a469

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main/java/dev/compactmods/machines/util/DimensionUtil.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import dev.compactmods.machines.CompactMachines;
66
import dev.compactmods.machines.core.Registration;
77
import net.minecraft.core.Holder;
8+
import net.minecraft.core.MappedRegistry;
89
import net.minecraft.core.Registry;
910
import net.minecraft.resources.RegistryOps;
1011
import net.minecraft.resources.RegistryResourceAccess;
@@ -81,8 +82,15 @@ public static void createAndRegisterWorldAndDimension(final MinecraftServer serv
8182
// then instantiate level, add border listener, add to map, fire world load event
8283

8384
// register the actual dimension
84-
worldGenSettings.dimensions().register(reg.registryOrThrow(Registry.LEVEL_STEM_REGISTRY), dimensionKey, stem);
85-
85+
if(worldGenSettings.dimensions() instanceof MappedRegistry<LevelStem> stems) {
86+
stems.unfreeze();
87+
Registry.register(stems, dimensionKey, stem);
88+
stems.freeze();
89+
} else {
90+
CompactMachines.LOGGER.fatal("Failed to re-register compact machines dimension; registry was not the expected class type.");
91+
return;
92+
}
93+
8694
// create the world instance
8795
final ServerLevel newWorld = new ServerLevel(
8896
server,

0 commit comments

Comments
 (0)