38 lines
1.4 KiB
Kotlin
38 lines
1.4 KiB
Kotlin
package net.shadowfacts.extrahoppers.block.wood
|
|
|
|
import com.mojang.blaze3d.platform.GlStateManager
|
|
import net.minecraft.client.MinecraftClient
|
|
import net.minecraft.client.gui.screen.ingame.ContainerScreen
|
|
import net.minecraft.entity.player.PlayerInventory
|
|
import net.minecraft.text.LiteralText
|
|
import net.minecraft.util.Identifier
|
|
|
|
class WoodHopperScreen(container: WoodHopperContainer, playerInv: PlayerInventory): ContainerScreen<WoodHopperContainer>(container, playerInv, LiteralText("Wooden Hopper")) {
|
|
|
|
companion object {
|
|
val BACKGROUND = Identifier("extrahoppers", "textures/gui/wood_hopper.png")
|
|
|
|
fun create(container: WoodHopperContainer): WoodHopperScreen {
|
|
return WoodHopperScreen(container, MinecraftClient.getInstance().player!!.inventory)
|
|
}
|
|
}
|
|
|
|
init {
|
|
containerHeight = 133
|
|
}
|
|
|
|
override fun drawForeground(mouseX: Int, mouseY: Int) {
|
|
font.draw(title.asFormattedString(), 8f, 6f, 0x404040)
|
|
font.draw(playerInventory.displayName.asFormattedString(), 8f, containerHeight - 94f, 0x404040)
|
|
}
|
|
|
|
override fun drawBackground(f: Float, i: Int, j: Int) {
|
|
GlStateManager.color4f(1f, 1f, 1f, 1f)
|
|
minecraft!!.textureManager.bindTexture(BACKGROUND)
|
|
val x = (width - containerWidth) / 2
|
|
val y = (height - containerHeight) / 2
|
|
blit(x, y, 0, 0, containerWidth, containerHeight)
|
|
}
|
|
|
|
}
|