diff options
author | SHsuperCM <shsupercm@gmail.com> | 2022-03-18 14:30:04 +0200 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2022-03-18 14:30:04 +0200 |
commit | 95f3661f582f2a9fb509af0009827c66626edde3 (patch) | |
tree | b77b648c974ab144a35d2db5848bbf471cf72196 /src/main/java/shcm/shsupercm/fabric | |
parent | c969ba6afc51906b1b361013d262a40b6f797811 (diff) | |
download | CITResewn-95f3661f582f2a9fb509af0009827c66626edde3.tar.gz CITResewn-95f3661f582f2a9fb509af0009827c66626edde3.tar.bz2 CITResewn-95f3661f582f2a9fb509af0009827c66626edde3.zip |
Fixed global properties breaking weird mod resourcepacks
Fixes #117 and #118
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric')
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/mixin/compat/lambdabettergrass/PackParserMixin.java | 26 | ||||
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/pack/PackParser.java | 6 |
2 files changed, 3 insertions, 29 deletions
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(); } |