Cast classes to ButtonImpl properly in Snowy.kt, FabricInit.kt and ForgeInit.kt
This commit is contained in:
parent
b1852f743e
commit
6848b26797
|
@ -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<Class<ButtonImpl>>
|
||||
lateinit var annotatedButtons: Set<Class<out ButtonImpl>>
|
||||
fun onEvent(e: String, lambda: argsLambda) = useKey(e).add(lambda)
|
||||
@JvmField
|
||||
val logs: Logger = LogManager.getLogger()
|
||||
|
|
|
@ -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<Class<ButtonImpl>>
|
||||
).getTypesAnnotatedWith(ButtonInfo::class.java).filter { it.isValidForButtonCollection() }.map { it.asSubclass(ButtonImpl::class.java) }.toSet()
|
||||
}
|
||||
}
|
|
@ -50,7 +50,7 @@ class ForgeInit: Snowy() {
|
|||
}
|
||||
}
|
||||
}
|
||||
.map { Class.forName((it!!.javaClass.getDeclaredField("clazz").apply { isAccessible = true }.get(it) as Type).className) as Class<ButtonImpl> }
|
||||
.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)
|
||||
|
|
Loading…
Reference in New Issue