[Fixed] Server Crash on Startup
This commit is contained in:
parent
f274de6f6f
commit
60963e449b
3 changed files with 24 additions and 23 deletions
|
@ -1,12 +1,9 @@
|
|||
package org.betterx.bclib.config;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
public class Configs {
|
||||
// Client and Server-Config must be the first entries. They are not part of the Auto-Sync process
|
||||
// But will be needed by other Auto-Sync Config-Files
|
||||
@Environment(EnvType.CLIENT)
|
||||
//@Environment(EnvType.CLIENT)
|
||||
public static final ClientConfig CLIENT_CONFIG = new ClientConfig();
|
||||
public static final ServerConfig SERVER_CONFIG = new ServerConfig();
|
||||
|
||||
|
|
|
@ -7,15 +7,17 @@ import net.minecraft.server.Main;
|
|||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
|
||||
@Mixin(value = Main.class, priority = 200)
|
||||
abstract public class MainMixin {
|
||||
@Unique
|
||||
private static LevelStorageSource.LevelStorageAccess bcl_levelStorageAccess = null;
|
||||
|
||||
@ModifyVariable(method = "main", ordinal = 0, at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;getSummary()Lnet/minecraft/world/level/storage/LevelSummary;"))
|
||||
@ModifyVariable(method = "main", ordinal = 0, at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/world/level/storage/LevelStorageSource$LevelStorageAccess;getDataTag()Lcom/mojang/serialization/Dynamic;"))
|
||||
private static LevelStorageSource.LevelStorageAccess bc_createAccess(LevelStorageSource.LevelStorageAccess levelStorageAccess) {
|
||||
bcl_levelStorageAccess = levelStorageAccess;
|
||||
WorldBootstrap.DedicatedServer.applyWorldPatches(levelStorageAccess);
|
||||
|
|
|
@ -114,6 +114,7 @@ public class WorldBootstrap {
|
|||
}
|
||||
|
||||
public static void setupWorld(LevelStorageSource.LevelStorageAccess levelStorageAccess) {
|
||||
if (levelStorageAccess != null && levelStorageAccess.hasWorldData()) {
|
||||
File levelDat = levelStorageAccess.getLevelPath(LevelResource.LEVEL_DATA_FILE).toFile();
|
||||
if (!levelDat.exists()) {
|
||||
WorldsTogether.LOGGER.info("Creating a new World, no fixes needed");
|
||||
|
@ -135,6 +136,7 @@ public class WorldBootstrap {
|
|||
finishedWorldLoad();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean applyWorldPatches(
|
||||
LevelStorageSource.LevelStorageAccess levelStorageAccess
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue