aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-12 17:02:08 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-12 17:02:08 +0100
commitb774daef5bd961f955d365ce07bd5aa4acb161f4 (patch)
tree8e5f8f92593f8c594cc25592901342cc8923cee9 /src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt
parent9763a4caa44fb6629aae92f3ad696487d962b0d9 (diff)
downloadFirmament-b774daef5bd961f955d365ce07bd5aa4acb161f4.tar.gz
Firmament-b774daef5bd961f955d365ce07bd5aa4acb161f4.tar.bz2
Firmament-b774daef5bd961f955d365ce07bd5aa4acb161f4.zip
feat: MoulConfig config gui
Diffstat (limited to 'src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt')
-rw-r--r--src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt b/src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt
index 82e151e..5aaa5fa 100644
--- a/src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt
+++ b/src/main/kotlin/gui/config/FirmamentConfigScreenProvider.kt
@@ -1,9 +1,7 @@
package moe.nea.firmament.gui.config
-import java.util.ServiceLoader
-import kotlin.streams.asSequence
import net.minecraft.client.gui.screen.Screen
-import moe.nea.firmament.Firmament
+import moe.nea.firmament.util.compatloader.CompatLoader
interface FirmamentConfigScreenProvider {
val key: String
@@ -11,17 +9,10 @@ interface FirmamentConfigScreenProvider {
fun open(parent: Screen?): Screen
- companion object {
- private val loader = ServiceLoader.load(FirmamentConfigScreenProvider::class.java)
-
+ companion object : CompatLoader<FirmamentConfigScreenProvider>(FirmamentConfigScreenProvider::class) {
val providers by lazy {
- loader.stream().asSequence().mapNotNull { service ->
- kotlin.runCatching { service.get() }
- .getOrElse {
- Firmament.logger.warn("Could not load config provider ${service.type()}", it)
- null
- }
- }.filter { it.isEnabled }
+ allValidInstances
+ .filter { it.isEnabled }
.sortedWith(Comparator.comparing(
{ it.key },
Comparator<String> { left, right ->