41 lines
1.2 KiB
Kotlin
41 lines
1.2 KiB
Kotlin
package net.shadowfacts.phycon.screen
|
|
|
|
import net.minecraft.client.gui.screen.Screen
|
|
import net.minecraft.client.util.math.MatrixStack
|
|
import net.minecraft.text.TranslatableText
|
|
import net.minecraft.util.Identifier
|
|
import net.shadowfacts.phycon.PhysicalConnectivity
|
|
import net.shadowfacts.phycon.network.DeviceBlockEntity
|
|
import org.lwjgl.glfw.GLFW
|
|
|
|
/**
|
|
* @author shadowfacts
|
|
*/
|
|
class DeviceConsoleScreen(
|
|
val device: DeviceBlockEntity,
|
|
): Screen(TranslatableText("item.phycon.console")) {
|
|
|
|
companion object {
|
|
val BACKGROUND = Identifier(PhysicalConnectivity.MODID, "textures/gui/console.png")
|
|
}
|
|
|
|
override fun isPauseScreen() = false
|
|
|
|
override fun keyPressed(key: Int, j: Int, k: Int): Boolean {
|
|
if (key == GLFW.GLFW_KEY_E) {
|
|
onClose()
|
|
return true
|
|
}
|
|
return super.keyPressed(key, j, k)
|
|
}
|
|
|
|
override fun render(matrixStack: MatrixStack, mouseX: Int, mouseY: Int, delta: Float) {
|
|
renderBackground(matrixStack)
|
|
|
|
super.render(matrixStack, mouseX, mouseY, delta)
|
|
|
|
drawCenteredString(matrixStack, textRenderer, device.macAddress.toString(), width / 2, height / 2 - 5, 0xffffff)
|
|
drawCenteredString(matrixStack, textRenderer, device.ipAddress.toString(), width / 2, height / 2 + 5, 0xffffff)
|
|
}
|
|
}
|