diff --git a/build.gradle.kts b/build.gradle.kts index 989839d..c87388a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "tmb.randy" -version = "1.2" +version = "1.2.1" java.toolchain.languageVersion.set(JavaLanguageVersion.of(17)) diff --git a/core/src/main/java/tmb/randy/tmbgriefergames/core/Addon.java b/core/src/main/java/tmb/randy/tmbgriefergames/core/Addon.java index bd1243b..26cecfd 100644 --- a/core/src/main/java/tmb/randy/tmbgriefergames/core/Addon.java +++ b/core/src/main/java/tmb/randy/tmbgriefergames/core/Addon.java @@ -77,6 +77,9 @@ public GameInfoWidget getGameInfoWidget() { } public static boolean isChatGuiOpen() { + if(!Laby.labyAPI().minecraft().isMouseLocked()) + return true; + for (IngameOverlayActivity activity : Laby.labyAPI().ingameOverlay().getActivities()) { if(activity.isAcceptingInput()) { return true; diff --git a/core/src/main/java/tmb/randy/tmbgriefergames/core/config/AutoCrafterSubConfig.java b/core/src/main/java/tmb/randy/tmbgriefergames/core/config/AutoCrafterSubConfig.java index 62efe71..196b602 100644 --- a/core/src/main/java/tmb/randy/tmbgriefergames/core/config/AutoCrafterSubConfig.java +++ b/core/src/main/java/tmb/randy/tmbgriefergames/core/config/AutoCrafterSubConfig.java @@ -1,5 +1,7 @@ package tmb.randy.tmbgriefergames.core.config; +import net.labymod.api.client.gui.screen.key.Key; +import net.labymod.api.client.gui.screen.widget.widgets.input.MultiKeybindWidget.MultiKeyBindSetting; import net.labymod.api.client.gui.screen.widget.widgets.input.SwitchWidget.SwitchSetting; import net.labymod.api.client.gui.screen.widget.widgets.input.dropdown.DropdownWidget.DropdownSetting; import net.labymod.api.configuration.loader.Config; @@ -23,6 +25,9 @@ public class AutoCrafterSubConfig extends Config { @DropdownSetting private final ConfigProperty finalAction = new ConfigProperty<>(AutoCrafterNewFinalAction.COMP); + @MultiKeyBindSetting + private final ConfigProperty autoCompHotkey = new ConfigProperty<>(new Key[]{Key.ARROW_LEFT, Key.ARROW_UP, Key.ARROW_RIGHT}); + public ConfigProperty getAutoCraftSpeed() { return this.autoCraftSpeed; } public ConfigProperty getAutoDrop() { return this.autoDrop; @@ -35,4 +40,6 @@ public ConfigProperty getEndlessMode() { public ConfigProperty getOnlyFullStacks() { return this.onlyFullStacks; } public ConfigProperty getFinalAction() { return finalAction; } + + public ConfigProperty getAutoCompHotkey() {return autoCompHotkey;} } \ No newline at end of file diff --git a/core/src/main/resources/assets/tmbgriefergames/i18n/de_de.json b/core/src/main/resources/assets/tmbgriefergames/i18n/de_de.json index a4e1a4f..e5af441 100644 --- a/core/src/main/resources/assets/tmbgriefergames/i18n/de_de.json +++ b/core/src/main/resources/assets/tmbgriefergames/i18n/de_de.json @@ -119,7 +119,7 @@ "name": "Lobby überspringen" }, "autoCrafterConfig": { - "name": "Autocrafter", + "name": "Autocrafter & Autokomprimierer", "description": "Es gibt 2 verschiedene Autocrafter:\\n\\nV1 nutzt das Vanilla Crafting Menü (Werkbank). Lege dein Rezept in die Werkbank und speichere mit SHIFT + ENTER. Drücke anschließend ENTER, um das Rezept zu craften.\\n\\nV2 nutzt das /rezepte Menü. Lege das Item, welches du craften willst in deinen ersten Hotbar Slot. Gib anschließend /autocraft in den Chat ein. Das /rezepte Menü öffnet sich automatisch und craftet deine Items.", "autoCraftSpeed": { "name": "[V1] Geschwindigkeit" @@ -137,6 +137,9 @@ "finalAction": { "name": "[V2] Schlussaktion", "description": "Legt fest, ob bei Nutzung des Autocrafters V2 (/autocraft) die gecrafteten Items aus dem Inventar geworfen oder komprimiert werden sollen." + }, + "autoCompHotkey": { + "name": "Hotkey für Autokomprimierer" } } }, diff --git a/core/src/main/resources/assets/tmbgriefergames/i18n/en_us.json b/core/src/main/resources/assets/tmbgriefergames/i18n/en_us.json index 48e2a5d..2f0246f 100644 --- a/core/src/main/resources/assets/tmbgriefergames/i18n/en_us.json +++ b/core/src/main/resources/assets/tmbgriefergames/i18n/en_us.json @@ -119,7 +119,7 @@ "description": "Go to the previous plot (/p h -1)" }, "autoCrafterConfig": { - "name": "Autocrafter", + "name": "Auto-crafter & auto-compressor", "description": "There are 2 different Autocrafters:\n\nV1 uses the Vanilla Crafting menu (Workbench). Place your recipe in the Workbench and save with SHIFT + ENTER. Then press ENTER to craft the recipe.\n\nV2 uses the /recipes menu. Place the item you want to craft in your first hotbar slot. Then type /autocraft in the chat. The /recipes menu will open automatically and craft your items.", "autoCraftSpeed": { "name": "[V1] Speed" @@ -137,6 +137,9 @@ "finalAction": { "name": "[V2] Final action", "description": "Specifies whether, when using Autocrafter V2 (/autocraft), the crafted items should be dropped or compressed in the inventory." + }, + "autoCompHotkey": { + "name": "Hotkey for auto-compressor" } } }, diff --git a/game-runner/src/v1_12_2/java/tmb/randy/tmbgriefergames/v1_12_2/util/AutoComp.java b/game-runner/src/v1_12_2/java/tmb/randy/tmbgriefergames/v1_12_2/util/AutoComp.java index 776abb1..f53a68a 100644 --- a/game-runner/src/v1_12_2/java/tmb/randy/tmbgriefergames/v1_12_2/util/AutoComp.java +++ b/game-runner/src/v1_12_2/java/tmb/randy/tmbgriefergames/v1_12_2/util/AutoComp.java @@ -54,7 +54,7 @@ public void onKeyEvent(KeyEvent event) { } } } else { - if ((event.key() == Key.ARROW_UP || event.key() == Key.ARROW_LEFT || event.key() == Key.ARROW_RIGHT) && Key.ARROW_UP.isPressed() && Key.ARROW_LEFT.isPressed() && Key.ARROW_RIGHT.isPressed() && !isGUIOpen()) { + if (Addon.areKeysPressed(Addon.getSharedInstance().configuration().getAutoCrafterConfig().getAutoCompHotkey().get())) { startComp(); } } diff --git a/game-runner/src/v1_8_9/java/tmb/randy/tmbgriefergames/v1_8_9/util/AutoComp.java b/game-runner/src/v1_8_9/java/tmb/randy/tmbgriefergames/v1_8_9/util/AutoComp.java index be35b08..2a89c0d 100644 --- a/game-runner/src/v1_8_9/java/tmb/randy/tmbgriefergames/v1_8_9/util/AutoComp.java +++ b/game-runner/src/v1_8_9/java/tmb/randy/tmbgriefergames/v1_8_9/util/AutoComp.java @@ -53,7 +53,7 @@ public void onKeyEvent(KeyEvent event) { } } } else { - if ((event.key() == Key.ARROW_UP || event.key() == Key.ARROW_LEFT || event.key() == Key.ARROW_RIGHT) && Key.ARROW_UP.isPressed() && Key.ARROW_LEFT.isPressed() && Key.ARROW_RIGHT.isPressed() && !isGUIOpen()) { + if (Addon.areKeysPressed(Addon.getSharedInstance().configuration().getAutoCrafterConfig().getAutoCompHotkey().get())) { startComp(); } } diff --git a/game-runner/src/v1_8_9/java/tmb/randy/tmbgriefergames/v1_8_9/util/VersionisedBridge.java b/game-runner/src/v1_8_9/java/tmb/randy/tmbgriefergames/v1_8_9/util/VersionisedBridge.java index 0201ec7..62ba606 100644 --- a/game-runner/src/v1_8_9/java/tmb/randy/tmbgriefergames/v1_8_9/util/VersionisedBridge.java +++ b/game-runner/src/v1_8_9/java/tmb/randy/tmbgriefergames/v1_8_9/util/VersionisedBridge.java @@ -228,5 +228,4 @@ public boolean isCompActive() { return autoComp.isCompActive(); } - }