Search in sources :

Example 1 with Widget

use of buildcraft.core.lib.gui.widgets.Widget in project BuildCraft by BuildCraft.

the class GuiBuildCraft method mouseClicked.

// / MOUSE CLICKS
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
    int mX = mouseX - guiLeft;
    int mY = mouseY - guiTop;
    for (Widget widget : container.getWidgets()) {
        if (widget.hidden) {
            continue;
        } else if (!widget.isMouseOver(mX, mY)) {
            continue;
        } else if (widget.handleMouseClick(mX, mY, mouseButton)) {
            return;
        }
    }
    super.mouseClicked(mouseX, mouseY, mouseButton);
    // / Handle ledger clicks
    ledgerManager.handleMouseClicked(mouseX, mouseY, mouseButton);
}
Also used : Widget(buildcraft.core.lib.gui.widgets.Widget)

Example 2 with Widget

use of buildcraft.core.lib.gui.widgets.Widget in project BuildCraft by BuildCraft.

the class GuiBuildCraft method mouseReleased.

@Override
protected void mouseReleased(int mouseX, int mouseY, int eventType) {
    super.mouseReleased(mouseX, mouseY, eventType);
    int mX = mouseX - guiLeft;
    int mY = mouseY - guiTop;
    for (Widget widget : container.getWidgets()) {
        if (widget.hidden) {
            continue;
        }
        widget.handleMouseRelease(mX, mY, eventType);
    }
}
Also used : Widget(buildcraft.core.lib.gui.widgets.Widget)

Example 3 with Widget

use of buildcraft.core.lib.gui.widgets.Widget in project BuildCraft by BuildCraft.

the class GuiBuildCraft method mouseClickMove.

@Override
protected void mouseClickMove(int mouseX, int mouseY, int mouseButton, long time) {
    int mX = mouseX - guiLeft;
    int mY = mouseY - guiTop;
    for (Widget widget : container.getWidgets()) {
        if (widget.hidden) {
            continue;
        }
        widget.handleMouseMove(mX, mY, mouseButton, time);
    }
    Slot slot = getSlotAtPosition(mouseX, mouseY);
    if (mouseButton == 1 && slot instanceof IPhantomSlot) {
        return;
    }
    super.mouseClickMove(mouseX, mouseY, mouseButton, time);
}
Also used : Widget(buildcraft.core.lib.gui.widgets.Widget) IPhantomSlot(buildcraft.lib.gui.slot.IPhantomSlot) Slot(net.minecraft.inventory.Slot) IPhantomSlot(buildcraft.lib.gui.slot.IPhantomSlot)

Aggregations

Widget (buildcraft.core.lib.gui.widgets.Widget)3 IPhantomSlot (buildcraft.lib.gui.slot.IPhantomSlot)1 Slot (net.minecraft.inventory.Slot)1