aboutsummaryrefslogtreecommitdiff
path: root/defaults/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'defaults/src/main/java')
-rw-r--r--defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java14
1 files changed, 12 insertions, 2 deletions
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 58460aa..02c09d6 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
@@ -1,14 +1,16 @@
package shcm.shsupercm.fabric.citresewn.defaults.cit.types;
import io.shcm.shsupercm.fabric.fletchingtable.api.Entrypoint;
+import net.minecraft.item.Item;
import shcm.shsupercm.fabric.citresewn.api.CITTypeContainer;
+import shcm.shsupercm.fabric.citresewn.defaults.cit.conditions.ConditionItems;
import shcm.shsupercm.fabric.citresewn.ex.CITParsingException;
import shcm.shsupercm.fabric.citresewn.pack.cit.CIT;
import shcm.shsupercm.fabric.citresewn.pack.cit.CITCondition;
import shcm.shsupercm.fabric.citresewn.pack.cit.CITType;
import shcm.shsupercm.fabric.citresewn.pack.format.PropertyGroup;
-import java.util.List;
+import java.util.*;
public class TypeItem extends CITType {
@Entrypoint(CITTypeContainer.ENTRYPOINT)
@@ -24,13 +26,21 @@ public class TypeItem extends CITType {
super(TypeItem.class, TypeItem::new, "item");
}
+ public Map<Item, Set<CIT>> loaded = new IdentityHashMap<>();
+
@Override
public void load(List<CIT> parsedCITs) {
+ for (CIT cit : parsedCITs)
+ for (CITCondition condition : cit.conditions)
+ if (condition instanceof ConditionItems items)
+ for (Item item : items.items)
+ if (item != null)
+ loaded.computeIfAbsent(item, i -> new LinkedHashSet<>()).add(cit);
}
@Override
public void dispose() {
-
+ loaded.clear();
}
}
} \ No newline at end of file