Remove query panel when pressing escape
This commit is contained in:
parent
33aadb2487
commit
f403ce9051
@ -1,5 +1,6 @@
|
||||
package ru.dbotthepony.mc.otm.client.screen.panels.input
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants
|
||||
import net.minecraft.client.gui.screens.Screen
|
||||
import net.minecraft.network.chat.Component
|
||||
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen
|
||||
@ -63,4 +64,14 @@ open class QueryUserPanel<out S: Screen>(
|
||||
|
||||
toScreenCenter()
|
||||
}
|
||||
|
||||
override fun keyPressedInternal(key: Int, scancode: Int, mods: Int): Boolean {
|
||||
if (key == InputConstants.KEY_ESCAPE) {
|
||||
onCancel?.run()
|
||||
remove()
|
||||
return true
|
||||
}
|
||||
|
||||
return super.keyPressedInternal(key, scancode, mods)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user