aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/shcm/shsupercm/fabric/citresewn/cit
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2022-03-06 17:42:04 +0200
committerSHsuperCM <shsupercm@gmail.com>2022-03-06 17:42:04 +0200
commit2356c6bb055079ef03cfd26e9d505ab9cea3960d (patch)
tree4649c1ee2779b4997d1d386222e523d82786f45f /src/main/java/shcm/shsupercm/fabric/citresewn/cit
parent526a5f1da2354d328be10c4d6d2f58b3b73e0d20 (diff)
downloadCITResewn-2356c6bb055079ef03cfd26e9d505ab9cea3960d.tar.gz
CITResewn-2356c6bb055079ef03cfd26e9d505ab9cea3960d.tar.bz2
CITResewn-2356c6bb055079ef03cfd26e9d505ab9cea3960d.zip
Modified global properties api a bit
Diffstat (limited to 'src/main/java/shcm/shsupercm/fabric/citresewn/cit')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/cit/ActiveCITs.java24
1 files changed, 9 insertions, 15 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 5270d20..82f341f 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/cit/ActiveCITs.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/cit/ActiveCITs.java
@@ -62,9 +62,16 @@ public class ActiveCITs { private ActiveCITs() {}
*/
public static void load(ResourceManager resourceManager, Profiler profiler) {
profiler.push("citresewn:disposing");
- disposeAll();
+ for (CITDisposable disposable : FabricLoader.getInstance().getEntrypoints(CITDisposable.ENTRYPOINT, CITDisposable.class))
+ disposable.dispose();
+
+ for (CITTypeContainer<? extends CITType> typeContainer : CITRegistry.TYPES.values())
+ typeContainer.unload();
+
if (active != null) {
- //todo send reset calls to global properties with null value
+ active.globalProperties.properties.replaceAll((key, value) -> Set.of());
+ active.globalProperties.callHandlers();
+
active = null;
}
@@ -96,17 +103,4 @@ public class ActiveCITs { private ActiveCITs() {}
if (!cits.isEmpty())
ActiveCITs.active = active;
}
-
- /**
- * Cleans up any registered disposable element.
- * @see CITDisposable
- * @see CITTypeContainer
- */
- public static void disposeAll() {
- for (CITDisposable disposable : FabricLoader.getInstance().getEntrypoints(CITDisposable.ENTRYPOINT, CITDisposable.class))
- disposable.dispose();
-
- for (CITTypeContainer<? extends CITType> typeContainer : CITRegistry.TYPES.values())
- typeContainer.unload();
- }
}