Implemented #463 (pressing ESC in the casting GUI while in the middle of drawing a pattern erases the in-progress pattern rather than closing the screen).
This commit is contained in:
parent
a10b096402
commit
a9c859f56d
|
@ -122,7 +122,7 @@ class GuiSpellcasting constructor(
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
val heldItem = player.getItemInHand(handOpenedWith)
|
val heldItem = player.getItemInHand(handOpenedWith)
|
||||||
if (heldItem.isEmpty || !heldItem.`is`(HexTags.Items.STAVES))
|
if (heldItem.isEmpty || !heldItem.`is`(HexTags.Items.STAVES))
|
||||||
onClose()
|
closeForReal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,6 +287,13 @@ class GuiSpellcasting constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onClose() {
|
override fun onClose() {
|
||||||
|
if (drawState == PatternDrawState.BetweenPatterns)
|
||||||
|
closeForReal()
|
||||||
|
else
|
||||||
|
drawState = PatternDrawState.BetweenPatterns
|
||||||
|
}
|
||||||
|
|
||||||
|
fun closeForReal() {
|
||||||
Minecraft.getInstance().soundManager.stop(HexSounds.CASTING_AMBIANCE.location, null)
|
Minecraft.getInstance().soundManager.stop(HexSounds.CASTING_AMBIANCE.location, null)
|
||||||
|
|
||||||
super.onClose()
|
super.onClose()
|
||||||
|
|
Loading…
Reference in a new issue