Skip to content

Commit 0e90294

Browse files
committed
fix keyboard_close fires with delay
1 parent cf93b69 commit 0e90294

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/de/srendi/advancedperipherals/client/screens/KeyboardScreen.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ public final void removed() {
9595
return;
9696
}
9797
super.removed();
98+
if (this.minecraft.player != null) {
99+
this.keyboardContainer.removed(this.minecraft.player);
100+
}
98101
this.minecraft.keyboardHandler.setSendRepeatsToGui(false);
99102
}
100103

@@ -167,7 +170,11 @@ public boolean mouseScrolled(double x, double y, double direction) {
167170
@Override
168171
public final boolean keyPressed(int key, int scancode, int modifiers) {
169172
if (key == GLFW.GLFW_KEY_ESCAPE) {
170-
super.onClose();
173+
if (this.minecraft.player != null) {
174+
this.minecraft.player.closeContainer();
175+
} else {
176+
super.onClose();
177+
}
171178
return true;
172179
}
173180
// Forward the tab key to the terminal, rather than moving between controls.

0 commit comments

Comments
 (0)