aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2021-08-22 18:40:34 +0300
committerSHsuperCM <shsupercm@gmail.com>2021-08-22 18:59:33 +0300
commit38c7261feca5e3a054109d58794dc62615a09557 (patch)
treef554b24e54f15f3046b6464ff0d14bb74a409ceb /src/main/java
parent9ede90c8610da18ebca8439a09f97f4e79bbe45d (diff)
downloadCITResewn-38c7261feca5e3a054109d58794dc62615a09557.tar.gz
CITResewn-38c7261feca5e3a054109d58794dc62615a09557.tar.bz2
CITResewn-38c7261feca5e3a054109d58794dc62615a09557.zip
Parse weight and added parse exception type to skip log
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParseException.java2
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java2
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java5
3 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParseException.java b/src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParseException.java
index e48f857..d44fa5b 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParseException.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/ex/CITParseException.java
@@ -8,6 +8,6 @@ import net.minecraft.util.Identifier;
*/
public class CITParseException extends Exception {
public CITParseException(ResourcePack resourcePack, Identifier identifier, String message) {
- super("Skipped: " + message + " in " + resourcePack.getName() + " -> " + identifier.getPath());
+ super("Skipped CIT: " + message + " in " + resourcePack.getName() + " -> " + identifier.getPath());
}
}
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 fd4e4ba..d04a5c7 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/CITParser.java
@@ -56,7 +56,7 @@ public class CITParser { private CITParser() {}
citPack.cits.add(parseCIT(citPack, citIdentifier, citProperties));
} catch (Exception e) {
- CITResewn.LOG.error(e.getMessage()); //todo be more descriptive
+ CITResewn.LOG.error(e.getMessage());
}
}
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 b4960f2..218f28b 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
@@ -36,6 +36,8 @@ public abstract class CIT {
public final Predicate<NbtCompound> nbt;
+ private final int weight;
+
public CIT(CITPack pack, Identifier identifier, Properties properties) throws CITParseException {
try {
for (String itemId : (properties.getProperty("items", properties.getProperty("matchItems", " "))).split(" "))
@@ -214,8 +216,9 @@ public abstract class CIT {
return true;
};
+ this.weight = Integer.parseInt(properties.getProperty("weight", "0"));
} catch (Exception e) {
- throw new CITParseException(pack.resourcePack, identifier, e.getMessage());
+ throw new CITParseException(pack.resourcePack, identifier, (e.getClass() == Exception.class ? "" : e.getClass().getSimpleName() + ": ") + e.getMessage());
}
}