Refactor pack loading

- Combine initial load and reload logic together between each platform implementation
- Should prevent pack load errors from blocking other packs from loading.
This commit is contained in:
Astrash
2023-11-25 15:10:43 +11:00
parent 4ba71e9c27
commit 59ea5a69d8
5 changed files with 63 additions and 39 deletions

View File

@@ -3,6 +3,9 @@ package com.dfsek.terra.lifecycle;
import ca.solostudios.strata.Versions;
import ca.solostudios.strata.parser.tokenizer.ParseException;
import ca.solostudios.strata.version.Version;
import com.dfsek.terra.registry.master.ConfigRegistry.PackLoadFailuresException;
import net.minecraft.MinecraftVersion;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKeys;
@@ -64,13 +67,7 @@ public abstract class LifecyclePlatform extends ModPlatform {
@Override
public boolean reload() {
getTerraConfig().load(this);
getRawConfigRegistry().clear();
boolean succeed = true;
try {
getRawConfigRegistry().loadAll(this);
} catch(IOException e) {
succeed = false;
}
boolean succeed = loadConfigPacks();
if(server != null) {
BiomeUtil.registerBiomes(server.getRegistryManager().get(RegistryKeys.BIOME));