aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/util/compatloader
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-28 12:07:55 +0100
committerLinnea Gräf <nea@nea.moe>2024-10-28 12:07:55 +0100
commitc38dcee2c5f483ef5990ae9204355e1bc3c2bf74 (patch)
tree3b70359076001e14514c496e3c44980fdbd92d01 /src/main/kotlin/util/compatloader
parent8ab44088546bf3360564e1a09f0831fea7659d2e (diff)
downloadfirmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.tar.gz
firmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.tar.bz2
firmament-c38dcee2c5f483ef5990ae9204355e1bc3c2bf74.zip
Make REI optional
Diffstat (limited to 'src/main/kotlin/util/compatloader')
-rw-r--r--src/main/kotlin/util/compatloader/CompatLoader.kt3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/kotlin/util/compatloader/CompatLoader.kt b/src/main/kotlin/util/compatloader/CompatLoader.kt
index c5d45bc..6b60e87 100644
--- a/src/main/kotlin/util/compatloader/CompatLoader.kt
+++ b/src/main/kotlin/util/compatloader/CompatLoader.kt
@@ -2,10 +2,13 @@ package moe.nea.firmament.util.compatloader
import java.util.ServiceLoader
import net.fabricmc.loader.api.FabricLoader
+import kotlin.reflect.KClass
import kotlin.streams.asSequence
import moe.nea.firmament.Firmament
abstract class CompatLoader<T : Any>(val kClass: Class<T>) {
+ constructor(kClass: KClass<T>) : this(kClass.java)
+
val loader: ServiceLoader<T> = ServiceLoader.load(kClass)
val allValidInstances by lazy {
loader.reload()