aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/pack
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2021-09-18 11:23:01 +0300
committerSHsuperCM <shsupercm@gmail.com>2021-09-18 11:23:01 +0300
commita5c562727ddb0c4d93e9a101d568cda52fc707d2 (patch)
treeade44d1340c5879123dcfe6ef145706263520fa6 /src/main/java/shcm/shsupercm/fabric/citresewn/pack
parentaa392bb3825cdc28b08940e38abf6801eb6a531a (diff)
downloadCITResewn-a5c562727ddb0c4d93e9a101d568cda52fc707d2.tar.gz
CITResewn-a5c562727ddb0c4d93e9a101d568cda52fc707d2.tar.bz2
CITResewn-a5c562727ddb0c4d93e9a101d568cda52fc707d2.zip
Added support for literal path not containing resource type directory prefix
Fixes #28
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/pack')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java9
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
index 5971b35..e304e4d 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
@@ -349,6 +349,15 @@ public abstract class CIT {
if (packContains.test(pathIdentifier))
return pathIdentifier;
}
+ pathIdentifier = new Identifier(pathIdentifier.getNamespace(), switch (extension) {
+ case ".png" -> "textures/";
+ case ".json" -> "models/";
+
+ /* UNREACHABLE FAILSAFE */
+ default -> "";
+ } + path);
+ if (packContains.test(pathIdentifier))
+ return pathIdentifier;
}
LinkedList<String> pathParts = new LinkedList<>(Arrays.asList(propertyIdentifier.getPath().split("/")));
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java
index f85ec75..278b427 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java
@@ -58,7 +58,7 @@ public class CITItem extends CIT {
if (assetIdentifier != null)
assetIdentifiers.put(null, assetIdentifier);
else if (modelProp != null && !modelProp.startsWith("models")) {
- assetIdentifier = resolvePath(identifier, "models/" + modelProp, ".json", id -> pack.resourcePack.contains(ResourceType.CLIENT_RESOURCES, id));
+ assetIdentifier = resolvePath(identifier, modelProp, ".json", id -> pack.resourcePack.contains(ResourceType.CLIENT_RESOURCES, id));
if (assetIdentifier != null)
assetIdentifiers.put(null, assetIdentifier);
}