Fixed the mouse button problems with the linked controller. (#3069)

* Fixed the mouse button problems with the linked controller. (Closes #2807)

* Now with added elegance

* I'm here I might as well tie up some loose ends

* Compacting out some spaces

* This was probably the way it was for a good reason
This commit is contained in:
Violet-Scarelli 2022-05-27 16:14:45 -07:00 committed by GitHub
parent 329be0d948
commit 799ebb9fa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -63,6 +63,12 @@ public enum AllKeys {
.getWindow(), key) != 0;
}
public static boolean isMouseButtonDown(int button){
return GLFW.glfwGetMouseButton(Minecraft.getInstance()
.getWindow()
.getWindow(), button) != 0;
}
public static boolean ctrlDown() {
return Screen.hasControlDown();
}

View file

@ -6,6 +6,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Vector;
import com.simibubi.create.AllKeys;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.InputConstants;
@ -116,11 +118,10 @@ public class LinkedControllerClientHandler {
}
protected static boolean isActuallyPressed(KeyMapping kb) {
return InputConstants.isKeyDown(Minecraft.getInstance()
.getWindow()
.getWindow(),
kb.getKey()
.getValue());
if(kb.matchesMouse(kb.getKey().getValue()))
return AllKeys.isMouseButtonDown(kb.getKey().getValue());
else
return AllKeys.isKeyDown(kb.getKey().getValue());
}
public static void tick() {