[Change] BetterX-Type initialization Code for Servers
This commit is contained in:
parent
e139f9946e
commit
75d2c80519
2 changed files with 9 additions and 18 deletions
|
@ -2,9 +2,7 @@ package org.betterx.worlds.together.mixin.common;
|
||||||
|
|
||||||
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
import org.betterx.worlds.together.world.event.WorldBootstrap;
|
||||||
|
|
||||||
import com.mojang.serialization.DynamicOps;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.nbt.Tag;
|
|
||||||
import net.minecraft.resources.RegistryOps;
|
|
||||||
import net.minecraft.server.Main;
|
import net.minecraft.server.Main;
|
||||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||||
|
|
||||||
|
@ -23,14 +21,12 @@ abstract public class MainMixin {
|
||||||
WorldBootstrap.DedicatedServer.applyWorldPatches(levelStorageAccess);
|
WorldBootstrap.DedicatedServer.applyWorldPatches(levelStorageAccess);
|
||||||
return levelStorageAccess;
|
return levelStorageAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ModifyArg(method = "main", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;saveDataTag(Lnet/minecraft/core/RegistryAccess;Lnet/minecraft/world/level/storage/WorldData;)V"))
|
||||||
@ModifyArg(method = "method_43613", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;getDataTag(Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/world/level/WorldDataConfiguration;Lnet/minecraft/core/Registry;Lcom/mojang/serialization/Lifecycle;)Lcom/mojang/datafixers/util/Pair;"))
|
private static RegistryAccess bcl_onCreate(RegistryAccess registryAccess) {
|
||||||
private static DynamicOps<Tag> bcl_onCreate(DynamicOps<Tag> dynamicOps) {
|
WorldBootstrap.DedicatedServer.registryReady(registryAccess);
|
||||||
if (dynamicOps instanceof RegistryOps<Tag> regOps) {
|
|
||||||
WorldBootstrap.DedicatedServer.registryReady(regOps);
|
|
||||||
}
|
|
||||||
WorldBootstrap.DedicatedServer.setupWorld(bcl_levelStorageAccess);
|
WorldBootstrap.DedicatedServer.setupWorld(bcl_levelStorageAccess);
|
||||||
return dynamicOps;
|
|
||||||
|
return registryAccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import org.betterx.bclib.BCLib;
|
||||||
import org.betterx.bclib.config.Configs;
|
import org.betterx.bclib.config.Configs;
|
||||||
import org.betterx.worlds.together.WorldsTogether;
|
import org.betterx.worlds.together.WorldsTogether;
|
||||||
import org.betterx.worlds.together.levelgen.WorldGenUtil;
|
import org.betterx.worlds.together.levelgen.WorldGenUtil;
|
||||||
import org.betterx.worlds.together.mixin.common.RegistryOpsAccessor;
|
|
||||||
import org.betterx.worlds.together.mixin.common.WorldPresetAccessor;
|
import org.betterx.worlds.together.mixin.common.WorldPresetAccessor;
|
||||||
import org.betterx.worlds.together.surfaceRules.SurfaceRuleUtil;
|
import org.betterx.worlds.together.surfaceRules.SurfaceRuleUtil;
|
||||||
import org.betterx.worlds.together.world.WorldConfig;
|
import org.betterx.worlds.together.world.WorldConfig;
|
||||||
|
@ -18,8 +17,6 @@ import net.minecraft.core.LayeredRegistryAccess;
|
||||||
import net.minecraft.core.Registry;
|
import net.minecraft.core.Registry;
|
||||||
import net.minecraft.core.RegistryAccess;
|
import net.minecraft.core.RegistryAccess;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.nbt.Tag;
|
|
||||||
import net.minecraft.resources.RegistryOps;
|
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.server.RegistryLayer;
|
import net.minecraft.server.RegistryLayer;
|
||||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||||
|
@ -109,10 +106,8 @@ public class WorldBootstrap {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class DedicatedServer {
|
public static class DedicatedServer {
|
||||||
public static void registryReady(RegistryOps<Tag> regOps) {
|
public static void registryReady(RegistryAccess acc) {
|
||||||
if (regOps instanceof RegistryOpsAccessor acc) {
|
Helpers.onRegistryReady(acc);
|
||||||
//Helpers.onRegistryReady(acc.bcl_getLookupProvider().);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setupWorld(LevelStorageSource.LevelStorageAccess levelStorageAccess) {
|
public static void setupWorld(LevelStorageSource.LevelStorageAccess levelStorageAccess) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue