aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2021-08-27 21:29:31 +0300
committerSHsuperCM <shsupercm@gmail.com>2021-08-27 21:29:31 +0300
commit3a6509fa7b693fd15df3a8d02ec0789e40fab58f (patch)
tree56130211de2cf77dba56593750092dd45993d89f
parentb650306cf3a8a9fe9d2141dea98ff9e63d5ba597 (diff)
downloadCITResewn-3a6509fa7b693fd15df3a8d02ec0789e40fab58f.tar.gz
CITResewn-3a6509fa7b693fd15df3a8d02ec0789e40fab58f.tar.bz2
CITResewn-3a6509fa7b693fd15df3a8d02ec0789e40fab58f.zip
Fixed zipped/directory resourcepack paths depth checks
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java
index 2ad49b0..cf7fe19 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java
@@ -2,6 +2,7 @@ package shcm.shsupercm.fabric.citresewn.pack;
import net.minecraft.resource.ResourcePack;
import net.minecraft.resource.ResourceType;
+import net.minecraft.resource.ZipResourcePack;
import net.minecraft.util.Identifier;
import shcm.shsupercm.fabric.citresewn.CITResewn;
import shcm.shsupercm.fabric.citresewn.ex.CITParseException;
@@ -26,14 +27,17 @@ public class CITParser { private CITParser() {}
final Predicate<String> isProperties = s -> s.endsWith(".properties");
Identifier citresewnCITSettingsIdentifier = new Identifier("minecraft", "citresewn/cit.properties"), mcpatcherCITSettingsIdentifier = new Identifier("minecraft", "mcpatcher/cit.properties"), optifineCITSettingsIdentifier = new Identifier("minecraft", "optifine/cit.properties");
for (ResourcePack pack : packs) {
+ //bugfix for zip resourcepack checking depth incorrectly
+ final int maxDepth = pack instanceof ZipResourcePack ? 0 : Integer.MAX_VALUE;
+
Set<Identifier> packIdentifiers = new HashSet<>();
- packIdentifiers.addAll(pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "citresewn/cit", 2, isProperties));
+ packIdentifiers.addAll(pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "citresewn/cit", maxDepth, isProperties));
if (pack.contains(ResourceType.CLIENT_RESOURCES, citresewnCITSettingsIdentifier))
packIdentifiers.add(citresewnCITSettingsIdentifier);
- packIdentifiers.addAll(pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "mcpatcher/cit", 2, isProperties));
+ packIdentifiers.addAll(pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "mcpatcher/cit", maxDepth, isProperties));
if (pack.contains(ResourceType.CLIENT_RESOURCES, mcpatcherCITSettingsIdentifier))
packIdentifiers.add(mcpatcherCITSettingsIdentifier);
- packIdentifiers.addAll(pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "optifine/cit", 2, isProperties));
+ packIdentifiers.addAll(pack.findResources(ResourceType.CLIENT_RESOURCES, "minecraft", "optifine/cit", maxDepth, isProperties));
if (pack.contains(ResourceType.CLIENT_RESOURCES, optifineCITSettingsIdentifier))
packIdentifiers.add(optifineCITSettingsIdentifier);