aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-08-03 01:37:13 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-08-03 01:37:13 +0300
commit37c278d4b1786b0584d47d2f7cc1fca460047feb (patch)
tree22f4f7b201e4374856cbf7dcee711e9c5e6cc156
parent725d6122ab72c705fe4ff13597f723ce4af34d41 (diff)
downloadLibGui-37c278d4b1786b0584d47d2f7cc1fca460047feb.tar.gz
LibGui-37c278d4b1786b0584d47d2f7cc1fca460047feb.tar.bz2
LibGui-37c278d4b1786b0584d47d2f7cc1fca460047feb.zip
Enable keyboard repeat events for LibGui screens
Closes #27.
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java11
2 files changed, 16 insertions, 3 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
index b3f9bcd..6adf34e 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
@@ -49,13 +49,19 @@ public class CottonClientScreen extends Screen implements TextHoverRendererScree
@Override
public void init(MinecraftClient client, int screenWidth, int screenHeight) {
-
super.init(client, screenWidth, screenHeight);
+ client.keyboard.enableRepeatEvents(true);
description.addPainters();
reposition(screenWidth, screenHeight);
}
+ @Override
+ public void removed() {
+ super.removed();
+ this.client.keyboard.enableRepeatEvents(false);
+ }
+
/**
* Repositions the root panel.
*
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
index 6b65f07..e69755d 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
@@ -61,14 +61,21 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
*/
@Override
- public void init(MinecraftClient minecraftClient_1, int screenWidth, int screenHeight) {
- super.init(minecraftClient_1, screenWidth, screenHeight);
+ public void init(MinecraftClient client, int screenWidth, int screenHeight) {
+ super.init(client, screenWidth, screenHeight);
+ client.keyboard.enableRepeatEvents(true);
description.addPainters();
reposition(screenWidth, screenHeight);
}
+ @Override
+ public void removed() {
+ super.removed();
+ this.client.keyboard.enableRepeatEvents(false);
+ }
+
/**
* Clears the heavyweight peers of this screen's GUI description.
*/