diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-08-03 01:37:13 +0300 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-08-03 01:37:13 +0300 |
commit | 37c278d4b1786b0584d47d2f7cc1fca460047feb (patch) | |
tree | 22f4f7b201e4374856cbf7dcee711e9c5e6cc156 /src | |
parent | 725d6122ab72c705fe4ff13597f723ce4af34d41 (diff) | |
download | LibGui-37c278d4b1786b0584d47d2f7cc1fca460047feb.tar.gz LibGui-37c278d4b1786b0584d47d2f7cc1fca460047feb.tar.bz2 LibGui-37c278d4b1786b0584d47d2f7cc1fca460047feb.zip |
Enable keyboard repeat events for LibGui screens
Closes #27.
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java | 8 | ||||
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java | 11 |
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. */ |