Make SnowyScreen.components not-null

This commit is contained in:
Username404-59 2021-04-28 20:38:59 +02:00
parent 996572884e
commit 78e1081aba
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 4 additions and 3 deletions

View File

@ -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)

View File

@ -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)
}
}