The Bug
For some very odd reason you need to click F3 twice now if you change gamemodes this way. Doesn't affect commands. Very good UI for the new gamemode screen I have to say, good work Mojang!
Steps to Reproduce
Open the gamemode switcher and switch into any gamemode. (Hold F3 and press F4 to bring up this menu and to navigate between gamemodes).
Hit the F3 key in an attempt to enable the debug menu.
Take note of whether the F3 debug menu is enabled.
Hit the F3 key again.
Take note as to whether or not the F3 debug menu is now enabled.
Observed Behavior
After using the gamemode switcher, you are required to press the F3 key twice in order to enable the debug menu.
Expected Behavior
After using the gamemode switcher, you would not be required to press the F3 key twice in order to enable the debug menu. Instead, you should only have to press the F3 key once in order to enable the debug menu after using the gamemode switcher.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 7
Attachments
Comments 35
The fix by @TriWonder81 resolves the bug, but it creates a new one:
When pressing F3+F4+ESC and then releasing F3, the debug menu will open, which doesn't happen without the fix. This occurs because when pressing F3+F4, this.switchF3State
is set to false, but when pressing ESC to exit the screen, this.switchF3State
isn't changed, which means the F3 menu will open when F3 is released.
Both the initial and the new bug can be fixed by adding setSwitchF3State
method to net.minecraft.client.Keyboard.java:
public void setSwitchF3State(boolean switchF3State) {
this.switchF3State = switchF3State;
}
and changing switchF3State
in checkForClose
method of net.minecraft.client.gui.screen.GameModeSelectionScreen.java
:
private boolean checkForClose() {
if (!InputUtil.isKeyPressed(this.client.getWindow().getHandle(), GLFW.GLFW_KEY_F3)) {
this.apply();
this.client.setScreen(null);
this.client.keyboard.setSwitchF3State(false); // added
return true;
} else {
return false;
}
}
so, when GameModeSelectionScreen
closes by releasing F3, switchF3State
is set to false, otherwise, when ESC is pressed, it is true.
Can confirm