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

@@ -20,6 +20,9 @@ package com.dfsek.terra.forge;
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.server.MinecraftServer;
@@ -63,13 +66,7 @@ public class ForgePlatform 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();
MinecraftServer server = getServer();