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:
Talia-12 2023-06-01 22:32:17 +10:00
parent a10b096402
commit a9c859f56d

View file

@ -122,7 +122,7 @@ class GuiSpellcasting constructor(
if (player != null) {
val heldItem = player.getItemInHand(handOpenedWith)
if (heldItem.isEmpty || !heldItem.`is`(HexTags.Items.STAVES))
onClose()
closeForReal()
}
}
@ -287,6 +287,13 @@ class GuiSpellcasting constructor(
}
override fun onClose() {
if (drawState == PatternDrawState.BetweenPatterns)
closeForReal()
else
drawState = PatternDrawState.BetweenPatterns
}
fun closeForReal() {
Minecraft.getInstance().soundManager.stop(HexSounds.CASTING_AMBIANCE.location, null)
super.onClose()