Make SnowyScreen.components not-null
This commit is contained in:
parent
996572884e
commit
78e1081aba
|
@ -6,7 +6,7 @@ import fr.username404.snowygui.gui.SnowyScreen
|
|||
import net.minecraft.client.Minecraft
|
||||
|
||||
open class SnowyConfigScreen: SnowyScreen("screen.snowygui.config") { // TODO Actual config screen
|
||||
override val components: MutableSet<Element>? = mutableSetOf(
|
||||
override val components: MutableSet<Element> = mutableSetOf(
|
||||
object: Element(0.0, 0.0, Minecraft.getInstance().window.width, Minecraft.getInstance().window.height) {
|
||||
override fun render(poseStack: PoseStack?) {
|
||||
renderBackground(poseStack)
|
||||
|
|
|
@ -3,6 +3,7 @@ package fr.username404.snowygui.gui
|
|||
import com.mojang.blaze3d.vertex.PoseStack
|
||||
import net.minecraft.client.gui.screens.Screen
|
||||
import net.minecraft.network.chat.TranslatableComponent
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
abstract class SnowyScreen(translatableString: String = "screen.snowy.gui", private val willPauseScreen: Boolean = false): Screen(TranslatableComponent(translatableString)) {
|
||||
companion object {
|
||||
|
@ -12,10 +13,10 @@ abstract class SnowyScreen(translatableString: String = "screen.snowy.gui", priv
|
|||
}
|
||||
}
|
||||
}
|
||||
open val components: MutableSet<Element>? = null
|
||||
open val components: MutableSet<Element> by Delegates.notNull()
|
||||
override fun render(poseStack: PoseStack?, i: Int, j: Int, f: Float) {
|
||||
if (poseStack != null) {
|
||||
components?.forEach {
|
||||
components.forEach {
|
||||
it.display(poseStack)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue