aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/FeatureManager.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-03-18 21:40:32 +0100
committerLinnea Gräf <nea@nea.moe>2025-03-18 21:40:32 +0100
commit4c5ddd2fddb792afe2816e238e54fd496a6c75c6 (patch)
treeed6dfe96e698e5717a38dd90721eab441715eedb /src/main/kotlin/features/FeatureManager.kt
parent40ce4f856718d6b0c7fa15cd40a1f6db2f774e6f (diff)
downloadFirmament-4c5ddd2fddb792afe2816e238e54fd496a6c75c6.tar.gz
Firmament-4c5ddd2fddb792afe2816e238e54fd496a6c75c6.tar.bz2
Firmament-4c5ddd2fddb792afe2816e238e54fd496a6c75c6.zip
fix: Isolate mixins in alternative source sets
Diffstat (limited to 'src/main/kotlin/features/FeatureManager.kt')
-rw-r--r--src/main/kotlin/features/FeatureManager.kt20
1 files changed, 11 insertions, 9 deletions
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<FeatureManager.Config>(serializer(), "features", ::Config) {
@@ -83,17 +84,18 @@ object FeatureManager : DataHolder<FeatureManager.Config>(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)
- }
}
}