diff options
Diffstat (limited to 'defaults')
2 files changed, 15 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"); |