Add a method to the SnowyScreen companion object

This commit is contained in:
Username404-59 2021-04-23 23:21:50 +02:00
parent 73624dbf2d
commit 203ea34ee7
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,13 @@ import net.minecraft.client.gui.screens.Screen
import net.minecraft.network.chat.TranslatableComponent import net.minecraft.network.chat.TranslatableComponent
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 {
fun fromRenderable(r: Renderable, x: Int, y: Int, width: Int, height: Int): Element {
return object: Element(x.toDouble(), y.toDouble(), width, height) {
override fun render(poseStack: PoseStack?) = r.render(poseStack)
}
}
}
open val components: MutableSet<Element>? = null open val components: MutableSet<Element>? = null
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) {