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
|
import net.minecraft.client.Minecraft
|
||||||
|
|
||||||
open class SnowyConfigScreen: SnowyScreen("screen.snowygui.config") { // TODO Actual config screen
|
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) {
|
object: Element(0.0, 0.0, Minecraft.getInstance().window.width, Minecraft.getInstance().window.height) {
|
||||||
override fun render(poseStack: PoseStack?) {
|
override fun render(poseStack: PoseStack?) {
|
||||||
renderBackground(poseStack)
|
renderBackground(poseStack)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package fr.username404.snowygui.gui
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
import net.minecraft.network.chat.TranslatableComponent
|
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)) {
|
abstract class SnowyScreen(translatableString: String = "screen.snowy.gui", private val willPauseScreen: Boolean = false): Screen(TranslatableComponent(translatableString)) {
|
||||||
companion object {
|
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) {
|
override fun render(poseStack: PoseStack?, i: Int, j: Int, f: Float) {
|
||||||
if (poseStack != null) {
|
if (poseStack != null) {
|
||||||
components?.forEach {
|
components.forEach {
|
||||||
it.display(poseStack)
|
it.display(poseStack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue