Make sure we still initialize the bclib world config

This commit is contained in:
Frank 2023-09-12 23:18:42 +02:00
parent c43264fad2
commit 82711bc84e
2 changed files with 15 additions and 23 deletions

View file

@ -27,5 +27,6 @@ public abstract class CreateWorldScreen_Mixin {
@Inject(method = "createNewWorldDirectory", at = @At("RETURN"))
void wt_createNewWorld(CallbackInfoReturnable<Optional<LevelStorageSource.LevelStorageAccess>> cir) {
WorldBootstrap.Helpers.onRegistryReady(this.getUiState().getSettings().worldgenLoadContext());
WorldBootstrap.InGUI.setupNewWorld(cir.getReturnValue());
}
}

View file

@ -10,7 +10,6 @@ import net.minecraft.core.RegistryAccess;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.levelgen.WorldDimensions;
import net.minecraft.world.level.levelgen.presets.WorldPreset;
import net.minecraft.world.level.storage.LevelResource;
import net.minecraft.world.level.storage.LevelStorageSource;
@ -114,14 +113,23 @@ public class WorldBootstrap {
Helpers.onRegistryReady(access);
}
static Holder<WorldPreset> setupNewWorldCommon(
LevelStorageSource.LevelStorageAccess levelStorageAccess,
Holder<WorldPreset> currentPreset
public static void setupNewWorld(
Optional<LevelStorageSource.LevelStorageAccess> levelStorageAccess
) {
if (levelStorageAccess.isPresent()) {
setupNewWorldCommon(levelStorageAccess.get());
} else {
WorldsTogether.LOGGER.error("Unable to access Level Folder.");
}
}
public static void setupNewWorldCommon(
LevelStorageSource.LevelStorageAccess levelStorageAccess
) {
setupWorld(levelStorageAccess, true, false);
finishedWorldLoad();
return currentPreset;
}
/**
@ -162,23 +170,6 @@ public class WorldBootstrap {
}
public static class InFreshLevel {
public static void setupNewWorld(
String levelID,
WorldDimensions worldDims,
LevelStorageSource levelSource,
Holder<WorldPreset> worldPreset
) {
try {
var levelStorageAccess = levelSource.createAccess(levelID);
InGUI.setupNewWorldCommon(levelStorageAccess, worldPreset);
levelStorageAccess.close();
} catch (Exception e) {
WorldsTogether.LOGGER.error("Failed to initialize data in world", e);
}
}
}
private static void setupWorld(
LevelStorageSource.LevelStorageAccess levelStorageAccess,
boolean newWorld, boolean isServer