Fix vanilla screens escape key not matching done button behavior (#6682)

This commit is contained in:
Jamie Mansfield 2020-05-12 22:18:03 +01:00 committed by GitHub
parent e35c5c9ae4
commit abc98ba56b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,18 @@
--- a/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
+++ b/com/mojang/realmsclient/gui/screens/RealmsGenericErrorScreen.java
@@ -64,6 +64,15 @@
super.tick();
}
+ @Override
+ public boolean keyPressed(int key, int scanCode, int modifiers) {
+ if (key == org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE) {
+ Realms.setScreen(this.field_224228_a);
+ return true;
+ }
+ return super.keyPressed(key, scanCode, modifiers);
+ }
+
public void render(int p_render_1_, int p_render_2_, float p_render_3_) {
this.renderBackground();
this.drawCenteredString(this.field_224229_b, this.width() / 2, 80, 16777215);

View file

@ -0,0 +1,14 @@
--- a/net/minecraft/client/gui/screen/MultiplayerScreen.java
+++ b/net/minecraft/client/gui/screen/MultiplayerScreen.java
@@ -241,6 +241,11 @@
}
+ @Override
+ public void onClose() {
+ this.minecraft.func_147108_a(this.field_146798_g);
+ }
+
public ServerPinger func_146789_i() {
return this.field_146797_f;
}

View file

@ -0,0 +1,15 @@
--- a/net/minecraft/client/gui/screen/OptionsScreen.java
+++ b/net/minecraft/client/gui/screen/OptionsScreen.java
@@ -118,4 +118,12 @@
this.drawCenteredString(this.font, this.title.func_150254_d(), this.width / 2, 15, 16777215);
super.render(p_render_1_, p_render_2_, p_render_3_);
}
+
+ @Override
+ public void onClose() {
+ // We need to consider 2 potential parent screens here:
+ // 1. From the main menu, in which case display the main menu
+ // 2. From the pause menu, in which case exit back to game
+ this.minecraft.func_147108_a(this.field_146441_g instanceof IngameMenuScreen ? null : this.field_146441_g);
+ }
}