aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/cit
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-02-13 11:01:45 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-02-13 11:01:45 +0200
commitfe02178b220ebf57225bd092bfdb0d8b88067c33 (patch)
tree181746d9bdc746df55edc75558236fef13085b3d /src/main/java/shcm/shsupercm/fabric/citresewn/cit
parent49318a4452f629274e96001700006e0b4a1464a5 (diff)
downloadCITResewn-fe02178b220ebf57225bd092bfdb0d8b88067c33.tar.gz
CITResewn-fe02178b220ebf57225bd092bfdb0d8b88067c33.tar.bz2
CITResewn-fe02178b220ebf57225bd092bfdb0d8b88067c33.zip
Generified CITs to their type
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/cit')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/ActiveCITs.java10
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/CIT.java6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/ActiveCITs.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/ActiveCITs.java
index d24faf8..f54cc54 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/ActiveCITs.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/ActiveCITs.java
@@ -23,7 +23,7 @@ public class ActiveCITs implements CITDisposable { private ActiveCITs() {}
public final GlobalProperties globalProperties = new GlobalProperties();
- public final Map<Class<? extends CITType>, List<CIT>> cits = new IdentityHashMap<>();
+ public final Map<Class<? extends CITType>, List<CIT<?>>> cits = new IdentityHashMap<>();
public static ActiveCITs load(ResourceManager resourceManager, Profiler profiler) {
profiler.push("citresewn:disposing");
@@ -39,13 +39,13 @@ public class ActiveCITs implements CITDisposable { private ActiveCITs() {}
active.globalProperties.callHandlers();
profiler.swap("citresewn:load_cits");
- for (CIT cit : PackParser.loadCITs(resourceManager))
+ for (CIT<?> cit : PackParser.loadCITs(resourceManager))
active.cits.computeIfAbsent(cit.type.getClass(), type -> new ArrayList<>()).add(cit);
- for (Map.Entry<Class<? extends CITType>, List<CIT>> entry : active.cits.entrySet()) {
- entry.getValue().sort(Comparator.<CIT>comparingInt(cit -> cit.weight).reversed().thenComparing(cit -> cit.propertiesIdentifier.toString()));
+ for (Map.Entry<Class<? extends CITType>, List<CIT<?>>> entry : active.cits.entrySet()) {
+ entry.getValue().sort(Comparator.<CIT<?>>comparingInt(cit -> cit.weight).reversed().thenComparing(cit -> cit.propertiesIdentifier.toString()));
for (CITTypeContainer<? extends CITType> typeContainer : CITRegistry.TYPES.values())
if (typeContainer.type == entry.getKey()) {
- typeContainer.load(entry.getValue());
+ typeContainer.loadUntyped(entry.getValue());
break;
}
}
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CIT.java b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CIT.java
index ea75c04..7cc5724 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CIT.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/CIT.java
@@ -2,14 +2,14 @@ package shcm.shsupercm.fabric.citresewn.cit;
import net.minecraft.util.Identifier;
-public class CIT {
+public class CIT<T extends CITType> {
public final Identifier propertiesIdentifier;
public final String packName;
- public final CITType type;
+ public final T type;
public final CITCondition[] conditions;
public final int weight;
- public CIT(Identifier propertiesIdentifier, String packName, CITType type, CITCondition[] conditions, int weight) {
+ public CIT(Identifier propertiesIdentifier, String packName, T type, CITCondition[] conditions, int weight) {
this.propertiesIdentifier = propertiesIdentifier;
this.packName = packName;
this.type = type;