aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-02-16 14:46:44 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-02-16 14:46:44 +0200
commit9b04862bfb974a2b6728d1ddcf8a0c93b7bae1fc (patch)
tree84085ecf240d9dfa7656d5a6413cdec53a13741f /src/main/java
parent185dd9defbd5e0a511a6551e7857b01c5353dd5b (diff)
downloadCITResewn-9b04862bfb974a2b6728d1ddcf8a0c93b7bae1fc.tar.gz
CITResewn-9b04862bfb974a2b6728d1ddcf8a0c93b7bae1fc.tar.bz2
CITResewn-9b04862bfb974a2b6728d1ddcf8a0c93b7bae1fc.zip
Unknown conditions will now fail CITs by default
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java5
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/builtin/AlwaysFailCondition.java19
2 files changed, 22 insertions, 2 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java
index fb0f793..af8f430 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CITRegistry.java
@@ -4,6 +4,7 @@ import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier;
import shcm.shsupercm.fabric.citresewn.api.CITConditionContainer;
import shcm.shsupercm.fabric.citresewn.api.CITTypeContainer;
+import shcm.shsupercm.fabric.citresewn.cit.builtin.AlwaysFailCondition;
import shcm.shsupercm.fabric.citresewn.ex.CITParsingException;
import shcm.shsupercm.fabric.citresewn.ex.UnknownCITTypeException;
import shcm.shsupercm.fabric.citresewn.pack.format.PropertyGroup;
@@ -43,8 +44,8 @@ public class CITRegistry {
public static CITCondition parseCondition(PropertyKey key, PropertyValue value, PropertyGroup properties) throws CITParsingException {
CITConditionContainer<? extends CITCondition> conditionContainer = CONDITIONS.get(key);
if (conditionContainer == null) {
- logWarnLoading("Skipping condition: " + CITParsingException.descriptionOf("Unknown condition type", properties, value.position()));
- return null;
+ logWarnLoading(CITParsingException.descriptionOf("Unknown condition type", properties, value.position()));
+ return new AlwaysFailCondition();
}
CITCondition condition = conditionContainer.createCondition.get();
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/builtin/AlwaysFailCondition.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/builtin/AlwaysFailCondition.java
new file mode 100644
index 0000000..f385ae9
--- /dev/null
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/builtin/AlwaysFailCondition.java
@@ -0,0 +1,19 @@
+package shcm.shsupercm.fabric.citresewn.cit.builtin;
+
+import shcm.shsupercm.fabric.citresewn.cit.CITCondition;
+import shcm.shsupercm.fabric.citresewn.cit.CITContext;
+import shcm.shsupercm.fabric.citresewn.ex.CITParsingException;
+import shcm.shsupercm.fabric.citresewn.pack.format.PropertyGroup;
+import shcm.shsupercm.fabric.citresewn.pack.format.PropertyValue;
+
+public class AlwaysFailCondition extends CITCondition {
+ @Override
+ public void load(PropertyValue value, PropertyGroup properties) throws CITParsingException {
+
+ }
+
+ @Override
+ public boolean test(CITContext context) {
+ return false;
+ }
+}