mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 04:35:03 +00:00
Disabled script area textbox typing when a matching keycode KeyPreset is down
This commit is contained in:
1 parent
c4d5178472
commit
85d79dd786
2 files changed
+16
-3
No files matched your search
@@ -4,7 +4,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.util.ChatAllowedCharacters;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.gui.script.GuiScriptInterface;
|
||||
@@ -1108,8 +1107,8 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
*/
|
||||
private void updateHoverState(int xMouse, int yMouse) {
|
||||
// Don't show tooltips when not active, clicking, or when overlays are visible
|
||||
if (!isEnabled() || clicked || searchBar.isVisible() ||
|
||||
goToLineDialog.isVisible() || KEYS_OVERLAY.isVisible() || renameHandler.isActive()) {
|
||||
if (!isEnabled() || clicked || searchBar.isVisible() ||
|
||||
goToLineDialog.isVisible() || KEYS_OVERLAY.isVisible() || renameHandler.isActive() || autocompleteManager.isVisible()) {
|
||||
hoverState.clearHover();
|
||||
return;
|
||||
}
|
||||
@@ -1434,6 +1433,11 @@ public class GuiScriptTextArea extends GuiNpcTextField {
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore if any global keys bound to this code are currently pressed
|
||||
if (KEYS.hasMatchingKeyPressed(i))
|
||||
return false;
|
||||
|
||||
|
||||
if (!active)
|
||||
return false;
|
||||
|
||||
|
||||
@@ -24,6 +24,15 @@ public class KeyPresetManager {
|
||||
return preset;
|
||||
}
|
||||
|
||||
public boolean hasMatchingKeyPressed(int keyCode) {
|
||||
for (KeyPreset key : keys) {
|
||||
if (key.currentState.matches(keyCode, true))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
for (KeyPreset key : keys)
|
||||
key.tick();
|
||||
|
||||
Reference in new issue
Block a user