From 95f3661f582f2a9fb509af0009827c66626edde3 Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Fri, 18 Mar 2022 14:30:04 +0200 Subject: Fixed global properties breaking weird mod resourcepacks Fixes #117 and #118 --- .../compat/lambdabettergrass/PackParserMixin.java | 26 ---------------------- .../fabric/citresewn/pack/PackParser.java | 6 ++--- 2 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 src/main/java/shcm/shsupercm/fabric/citresewn/mixin/compat/lambdabettergrass/PackParserMixin.java (limited to 'src') diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/compat/lambdabettergrass/PackParserMixin.java b/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/compat/lambdabettergrass/PackParserMixin.java deleted file mode 100644 index 69e432c..0000000 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/mixin/compat/lambdabettergrass/PackParserMixin.java +++ /dev/null @@ -1,26 +0,0 @@ -package shcm.shsupercm.fabric.citresewn.mixin.compat.lambdabettergrass; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyVariable; -import shcm.shsupercm.fabric.citresewn.pack.PackParser; - -import java.io.IOException; - -@SuppressWarnings("UnresolvedMixinReference") -@Mixin(value = PackParser.class, remap = false) -public class PackParserMixin { - @ModifyVariable(method = "loadGlobalProperties(Lnet/minecraft/resource/ResourceManager;Lshcm/shsupercm/fabric/citresewn/pack/GlobalProperties;)Lshcm/shsupercm/fabric/citresewn/pack/GlobalProperties;", at = - @At(value = "INVOKE", target = "shcm/shsupercm/fabric/citresewn/CITResewn.logErrorLoading(Ljava/lang/String;)V")) - private static IOException citresewn$compat$lambdabettergrass$muteStacktrace(IOException exception) { - if (exception.getMessage().contains("lambdabettergrass")) - return new IOException() { - @Override - public void printStackTrace() { - //no - } - }; - - return exception; - } -} diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java index 9f57760..cd85af1 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java @@ -17,7 +17,6 @@ import shcm.shsupercm.fabric.citresewn.pack.format.PropertyKey; import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue; import java.io.FileNotFoundException; -import java.io.IOException; import java.util.*; import java.util.stream.Collectors; @@ -44,9 +43,10 @@ public final class PackParser { private PackParser() {} for (String root : ROOTS) { Identifier identifier = new Identifier(namespace, root + "/cit.properties"); try { - globalProperties.load(pack.getName(), identifier, pack.open(ResourceType.CLIENT_RESOURCES, identifier)); + if (pack.contains(ResourceType.CLIENT_RESOURCES, identifier)) + globalProperties.load(pack.getName(), identifier, pack.open(ResourceType.CLIENT_RESOURCES, identifier)); } catch (FileNotFoundException ignored) { - } catch (IOException e) { + } catch (Exception e) { CITResewn.logErrorLoading("Errored while loading global properties: " + identifier + " from " + pack.getName()); e.printStackTrace(); } -- cgit