Calculated closeOnEsc logic first thing in method (to fix closeOnEsc closing searchBar & entire gui in the same click)

This commit is contained in:
bigguy345 committed 2025-12-20 11:55:40 +02:00
1 parent 4715e2ffbf
commit db0e7da834
1 file changed
+12 -10
@@ -243,16 +243,7 @@ public abstract class GuiNPCInterface extends GuiScreen {
@Override
public void keyTyped(char c, int i) {
if (subgui != null)
subgui.keyTyped(c, i);
for (GuiNpcTextField tf : textfields.values())
tf.textboxKeyTyped(c, i);
for (GuiScrollWindow guiScrollableComponent : scrollWindows.values()) {
guiScrollableComponent.keyTyped(c, i);
}
/*
/*
Fixes closing sub with escape closes all of its parents.
The outermost GUI (root of all subs) closes the deepest open sub on ESC.
*/
@@ -273,6 +264,17 @@ public abstract class GuiNPCInterface extends GuiScreen {
else
close();
}
if (subgui != null)
subgui.keyTyped(c, i);
for (GuiNpcTextField tf : textfields.values())
tf.textboxKeyTyped(c, i);
for (GuiScrollWindow guiScrollableComponent : scrollWindows.values()) {
guiScrollableComponent.keyTyped(c, i);
}
}
public void onGuiClosed() {