From 09311aa0296aea7b7d9edab14a25f05a50f6f95e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 25 Sep 2026 17:08:55 +0000 Subject: [PATCH] Fix script text area mouse clicks on 26.3 Minecraft 26.3 uses SDL mouse button ids (left 1, middle 2, right 3) instead of GLFW's (left 0, right 1, middle 2). A left click matched the old right-click check and selected all text, and cursor placement and drag selection never ran. Related to CyclopsMC/IntegratedDynamics#1750 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016VFfUPDxbJ8RqPeQHsAbh7 --- .../client/gui/component/input/WidgetTextArea.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/cyclops/integratedscripting/client/gui/component/input/WidgetTextArea.java b/src/main/java/org/cyclops/integratedscripting/client/gui/component/input/WidgetTextArea.java index 4f8e3426..abd7e12a 100644 --- a/src/main/java/org/cyclops/integratedscripting/client/gui/component/input/WidgetTextArea.java +++ b/src/main/java/org/cyclops/integratedscripting/client/gui/component/input/WidgetTextArea.java @@ -1,6 +1,7 @@ package org.cyclops.integratedscripting.client.gui.component.input; import com.google.common.collect.Lists; +import com.mojang.blaze3d.platform.InputConstants; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import net.minecraft.util.Util; @@ -222,14 +223,14 @@ public void tick() { @Override public boolean mouseClicked(MouseButtonEvent mouse, boolean isDoubleClick) { - if (mouse.button() == 1 && mouse.x() >= this.getX() && mouse.x() < this.getX() + this.width + if (mouse.button() == InputConstants.MOUSE_BUTTON_RIGHT && mouse.x() >= this.getX() && mouse.x() < this.getX() + this.width && mouse.y() >= this.getY() && mouse.y() < this.getY() + this.height) { // Select everything this.setFocused(true); textFieldHelper.selectAll(); return true; } else { - if (mouse.button() == 0 && mouse.x() >= this.getX() && mouse.x() < this.getX() + this.width + if (mouse.button() == InputConstants.MOUSE_BUTTON_LEFT && mouse.x() >= this.getX() && mouse.x() < this.getX() + this.width && mouse.y() >= this.getY() && mouse.y() < this.getY() + this.height) { this.setFocused(true); long i = Util.getMillis(); @@ -285,7 +286,7 @@ public boolean mouseDragged(MouseButtonEvent mouse, double offsetX, double offse return this.scrollBar.mouseDragged(mouse, offsetX, offsetY); } - if (mouse.button() == 0 && mouse.x() >= this.getX() && mouse.x() < this.getX() + this.width + if (mouse.button() == InputConstants.MOUSE_BUTTON_LEFT && mouse.x() >= this.getX() && mouse.x() < this.getX() + this.width && mouse.y() >= this.getY() && mouse.y() < this.getY() + this.height) { DisplayCache bookeditscreen$displaycache = this.getDisplayCache(); int i = bookeditscreen$displaycache.getIndexAtPosition(this.font, this.convertScreenToLocal(new Pos2i((int)mouse.x(), (int)mouse.y())));