diff options
author | SHsuperCM <shsupercm@gmail.com> | 2022-02-13 07:49:24 +0200 |
---|---|---|
committer | SHsuperCM <shsupercm@gmail.com> | 2022-02-13 07:49:24 +0200 |
commit | 8823e77b989ab1035fa8813120177dd3a95ce863 (patch) | |
tree | bef6b859893baae8531039e157497335830d638f /defaults | |
parent | a48789c45fb474a953df65e342a3bad27fd89870 (diff) | |
download | CITResewn-8823e77b989ab1035fa8813120177dd3a95ce863.tar.gz CITResewn-8823e77b989ab1035fa8813120177dd3a95ce863.tar.bz2 CITResewn-8823e77b989ab1035fa8813120177dd3a95ce863.zip |
Item type storage
Diffstat (limited to 'defaults')
-rw-r--r-- | defaults/src/main/java/shcm/shsupercm/fabric/citresewn/defaults/cit/types/TypeItem.java | 14 |
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 |