aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java5
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java11
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java4
3 files changed, 19 insertions, 1 deletions
diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java
index 73b79e0..117aa47 100644
--- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java
+++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/conditions/ConditionItems.java
@@ -26,6 +26,11 @@ public class ConditionItems extends ListCondition<ConditionItems.ItemCondition>
super(ItemCondition.class, ItemCondition::new);
}
+ public ConditionItems(Item... items) {
+ this();
+ this.items = items;
+ }
+
@Override
public void load(PropertyValue value, PropertyGroup properties) throws CITParsingException {
super.load(value, properties);
diff --git a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java
index 02a2bf1..aaca882 100644
--- a/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java
+++ b/defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java
@@ -68,7 +68,16 @@ public class TypeItem extends CITType {
items.addAll(Arrays.asList(conditionItems.items));
if (this.items.size() == 0)
- throw new CITParsingException("Not targeting any item type", properties, -1);
+ try {
+ Identifier propertiesName = new Identifier(properties.stripName());
+ if (!Registry.ITEM.containsId(propertiesName))
+ throw new Exception();
+ Item item = Registry.ITEM.get(propertiesName);
+ conditions.add(new ConditionItems(item));
+ this.items.add(item);
+ } catch (Exception ignored) {
+ throw new CITParsingException("Not targeting any item type", properties, -1);
+ }
Identifier assetIdentifier;
PropertyValue modelProp = properties.getLastWithoutMetadata("citresewn", "model");
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java
index b2806a2..5252330 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/format/PropertyGroup.java
@@ -49,6 +49,10 @@ public abstract class PropertyGroup {
return value;
}
+ public String stripName() {
+ return identifier.getPath().substring(identifier.getPath().lastIndexOf('/') + 1, identifier.getPath().length() - getExtension().length());
+ }
+
public static PropertyGroup tryParseGroup(String packName, Identifier identifier, InputStream is) throws IOException {
PropertyGroup group = null;
if (identifier.getPath().endsWith(PropertiesGroupAdapter.EXTENSION))