From a5c562727ddb0c4d93e9a101d568cda52fc707d2 Mon Sep 17 00:00:00 2001 From: SHsuperCM Date: Sat, 18 Sep 2021 11:23:01 +0300 Subject: Added support for literal path not containing resource type directory prefix Fixes #28 --- src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java | 9 +++++++++ .../java/shcm/shsupercm/fabric/citresewn/pack/cits/CITItem.java | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/pack') 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 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); } -- cgit