aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/api')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/api/CITTypeContainer.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/api/CITTypeContainer.java b/src/main/java/shcm/shsupercm/fabric/citresewn/api/CITTypeContainer.java
index a9666d3..5aa727d 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/api/CITTypeContainer.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/api/CITTypeContainer.java
@@ -1,7 +1,9 @@
package shcm.shsupercm.fabric.citresewn.api;
+import shcm.shsupercm.fabric.citresewn.cit.ActiveCITs;
import shcm.shsupercm.fabric.citresewn.cit.CIT;
import shcm.shsupercm.fabric.citresewn.cit.CITType;
+import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig;
import java.util.List;
import java.util.function.Supplier;
@@ -12,16 +14,29 @@ public abstract class CITTypeContainer<T extends CITType> implements CITDisposab
public final Supplier<T> createType;
public final String id;
+ protected boolean empty = true;
+
public CITTypeContainer(Class<T> type, Supplier<T> createType, String id) {
this.type = type;
this.createType = createType;
this.id = id;
}
- public abstract void load(List<CIT<T>> parsedCITs);
+ protected abstract void load(List<CIT<T>> parsedCITs);
@SuppressWarnings("unchecked")
public final void loadUntyped(List<?> parsedCITs) {
+ if (!parsedCITs.isEmpty())
+ empty = false;
load((List<CIT<T>>) parsedCITs);
}
+
+ public final void unload() {
+ dispose();
+ empty = true;
+ }
+
+ public boolean active() {
+ return !empty && CITResewnConfig.INSTANCE.enabled && ActiveCITs.isActive();
+ }
}