38 lines
1.1 KiB
Kotlin
38 lines
1.1 KiB
Kotlin
package net.shadowfacts.extrahoppers.block.base
|
|
|
|
import com.mojang.blaze3d.platform.GlStateManager
|
|
import net.minecraft.client.gui.screen.ingame.ContainerScreen
|
|
import net.minecraft.entity.player.PlayerInventory
|
|
import net.minecraft.text.Text
|
|
import net.minecraft.util.Identifier
|
|
|
|
/**
|
|
* @author shadowfacts
|
|
*/
|
|
abstract class BaseHopperScreen<T: BaseHopperContainer>(
|
|
container: T,
|
|
playerInv: PlayerInventory,
|
|
title: Text
|
|
): ContainerScreen<T>(container, playerInv, title) {
|
|
|
|
abstract val background: Identifier
|
|
|
|
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(delta: Float, mouseX: Int, mouseY: 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)
|
|
}
|
|
|
|
}
|