Skip to content

Commit

Permalink
fix: Stop socket selection menu from closing immediately if bound to …
Browse files Browse the repository at this point in the history
…mouse button

Fixes #759
  • Loading branch information
Kamefrede committed Nov 7, 2023
1 parent 33fa090 commit 7681ac0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/vazkii/psi/client/gui/GuiSocketSelect.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
import com.google.common.collect.ImmutableSet;
import com.mojang.blaze3d.platform.InputConstants;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.Tesselator;
import com.mojang.blaze3d.vertex.VertexFormat;

import net.minecraft.ChatFormatting;
import net.minecraft.client.KeyMapping;
Expand All @@ -24,6 +28,7 @@
import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack;

import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL11;

import vazkii.psi.api.PsiAPI;
Expand All @@ -37,7 +42,6 @@
import vazkii.psi.common.network.message.MessageChangeControllerSlot;
import vazkii.psi.common.network.message.MessageChangeSocketableSlot;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -317,7 +321,7 @@ public void tick() {
public boolean isKeyDown(KeyMapping keybind) {
InputConstants.Key key = keybind.getKey();
if(key.getType() == InputConstants.Type.MOUSE) {
return keybind.isDown();
return GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), key.getValue()) == 1;
}
return InputConstants.isKeyDown(Minecraft.getInstance().getWindow().getWindow(), key.getValue());
}
Expand Down

0 comments on commit 7681ac0

Please sign in to comment.