diff options
author | SHsuperCM <shsupercm@gmail.com> | 2021-08-21 20:45:03 +0300 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2021-08-21 20:45:03 +0300 |
commit | b3649beaa2cb2b04a7db65d0fdb5eac0468405d3 (patch) | |
tree | b0f83d8e9e1fc87e800b5600759dbe535bae4347 | |
parent | 9d5a632898e886ba0081e189dc88c9ffbaaa8e3b (diff) | |
download | CITResewn-b3649beaa2cb2b04a7db65d0fdb5eac0468405d3.tar.gz CITResewn-b3649beaa2cb2b04a7db65d0fdb5eac0468405d3.tar.bz2 CITResewn-b3649beaa2cb2b04a7db65d0fdb5eac0468405d3.zip |
Bugfixes
damageMask npes
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java | 3 | ||||
-rw-r--r-- | src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java | 10 |
2 files changed, 7 insertions, 6 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 32aa18c..fd4e4ba 100644 --- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java +++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java @@ -56,8 +56,7 @@ public class CITParser { private CITParser() {} citPack.cits.add(parseCIT(citPack, citIdentifier, citProperties)); } catch (Exception e) { - CITResewn.LOG.error(e.getMessage()); - e.printStackTrace(); + CITResewn.LOG.error(e.getMessage()); //todo be more descriptive } } cits.addAll(citPack.cits); 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 58716c1..e5c0809 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 @@ -55,16 +55,18 @@ public abstract class CIT { this.assetIdentifier = modelIdentifier; this.needsModel = false; } else { - String[] split = modelIdentifier.getPath().split("/"); + String[] split = identifier.getPath().split("/"); String parent = String.join("/", Arrays.copyOf(split, split.length - 1, String[].class)); - modelIdentifier = new Identifier(parent + "/" + modelIdentifier.getPath()); + if (!parent.isEmpty()) + parent = parent + "/"; + modelIdentifier = new Identifier(parent + (modelIdentifier.getPath().endsWith(".json") ? modelIdentifier.getPath() : modelIdentifier.getPath() + ".json")); if (pack.resourcePack.contains(ResourceType.CLIENT_RESOURCES, modelIdentifier)) { this.assetIdentifier = modelIdentifier; this.needsModel = false; } else { Identifier textureIdentifier = new Identifier(properties.getProperty("texture", identifier.getPath().substring(0, identifier.getPath().length() - ".properties".length()) + ".png")); if (!pack.resourcePack.contains(ResourceType.CLIENT_RESOURCES, textureIdentifier)) { - textureIdentifier = new Identifier(parent + "/" + textureIdentifier.getPath()); + textureIdentifier = new Identifier(parent + (textureIdentifier.getPath().endsWith(".png") ? textureIdentifier.getPath() : textureIdentifier.getPath() + ".png")); if (!pack.resourcePack.contains(ResourceType.CLIENT_RESOURCES, textureIdentifier)) throw new Exception("CIT must have either a texture or a model"); @@ -103,7 +105,7 @@ public abstract class CIT { } } - this.damageMask = Integer.parseInt(properties.getProperty("damageMask")); + this.damageMask = properties.containsKey("damageMask") ? Integer.parseInt(properties.getProperty("damageMask")) : null; String stackSize = properties.getProperty("stackSize"); if (stackAny = stackSize == null) { |