Skip to content

Commit ed6fa04

Browse files
authored
Added the ability to quickly close the savestate/loadstate screen with enter (#53)
When loading/creating a savestate via keybinds, at the end, a screen opens. This is to not unpause the player unexpectedly after the savestate/loadstate. This PR adds the ability to close this screen by pressing enter, like the GUI for renaming the savestate
2 parents c6b5b0f + b2990d7 commit ed6fa04

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/main/java/com/minecrafttas/lotas_light/savestates/gui/SavestateDoneGui.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
package com.minecrafttas.lotas_light.savestates.gui;
22

3+
import org.lwjgl.glfw.GLFW;
4+
35
import net.minecraft.client.gui.GuiGraphics;
46
import net.minecraft.client.gui.components.Button;
7+
//# 1.21.10
8+
//$$import net.minecraft.client.input.KeyEvent;
9+
//# def
10+
//# end
511
import net.minecraft.network.chat.Component;
612

713
public class SavestateDoneGui extends SavestateGui {
@@ -20,4 +26,23 @@ protected void init() {
2026
@Override
2127
public void renderBackground(GuiGraphics guiGraphics, int i, int j, float f) {
2228
}
29+
30+
//# 1.21.10
31+
//$$ public boolean keyPressed(KeyEvent event) {
32+
//$$ if (event.key() == GLFW.GLFW_KEY_ENTER) {
33+
//$$ onClose();
34+
//$$ return true;
35+
//$$ }
36+
//$$ return super.keyPressed(event);
37+
//$$ }
38+
//$$
39+
//# def
40+
public boolean keyPressed(int i, int j, int k) {
41+
if (i == GLFW.GLFW_KEY_ENTER) {
42+
onClose();
43+
return true;
44+
}
45+
return super.keyPressed(i, j, k);
46+
}
47+
//# end
2348
}

0 commit comments

Comments
 (0)