aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/builtin
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-02-12 16:30:28 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-02-12 16:30:28 +0200
commit4d0abf10e4c8e66f06b61b52aa3dafef0d535e79 (patch)
treed0ff84eda16b6f8c722e8a0c46a65230d23f4ae0 /src/main/java/shcm/shsupercm/fabric/citresewn/builtin
parent3ca2dde4a8e70bd3f8f11b5d7dbad9ddbc9792af (diff)
downloadCITResewn-4d0abf10e4c8e66f06b61b52aa3dafef0d535e79.tar.gz
CITResewn-4d0abf10e4c8e66f06b61b52aa3dafef0d535e79.tar.bz2
CITResewn-4d0abf10e4c8e66f06b61b52aa3dafef0d535e79.zip
Implemented weight condition parsing
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/builtin')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/builtin/WeightCondition.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/builtin/WeightCondition.java b/src/main/java/shcm/shsupercm/fabric/citresewn/builtin/WeightCondition.java
new file mode 100644
index 0000000..9882d7b
--- /dev/null
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/builtin/WeightCondition.java
@@ -0,0 +1,27 @@
+package shcm.shsupercm.fabric.citresewn.builtin;
+
+import io.shcm.shsupercm.fabric.fletchingtable.api.Entrypoint;
+import shcm.shsupercm.fabric.citresewn.api.CITConditionContainer;
+import shcm.shsupercm.fabric.citresewn.ex.CITParsingException;
+import shcm.shsupercm.fabric.citresewn.pack.GlobalProperties;
+import shcm.shsupercm.fabric.citresewn.pack.cit.CITCondition;
+import shcm.shsupercm.fabric.citresewn.pack.cit.CITContext;
+import shcm.shsupercm.fabric.citresewn.pack.format.PropertyGroup;
+import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue;
+
+public class WeightCondition extends CITCondition {
+ @Entrypoint(CITConditionContainer.ENTRYPOINT)
+ public static final CITConditionContainer<WeightCondition> CONTAINER = new CITConditionContainer<>(WeightCondition.class, WeightCondition::new, "weight");
+
+ public int weight = 0;
+
+ @Override
+ public void load(PropertyValue value, PropertyGroup properties, GlobalProperties globalProperties) throws CITParsingException {
+ this.weight = parseInteger(value, properties);
+ }
+
+ @Override
+ public boolean test(CITContext context) {
+ return true;
+ }
+}