From e6644016a93c9a5ed9eed5dc1790eb3fb6beaad3 Mon Sep 17 00:00:00 2001 From: LAX1DUDE Date: Sun, 17 Jul 2022 20:48:12 -0700 Subject: [PATCH] fixed hotkey activation while typing into text fields --- src/main/java/net/minecraft/client/Minecraft.java | 6 +++++- src/main/java/net/minecraft/src/GuiChat.java | 4 ++++ src/main/java/net/minecraft/src/GuiCommandBlock.java | 4 ++++ src/main/java/net/minecraft/src/GuiContainerCreative.java | 4 ++++ src/main/java/net/minecraft/src/GuiEditSign.java | 4 ++++ src/main/java/net/minecraft/src/GuiRepair.java | 4 ++++ src/main/java/net/minecraft/src/GuiScreen.java | 4 ++++ src/main/java/net/minecraft/src/GuiScreenBook.java | 4 ++++ .../lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java | 8 ++++---- 9 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/minecraft/client/Minecraft.java b/src/main/java/net/minecraft/client/Minecraft.java index 39df4ae..14eba71 100644 --- a/src/main/java/net/minecraft/client/Minecraft.java +++ b/src/main/java/net/minecraft/client/Minecraft.java @@ -1117,8 +1117,12 @@ public class Minecraft implements Runnable { GuiMultiplayer.tickRefreshCooldown(); EaglerAdapter.tickVoice(); - EaglerAdapter.activateVoice(EaglerAdapter.isKeyDown(gameSettings.voicePTTKey)); if (EaglerAdapter.getVoiceStatus() == Voice.VoiceStatus.CONNECTING || EaglerAdapter.getVoiceStatus() == Voice.VoiceStatus.CONNECTED) { + + if(this.currentScreen == null || !this.currentScreen.blockHotKeys()) { + EaglerAdapter.activateVoice(EaglerAdapter.isKeyDown(gameSettings.voicePTTKey)); + } + if (EaglerAdapter.getVoiceChannel() == Voice.VoiceChannel.PROXIMITY) { if (this.theWorld != null && this.thePlayer != null) { for (Object playerObject : this.theWorld.playerEntities) { diff --git a/src/main/java/net/minecraft/src/GuiChat.java b/src/main/java/net/minecraft/src/GuiChat.java index 0e5ac60..c68be68 100644 --- a/src/main/java/net/minecraft/src/GuiChat.java +++ b/src/main/java/net/minecraft/src/GuiChat.java @@ -296,4 +296,8 @@ public class GuiChat extends GuiScreen { public boolean doesGuiPauseGame() { return false; } + + public boolean blockHotKeys() { + return true; + } } diff --git a/src/main/java/net/minecraft/src/GuiCommandBlock.java b/src/main/java/net/minecraft/src/GuiCommandBlock.java index b723d3c..edc752a 100644 --- a/src/main/java/net/minecraft/src/GuiCommandBlock.java +++ b/src/main/java/net/minecraft/src/GuiCommandBlock.java @@ -115,4 +115,8 @@ public class GuiCommandBlock extends GuiScreen { this.commandTextField.drawTextBox(); super.drawScreen(par1, par2, par3); } + + public boolean blockHotKeys() { + return commandTextField.isFocused(); + } } diff --git a/src/main/java/net/minecraft/src/GuiContainerCreative.java b/src/main/java/net/minecraft/src/GuiContainerCreative.java index bbf4f14..4611c0d 100644 --- a/src/main/java/net/minecraft/src/GuiContainerCreative.java +++ b/src/main/java/net/minecraft/src/GuiContainerCreative.java @@ -687,4 +687,8 @@ public class GuiContainerCreative extends InventoryEffectRenderer { static InventoryBasic getInventory() { return inventory; } + + public boolean blockHotKeys() { + return this.searchField.isFocused(); + } } diff --git a/src/main/java/net/minecraft/src/GuiEditSign.java b/src/main/java/net/minecraft/src/GuiEditSign.java index ef46275..164a3bb 100644 --- a/src/main/java/net/minecraft/src/GuiEditSign.java +++ b/src/main/java/net/minecraft/src/GuiEditSign.java @@ -144,4 +144,8 @@ public class GuiEditSign extends GuiScreen { EaglerAdapter.glPopMatrix(); super.drawScreen(par1, par2, par3); } + + public boolean blockHotKeys() { + return true; + } } diff --git a/src/main/java/net/minecraft/src/GuiRepair.java b/src/main/java/net/minecraft/src/GuiRepair.java index 934f3f3..15f759b 100644 --- a/src/main/java/net/minecraft/src/GuiRepair.java +++ b/src/main/java/net/minecraft/src/GuiRepair.java @@ -162,4 +162,8 @@ public class GuiRepair extends GuiContainer implements ICrafting { */ public void sendProgressBarUpdate(Container par1Container, int par2, int par3) { } + + public boolean blockHotKeys() { + return itemNameField.isFocused(); + } } diff --git a/src/main/java/net/minecraft/src/GuiScreen.java b/src/main/java/net/minecraft/src/GuiScreen.java index 4c07e56..1b3241e 100644 --- a/src/main/java/net/minecraft/src/GuiScreen.java +++ b/src/main/java/net/minecraft/src/GuiScreen.java @@ -264,4 +264,8 @@ public class GuiScreen extends Gui { public static boolean isShiftKeyDown() { return EaglerAdapter.isKeyDown(42) || EaglerAdapter.isKeyDown(54); } + + public boolean blockHotKeys() { + return false; + } } diff --git a/src/main/java/net/minecraft/src/GuiScreenBook.java b/src/main/java/net/minecraft/src/GuiScreenBook.java index b2e44d2..d6576b4 100644 --- a/src/main/java/net/minecraft/src/GuiScreenBook.java +++ b/src/main/java/net/minecraft/src/GuiScreenBook.java @@ -360,4 +360,8 @@ public class GuiScreenBook extends GuiScreen { super.drawScreen(par1, par2, par3); } + + public boolean blockHotKeys() { + return this.bookIsUnsigned; + } } diff --git a/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java b/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java index 641c604..839a2ff 100644 --- a/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java +++ b/src/teavm/java/net/lax1dude/eaglercraft/adapter/EaglerAdapterImpl2.java @@ -2278,10 +2278,10 @@ public class EaglerAdapterImpl2 { public static final void setVoiceListenVolume(float f) { for (GainNode gain : voiceGains.values()) { float val = f; - if(val > 0.5) val = 0.5f + (val - 0.5f) * 2.0f; - if(val > 1.5) val = 1.5f; - if(val < 0.0) val = 0.0f; - gain.getGain().setValue(val * 3.0f); + if(val > 0.5f) val = 0.5f + (val - 0.5f) * 3.0f; + if(val > 2.0f) val = 2.0f; + if(val < 0.0f) val = 0.0f; + gain.getGain().setValue(val * 2.0f); } volumeListen = f; }