Java Code Examples for codechicken.nei.api.INEIGuiHandler#hideItemPanelSlot()

The following examples show how to use codechicken.nei.api.INEIGuiHandler#hideItemPanelSlot() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemPanel.java    From NotEnoughItems with MIT License 5 votes vote down vote up
private boolean slotValid(GuiContainer gui, int i) {
    Rectangle4i rect = getSlotRect(i);
    for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
        if (handler.hideItemPanelSlot(gui, rect.x, rect.y, rect.w, rect.h)) {
            return false;
        }
    }
    return true;
}
 
Example 2
Source File: ItemPanel.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public boolean contains(int px, int py) {
    GuiContainer gui = NEIClientUtils.getGuiContainer();
    Rectangle4i rect = new Rectangle4i(px, py, 1, 1);
    for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
        if (handler.hideItemPanelSlot(gui, rect.x, rect.y, rect.w, rect.h)) {
            return false;
        }
    }

    return super.contains(px, py);
}
 
Example 3
Source File: ItemPanel.java    From NotEnoughItems with MIT License 5 votes vote down vote up
private boolean slotValid(GuiContainer gui, int i) {
    Rectangle4i rect = getSlotRect(i);
    for (INEIGuiHandler handler : GuiInfo.guiHandlers)
        if (handler.hideItemPanelSlot(gui, rect.x, rect.y, rect.w, rect.h))
            return false;
    return true;
}
 
Example 4
Source File: ItemPanel.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public boolean handleClick(int mousex, int mousey, int button) {
    if (handleDraggedClick(mousex, mousey, button))
        return true;

    if (NEIClientUtils.getHeldItem() != null) {
        for (INEIGuiHandler handler : GuiInfo.guiHandlers)
            if (handler.hideItemPanelSlot(NEIClientUtils.getGuiContainer(), mousex, mousey, 1, 1))
                return false;

        if (NEIClientConfig.canPerformAction("delete") && NEIClientConfig.canPerformAction("item"))
            if (button == 1)
                NEIClientUtils.decreaseSlotStack(-999);
            else
                NEIClientUtils.deleteHeldItem();
        else
            NEIClientUtils.dropHeldItem();

        return true;
    }

    ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
    if (hoverSlot != null) {
        if (button == 2) {
            ItemStack stack = hoverSlot.item;
            if (stack != null) {
                int amount = NEIClientConfig.getItemQuantity();
                if (amount == 0)
                    amount = stack.getMaxStackSize();

                draggedStack = NEIServerUtils.copyStack(stack, amount);
            }
        } else {
            mouseDownSlot = hoverSlot.slotIndex;
        }
        return true;
    }
    return false;
}
 
Example 5
Source File: ItemPanel.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public boolean contains(int px, int py) {
    GuiContainer gui = NEIClientUtils.getGuiContainer();
    Rectangle4i rect = new Rectangle4i(px, py, 1, 1);
    for (INEIGuiHandler handler : GuiInfo.guiHandlers)
        if (handler.hideItemPanelSlot(gui, rect.x, rect.y, rect.w, rect.h))
            return false;

    return super.contains(px, py);
}
 
Example 6
Source File: ItemPanel.java    From NotEnoughItems with MIT License 4 votes vote down vote up
@Override
public boolean handleClick(int mousex, int mousey, int button) {
    if (handleDraggedClick(mousex, mousey, button)) {
        return true;
    }

    if (!NEIClientUtils.getHeldItem().isEmpty()) {
        for (INEIGuiHandler handler : GuiInfo.guiHandlers) {
            if (handler.hideItemPanelSlot(NEIClientUtils.getGuiContainer(), mousex, mousey, 1, 1)) {
                return false;
            }
        }

        if (NEIClientConfig.canPerformAction("delete") && NEIClientConfig.canPerformAction("item")) {
            if (button == 1) {
                NEIClientUtils.decreaseSlotStack(-999);
            } else {
                NEIClientUtils.deleteHeldItem();
            }
        } else {
            NEIClientUtils.dropHeldItem();
        }

        return true;
    }

    ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey);
    if (hoverSlot != null) {
        if (button == 2) {
            ItemStack stack = hoverSlot.item;
            if (!stack.isEmpty()) {
                int amount = NEIClientConfig.getItemQuantity();
                if (amount == 0) {
                    amount = stack.getMaxStackSize();
                }

                draggedStack = NEIServerUtils.copyStack(stack, amount);
            }
        } else {
            mouseDownSlot = hoverSlot.slotIndex;
        }
        return true;
    }
    return false;
}