Attempt to prevent early class init from config if config-reflect is loaded

This commit is contained in:
Johannes Frohnmeyer 2022-08-30 20:16:42 +02:00
parent 60f1656dc6
commit 2225ad73ce
Signed by: Johannes
GPG Key ID: E76429612C2929F4
2 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,6 @@ import io.gitlab.jfronny.respackopts.server.ServerInstanceHolder;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier;
import java.io.IOException;
import java.nio.file.Files;
@ -41,7 +40,6 @@ public class Respackopts implements ModInitializer, SaveHook {
public static final String ID = "respackopts";
public static final Logger LOGGER = Logger.forName(ID);
public static final Identifier CONF_ID = new Identifier(ID, "conf.json");
public static Path FALLBACK_CONF_DIR = FabricLoader.getInstance().getConfigDir().resolve(ID);

View File

@ -7,6 +7,7 @@ import io.gitlab.jfronny.respackopts.util.MetaCache;
import io.gitlab.jfronny.respackopts.Respackopts;
import io.gitlab.jfronny.respackopts.model.PackMeta;
import net.minecraft.resource.*;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
@ -56,15 +57,16 @@ public class ResourcePackManagerMixin {
Respackopts.LOGGER.error("Could not read respackopts config in root for " + profileName, e);
}
Identifier confId = new Identifier(Respackopts.ID, "conf.json");
ResourceType packConfType = null;
for (ResourceType type : ResourceType.values()) {
if (rpi.contains(type, Respackopts.CONF_ID)) {
if (rpi.contains(type, confId)) {
packConfType = type;
}
}
if (packConfType != null) {
try (InputStream is = rpi.open(packConfType, Respackopts.CONF_ID)) {
try (InputStream is = rpi.open(packConfType, confId)) {
rpo$readConfiguration(is, dataLocation, rpi.getName(), displayName, toRemove);
} catch (Throwable e) {
Respackopts.LOGGER.error("Could not initialize pack meta for " + profileName, e);