Compare commits
1 Commits
84e2c6d6e9
...
3e66d7439a
Author | SHA1 | Date |
---|---|---|
Shadowfacts | 3e66d7439a |
|
@ -134,16 +134,17 @@ class TerminalRequestAmountViewController(
|
|||
private fun doRequest() {
|
||||
screen.requestItem(stack, field.number ?: 1)
|
||||
window!!.removeFromScreen()
|
||||
screen.amountVC = null
|
||||
}
|
||||
|
||||
class AmountField(val vc: TerminalRequestAmountViewController): NumberField(1) {
|
||||
override fun keyPressed(keyCode: Int, modifiers: KeyModifiers): Boolean {
|
||||
return if (keyCode == GLFW.GLFW_KEY_ENTER) {
|
||||
return if (super.keyPressed(keyCode, modifiers)) {
|
||||
true
|
||||
} else if (keyCode == GLFW.GLFW_KEY_ENTER) {
|
||||
vc.doRequest()
|
||||
true
|
||||
} else {
|
||||
super.keyPressed(keyCode, modifiers)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.mojang.blaze3d.systems.RenderSystem
|
|||
import net.minecraft.client.MinecraftClient
|
||||
import net.minecraft.client.gui.DrawableHelper
|
||||
import net.minecraft.client.gui.Element
|
||||
import net.minecraft.client.gui.screen.TickableElement
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget
|
||||
import net.minecraft.client.render.Tessellator
|
||||
import net.minecraft.client.render.VertexConsumerProvider
|
||||
|
@ -24,6 +25,7 @@ import net.shadowfacts.phycon.networking.C2STerminalUpdateDisplayedItems
|
|||
import net.shadowfacts.phycon.util.SortMode
|
||||
import java.math.RoundingMode
|
||||
import java.text.DecimalFormat
|
||||
import java.util.LinkedList
|
||||
import kotlin.math.ceil
|
||||
import kotlin.math.min
|
||||
|
||||
|
@ -41,6 +43,8 @@ class TerminalScreen(handler: TerminalScreenHandler, playerInv: PlayerInventory,
|
|||
val backgroundHeight: Int
|
||||
get() = backgroundHeight
|
||||
|
||||
// val tickableElements = LinkedList<TickableElement>()
|
||||
|
||||
val terminalVC = TerminalViewController(this, handler, handler.terminal)
|
||||
var amountVC: TerminalRequestAmountViewController? = null
|
||||
|
||||
|
@ -160,6 +164,10 @@ class TerminalScreen(handler: TerminalScreenHandler, playerInv: PlayerInventory,
|
|||
requestItem(stack, ceil(min(stack.count, stack.maxCount) / 2f).toInt())
|
||||
} else {
|
||||
showRequestAmountDialog(stack)
|
||||
// todo
|
||||
// dialogStack = stack
|
||||
// showingAmountDialog = true
|
||||
// searchBox.setSelected(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue