Fix slot click issue with Phantom Slots
This commit is contained in:
parent
ce2efe13bb
commit
8166cb0bd8
1 changed files with 19 additions and 0 deletions
|
@ -2,7 +2,9 @@ package buildcraft.core.gui;
|
|||
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.gui.buttons.GuiBetterButton;
|
||||
import buildcraft.core.gui.slots.IPhantomSlot;
|
||||
import buildcraft.core.gui.slots.SlotBase;
|
||||
import buildcraft.core.gui.slots.SlotPhantom;
|
||||
import buildcraft.core.gui.tooltips.ToolTip;
|
||||
import buildcraft.core.gui.tooltips.ToolTipLine;
|
||||
import buildcraft.core.utils.SessionVars;
|
||||
|
@ -335,6 +337,23 @@ public abstract class GuiBuildCraft extends GuiContainer {
|
|||
ledgerManager.handleMouseClicked(par1, par2, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(int x, int y, int mouseButton, long time) {
|
||||
Slot slot = getSlotAtPosition(x, y);
|
||||
if (mouseButton == 1 && slot instanceof IPhantomSlot)
|
||||
return;
|
||||
super.mouseClickMove(x, y, mouseButton, time);
|
||||
}
|
||||
|
||||
public Slot getSlotAtPosition(int x, int y) {
|
||||
for (int slotIndex = 0; slotIndex < this.inventorySlots.inventorySlots.size(); ++slotIndex) {
|
||||
Slot slot = (Slot) this.inventorySlots.inventorySlots.get(slotIndex);
|
||||
if (isMouseOverSlot(slot, x, y))
|
||||
return slot;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void drawToolTips(ToolTip toolTips, int mouseX, int mouseY) {
|
||||
if (toolTips.size() > 0) {
|
||||
int left = this.guiLeft;
|
||||
|
|
Loading…
Add table
Reference in a new issue