Compare commits

..

1 Commits

Author SHA1 Message Date
Shadowfacts 84e2c6d6e9
Convert Terminal screen to Cacao 2021-03-20 22:47:57 -04:00
2 changed files with 3 additions and 12 deletions

View File

@ -134,17 +134,16 @@ class TerminalRequestAmountViewController(
private fun doRequest() { private fun doRequest() {
screen.requestItem(stack, field.number ?: 1) screen.requestItem(stack, field.number ?: 1)
window!!.removeFromScreen() window!!.removeFromScreen()
screen.amountVC = null
} }
class AmountField(val vc: TerminalRequestAmountViewController): NumberField(1) { class AmountField(val vc: TerminalRequestAmountViewController): NumberField(1) {
override fun keyPressed(keyCode: Int, modifiers: KeyModifiers): Boolean { override fun keyPressed(keyCode: Int, modifiers: KeyModifiers): Boolean {
return if (super.keyPressed(keyCode, modifiers)) { return if (keyCode == GLFW.GLFW_KEY_ENTER) {
true
} else if (keyCode == GLFW.GLFW_KEY_ENTER) {
vc.doRequest() vc.doRequest()
true true
} else { } else {
false super.keyPressed(keyCode, modifiers)
} }
} }
} }

View File

@ -4,7 +4,6 @@ import com.mojang.blaze3d.systems.RenderSystem
import net.minecraft.client.MinecraftClient import net.minecraft.client.MinecraftClient
import net.minecraft.client.gui.DrawableHelper import net.minecraft.client.gui.DrawableHelper
import net.minecraft.client.gui.Element import net.minecraft.client.gui.Element
import net.minecraft.client.gui.screen.TickableElement
import net.minecraft.client.gui.widget.TextFieldWidget import net.minecraft.client.gui.widget.TextFieldWidget
import net.minecraft.client.render.Tessellator import net.minecraft.client.render.Tessellator
import net.minecraft.client.render.VertexConsumerProvider import net.minecraft.client.render.VertexConsumerProvider
@ -25,7 +24,6 @@ import net.shadowfacts.phycon.networking.C2STerminalUpdateDisplayedItems
import net.shadowfacts.phycon.util.SortMode import net.shadowfacts.phycon.util.SortMode
import java.math.RoundingMode import java.math.RoundingMode
import java.text.DecimalFormat import java.text.DecimalFormat
import java.util.LinkedList
import kotlin.math.ceil import kotlin.math.ceil
import kotlin.math.min import kotlin.math.min
@ -43,8 +41,6 @@ class TerminalScreen(handler: TerminalScreenHandler, playerInv: PlayerInventory,
val backgroundHeight: Int val backgroundHeight: Int
get() = backgroundHeight get() = backgroundHeight
// val tickableElements = LinkedList<TickableElement>()
val terminalVC = TerminalViewController(this, handler, handler.terminal) val terminalVC = TerminalViewController(this, handler, handler.terminal)
var amountVC: TerminalRequestAmountViewController? = null var amountVC: TerminalRequestAmountViewController? = null
@ -164,10 +160,6 @@ class TerminalScreen(handler: TerminalScreenHandler, playerInv: PlayerInventory,
requestItem(stack, ceil(min(stack.count, stack.maxCount) / 2f).toInt()) requestItem(stack, ceil(min(stack.count, stack.maxCount) / 2f).toInt())
} else { } else {
showRequestAmountDialog(stack) showRequestAmountDialog(stack)
// todo
// dialogStack = stack
// showingAmountDialog = true
// searchBox.setSelected(false)
} }
} }
} }