From 4c5ddd2fddb792afe2816e238e54fd496a6c75c6 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Tue, 18 Mar 2025 21:40:32 +0100 Subject: fix: Isolate mixins in alternative source sets --- src/main/kotlin/features/FeatureManager.kt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/main/kotlin/features/FeatureManager.kt') diff --git a/src/main/kotlin/features/FeatureManager.kt b/src/main/kotlin/features/FeatureManager.kt index 1b39d4e..f0c1857 100644 --- a/src/main/kotlin/features/FeatureManager.kt +++ b/src/main/kotlin/features/FeatureManager.kt @@ -31,6 +31,7 @@ import moe.nea.firmament.features.mining.PickaxeAbility import moe.nea.firmament.features.mining.PristineProfitTracker import moe.nea.firmament.features.world.FairySouls import moe.nea.firmament.features.world.Waypoints +import moe.nea.firmament.util.compatloader.ICompatMeta import moe.nea.firmament.util.data.DataHolder object FeatureManager : DataHolder(serializer(), "features", ::Config) { @@ -83,17 +84,18 @@ object FeatureManager : DataHolder(serializer(), "feature fun subscribeEvents() { SubscriptionList.allLists.forEach { list -> - runCatching { - list.provideSubscriptions { - it.owner.javaClass.classes.forEach { - runCatching { it.getDeclaredField("INSTANCE").get(null) } + if (ICompatMeta.shouldLoad(list.javaClass.name)) + runCatching { + list.provideSubscriptions { + it.owner.javaClass.classes.forEach { + runCatching { it.getDeclaredField("INSTANCE").get(null) } + } + subscribeSingleEvent(it) } - subscribeSingleEvent(it) + }.getOrElse { + // TODO: allow annotating source sets to specifically opt out of loading for mods, maybe automatically + Firmament.logger.info("Ignoring events from $list, likely due to a missing compat mod.", it) } - }.getOrElse { - // TODO: allow annotating source sets to specifically opt out of loading for mods, maybe automatically - Firmament.logger.info("Ignoring events from $list, likely due to a missing compat mod.", it) - } } } -- cgit