diff --git a/common/src/main/kotlin/fr/username404/snowygui/Snowy.kt b/common/src/main/kotlin/fr/username404/snowygui/Snowy.kt index 2e17773..f757a08 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/Snowy.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/Snowy.kt @@ -19,7 +19,7 @@ abstract class Snowy { val Gson: Gson = GsonBuilder().excludeFieldsWithoutExposeAnnotation().create() @JvmStatic protected val FeaturePackage: String = "fr.username404.snowygui.gui.feature" - lateinit var annotatedButtons: Set> + lateinit var annotatedButtons: Set> fun onEvent(e: String, lambda: argsLambda) = useKey(e).add(lambda) @JvmField val logs: Logger = LogManager.getLogger() diff --git a/fabric/src/main/kotlin/fr/username404/snowygui/fabric/FabricInit.kt b/fabric/src/main/kotlin/fr/username404/snowygui/fabric/FabricInit.kt index 7e32691..aadb9cf 100644 --- a/fabric/src/main/kotlin/fr/username404/snowygui/fabric/FabricInit.kt +++ b/fabric/src/main/kotlin/fr/username404/snowygui/fabric/FabricInit.kt @@ -30,6 +30,6 @@ class FabricInit: Snowy(), ClientModInitializer { .setUrls(ClasspathHelper.forPackage(FeaturePackage)) .setScanners(SubTypesScanner(false), TypeAnnotationsScanner()) .useParallelExecutor() - ).getTypesAnnotatedWith(ButtonInfo::class.java).filter { it.isValidForButtonCollection() }.toSet() as Set> + ).getTypesAnnotatedWith(ButtonInfo::class.java).filter { it.isValidForButtonCollection() }.map { it.asSubclass(ButtonImpl::class.java) }.toSet() } } \ No newline at end of file diff --git a/forge/src/main/kotlin/fr/username404/snowygui/forge/ForgeInit.kt b/forge/src/main/kotlin/fr/username404/snowygui/forge/ForgeInit.kt index 2045b46..eca98ed 100644 --- a/forge/src/main/kotlin/fr/username404/snowygui/forge/ForgeInit.kt +++ b/forge/src/main/kotlin/fr/username404/snowygui/forge/ForgeInit.kt @@ -50,7 +50,7 @@ class ForgeInit: Snowy() { } } } - .map { Class.forName((it!!.javaClass.getDeclaredField("clazz").apply { isAccessible = true }.get(it) as Type).className) as Class } + .map { Class.forName((it!!.javaClass.getDeclaredField("clazz").apply { isAccessible = true }.get(it) as Type).className).asSubclass(ButtonImpl::class.java)} .collect(Collectors.toSet()) with(MOD_BUS) { addListener(this@ForgeInit::initSetup)