Don't unfocus terminal search box on click

This commit is contained in:
Shadowfacts 2021-02-17 23:24:17 -05:00
parent 9d16a7e5cd
commit 870785f6f2
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import net.minecraft.client.gui.widget.TextFieldWidget
import net.minecraft.client.util.math.MatrixStack
import net.minecraft.entity.player.PlayerInventory
import net.minecraft.screen.slot.Slot
import net.minecraft.screen.slot.SlotActionType
import net.minecraft.text.LiteralText
import net.minecraft.text.Text
import net.minecraft.util.Identifier
@ -89,6 +90,13 @@ class TerminalScreen(handler: TerminalScreenHandler, playerInv: PlayerInventory,
DrawableHelper.fill(matrixStack, slot.x, slot.y, slot.x + 16, slot.y + 16, color.toInt())
}
override fun onMouseClick(slot: Slot?, i: Int, j: Int, slotActionType: SlotActionType?) {
super.onMouseClick(slot, i, j, slotActionType)
// don't unfocus the search box on mouse click
searchBox.setSelected(true)
}
override fun charTyped(c: Char, i: Int): Boolean {
val oldText = searchBox.text
if (searchBox.charTyped(c, i)) {