mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
fix keyBindPickBlock in terminals (#1088)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
1 parent
675333e384
commit
3b5c878812
3 files changed
+23
-3
No files matched your search
@@ -10,6 +10,7 @@
|
||||
|
||||
package appeng.client.gui;
|
||||
|
||||
import static appeng.client.gui.implementations.GuiMEMonitorable.keyBindPickBlockAction;
|
||||
import static appeng.server.ServerHelper.CONTAINER_INTERACTION_KEY;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
@@ -397,7 +398,10 @@ public abstract class AEBaseGui extends GuiContainer implements IGuiTooltipHandl
|
||||
}
|
||||
|
||||
final VirtualMESlot virtualSlot = getVirtualMESlotUnderMouse();
|
||||
if (virtualSlot != null && this.handleVirtualSlotClick(virtualSlot, btn)) return;
|
||||
if (virtualSlot != null && this.handleVirtualSlotClick(
|
||||
virtualSlot,
|
||||
btn == this.mc.gameSettings.keyBindPickBlock.getKeyCode() + 100 ? keyBindPickBlockAction : btn))
|
||||
return;
|
||||
|
||||
if (btn == 1) {
|
||||
for (final GuiButton guibutton : this.buttonList) {
|
||||
@@ -415,6 +419,16 @@ public abstract class AEBaseGui extends GuiContainer implements IGuiTooltipHandl
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if (keyCode == this.mc.gameSettings.keyBindPickBlock.getKeyCode()) {
|
||||
final VirtualMESlot virtualSlot = getVirtualMESlotUnderMouse();
|
||||
if (virtualSlot != null && this.handleVirtualSlotClick(virtualSlot, keyBindPickBlockAction)) return;
|
||||
}
|
||||
|
||||
super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
|
||||
this.drag_click.clear();
|
||||
|
||||
@@ -106,6 +106,10 @@ public class GuiMEMonitorable extends AEBaseGui
|
||||
public static int craftingGridOffsetX;
|
||||
public static int craftingGridOffsetY;
|
||||
|
||||
// Keybind use can be keyboard or mouse, both redirect to this.handleVirtualSlotClick
|
||||
// if key/mouseButton == this.mc.gameSettings.keyBindPickBlock.getKeyCode()
|
||||
public static final int keyBindPickBlockAction = 1_000_101;
|
||||
|
||||
private static String memoryText = "";
|
||||
private final IDisplayRepo repo;
|
||||
protected int offsetRepoX = 9;
|
||||
@@ -695,7 +699,7 @@ public class GuiMEMonitorable extends AEBaseGui
|
||||
this.sendAction(MonitorableAction.SPLIT_OR_PLACE_SINGLE, slotStack, -1);
|
||||
return true;
|
||||
}
|
||||
case 2 -> { // middle click
|
||||
case keyBindPickBlockAction -> {
|
||||
if (slot.getAEStack() != null && slot.getAEStack().isCraftable()) {
|
||||
this.sendAction(MonitorableAction.AUTO_CRAFT, slot.getAEStack(), -1);
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package appeng.client.gui.slots;
|
||||
|
||||
import static appeng.client.gui.implementations.GuiMEMonitorable.keyBindPickBlockAction;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -19,7 +21,7 @@ public class VirtualMEPatternSlot extends VirtualMEPhantomSlot {
|
||||
|
||||
@Override
|
||||
public void handleMouseClicked(@Nullable ItemStack itemStack, boolean isExtraAction, int mouseButton) {
|
||||
if (mouseButton == 2) { // middle click
|
||||
if (mouseButton == keyBindPickBlockAction) {
|
||||
if (this.getAEStack() != null) {
|
||||
if (isExtraAction) {
|
||||
NetworkHandler.instance.sendToServer(new PacketSwitchGuis(GuiBridge.GUI_PATTERN_ITEM_RENAMER));
|
||||
|
||||
Reference in new issue
Block a user