Skip to content

Commit

Permalink
fix: use esc to close inventories
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 committed Jan 22, 2024
1 parent 471ad8a commit 1d32a14
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public RemoteControlService(@NotNull Screenshot screenshot, @NotNull Minecraft m
this.minecraft = minecraft;
}

private static int vitriKeyToCode(Key key) {
private int vitriKeyToCode(Key key) {
return switch (key) {
case FORWARD -> GLFW.GLFW_KEY_W;
case BACK -> GLFW.GLFW_KEY_S;
Expand All @@ -60,7 +60,14 @@ private static int vitriKeyToCode(Key key) {
case SNEAK -> GLFW.GLFW_KEY_LEFT_SHIFT;
case SPRINT -> GLFW.GLFW_KEY_LEFT_CONTROL;
case ESC -> GLFW.GLFW_KEY_ESCAPE;
case INVENTORY -> GLFW.GLFW_KEY_E;
case INVENTORY -> {
if (minecraft.screen instanceof AbstractContainerScreen<?>) {
// Use escape instead of E to prevent a race condition which crashes the game.
yield GLFW.GLFW_KEY_ESCAPE;
} else {
yield GLFW.GLFW_KEY_E;
}
}
case SWAP_HANDS -> GLFW.GLFW_KEY_F;
case DROP -> GLFW.GLFW_KEY_Q;
case HOTBAR_1 -> GLFW.GLFW_KEY_1;
Expand Down

0 comments on commit 1d32a14

Please sign in to comment.