aboutsummaryrefslogtreecommitdiff
path: root/defaults/src/main/java/shcm/shsupercm/fabric
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-02-18 08:52:52 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-02-18 08:52:52 +0200
commit429b299266e9633e325e4d57e2a582fde1666e7a (patch)
tree5bcb2a14d23f9604a7ea5a9776eb1dbc02e28dc7 /defaults/src/main/java/shcm/shsupercm/fabric
parent9a3952f2a17a94ff98494856b1ed9754d7b6ead6 (diff)
downloadCITResewn-429b299266e9633e325e4d57e2a582fde1666e7a.tar.gz
CITResewn-429b299266e9633e325e4d57e2a582fde1666e7a.tar.bz2
CITResewn-429b299266e9633e325e4d57e2a582fde1666e7a.zip
Fixed item name from properties file name
Diffstat (limited to 'defaults/src/main/java/shcm/shsupercm/fabric')
-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
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");