Search in sources :

Example 1 with GuiDiskPopup

use of logisticspipes.gui.popup.GuiDiskPopup in project LogisticsPipes by RS485.

the class GuiRequestTable method actionPerformed.

@Override
protected void actionPerformed(GuiButton guibutton) {
    if (guibutton.id == 0 && itemDisplay.getSelectedItem() != null) {
        MainProxy.sendPacketToServer(PacketHandler.getPacket(RequestSubmitPacket.class).setDimension(dimension).setStack(itemDisplay.getSelectedItem().getItem().makeStack(itemDisplay.getRequestCount())).setTilePos(_table.container));
        refreshItems();
    } else if (guibutton.id == 1) {
        itemDisplay.nextPage();
    } else if (guibutton.id == 2) {
        itemDisplay.prevPage();
    } else if (guibutton.id == 3) {
        refreshItems();
    } else if (guibutton.id == 10) {
        itemDisplay.sub(3);
    } else if (guibutton.id == 4) {
        itemDisplay.sub(2);
    } else if (guibutton.id == 5) {
        itemDisplay.sub(1);
    } else if (guibutton.id == 6) {
        itemDisplay.add(1);
    } else if (guibutton.id == 7) {
        itemDisplay.add(2);
    } else if (guibutton.id == 11) {
        itemDisplay.add(3);
    } else if (guibutton.id == 8) {
        GuiCheckBox button = (GuiCheckBox) guibutton;
        Configs.DISPLAY_POPUP = button.change();
        Configs.savePopupState();
    } else if (guibutton.id == 13 && itemDisplay.getSelectedItem() != null) {
        MainProxy.sendPacketToServer(PacketHandler.getPacket(RequestComponentPacket.class).setDimension(dimension).setStack(itemDisplay.getSelectedItem().getItem().makeStack(itemDisplay.getRequestCount())).setTilePos(_table.container));
    } else if (guibutton.id == 9) {
        String displayString = "";
        switch(displayOptions) {
            case Both:
                displayOptions = DisplayOptions.CraftOnly;
                displayString = "Craft";
                break;
            case CraftOnly:
                displayOptions = DisplayOptions.SupplyOnly;
                displayString = "Supply";
                break;
            case SupplyOnly:
                displayOptions = DisplayOptions.Both;
                displayString = "Both";
                break;
        }
        guibutton.displayString = displayString;
        refreshItems();
    } else if (guibutton.id == 14) {
        requestMatrix(1);
    } else if (guibutton.id == 15) {
        requestMatrix(10);
    } else if (guibutton.id == 16) {
        requestMatrix(64);
    } else if (guibutton.id == 17) {
        //hideShowButton
        // moveWhileSmall
        showRequest = !showRequest;
        if (showRequest) {
            xSize = startXSize;
            guiLeft = startLeft;
            for (GuiButton button : moveWhileSmall) {
                button.xPosition -= 105;
            }
            hideShowButton.xPosition -= 90;
        } else {
            xSize = startXSize - 210;
            guiLeft = startLeft + 105;
            for (GuiButton button : moveWhileSmall) {
                button.xPosition += 105;
            }
            hideShowButton.xPosition += 90;
        }
        hideShowButton.displayString = showRequest ? "Hide" : "Show";
        for (GuiButton button : hideWhileSmall) {
            button.visible = showRequest;
        }
        Macrobutton.visible = showRequest;
        orderIdForButton = -1;
    } else if (guibutton.id == 100) {
        extentionControllerLeft.retract();
        setSubGui(new RequestMonitorPopup(_table, orderIdForButton));
    } else if (guibutton.id == 18) {
        MainProxy.sendPacketToServer(PacketHandler.getPacket(DiskRequestConectPacket.class).setPosX(_table.getX()).setPosY(_table.getY()).setPosZ(_table.getZ()));
        setSubGui(new GuiDiskPopup(this));
    } else if (guibutton.id == 20) {
        itemDisplay.cycle();
    } else if (guibutton.id == 21 || guibutton.id == 22) {
        MainProxy.sendPacketToServer(PacketHandler.getPacket(CraftingCycleRecipe.class).setDown(guibutton.id == 22).setTilePos(_table.container));
    } else if (guibutton.id == 30) {
        MainProxy.sendPacketToServer(PacketHandler.getPacket(ClearCraftingGridPacket.class).setTilePos(_table.container));
        _table.cacheRecipe();
    } else if (guibutton.id == 31) {
        ArrayList<ItemIdentifierStack> list = new ArrayList<>(9);
        list.addAll(_table.matrix.getItemsAndCount().entrySet().stream().map(e -> e.getKey().makeStack(e.getValue())).collect(Collectors.toList()));
        for (Pair<ItemStack, Integer> entry : _table.inv) {
            if (entry.getValue1() == null)
                continue;
            int size = entry.getValue1().stackSize;
            ItemIdentifier ident = ItemIdentifier.get(entry.getValue1());
            for (ItemIdentifierStack stack : list) {
                if (!stack.getItem().equals(ident))
                    continue;
                int toUse = Math.min(size, stack.getStackSize());
                stack.lowerStackSize(toUse);
                size -= toUse;
            }
        }
        Iterator<ItemIdentifierStack> iter = list.iterator();
        while (iter.hasNext()) {
            if (iter.next().getStackSize() <= 0) {
                iter.remove();
            }
        }
        if (!list.isEmpty()) {
            MainProxy.sendPacketToServer(PacketHandler.getPacket(RequestSubmitListPacket.class).setIdentList(list).setTilePos(_table.container));
            refreshItems();
        }
    }
}
Also used : GuiDiskPopup(logisticspipes.gui.popup.GuiDiskPopup) ChainAddArrayList(logisticspipes.utils.ChainAddArrayList) ArrayList(java.util.ArrayList) CraftingCycleRecipe(logisticspipes.network.packets.block.CraftingCycleRecipe) ClearCraftingGridPacket(logisticspipes.network.packets.block.ClearCraftingGridPacket) RequestMonitorPopup(logisticspipes.gui.popup.RequestMonitorPopup) ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) RequestSubmitListPacket(logisticspipes.network.packets.orderer.RequestSubmitListPacket) SmallGuiButton(logisticspipes.utils.gui.SmallGuiButton) GuiButton(net.minecraft.client.gui.GuiButton) RequestComponentPacket(logisticspipes.network.packets.orderer.RequestComponentPacket) GuiCheckBox(logisticspipes.utils.gui.GuiCheckBox) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) ItemStack(net.minecraft.item.ItemStack)

Example 2 with GuiDiskPopup

use of logisticspipes.gui.popup.GuiDiskPopup in project LogisticsPipes by RS485.

the class NormalMk2GuiOrderer method actionPerformed.

@Override
protected void actionPerformed(GuiButton guibutton) {
    super.actionPerformed(guibutton);
    if (guibutton.id == 12) {
        MainProxy.sendPacketToServer(PacketHandler.getPacket(DiskRequestConectPacket.class).setPosX(pipe.getX()).setPosY(pipe.getY()).setPosZ(pipe.getZ()));
        setSubGui(new GuiDiskPopup(this));
    }
}
Also used : GuiDiskPopup(logisticspipes.gui.popup.GuiDiskPopup)

Aggregations

GuiDiskPopup (logisticspipes.gui.popup.GuiDiskPopup)2 ArrayList (java.util.ArrayList)1 RequestMonitorPopup (logisticspipes.gui.popup.RequestMonitorPopup)1 ClearCraftingGridPacket (logisticspipes.network.packets.block.ClearCraftingGridPacket)1 CraftingCycleRecipe (logisticspipes.network.packets.block.CraftingCycleRecipe)1 RequestComponentPacket (logisticspipes.network.packets.orderer.RequestComponentPacket)1 RequestSubmitListPacket (logisticspipes.network.packets.orderer.RequestSubmitListPacket)1 ChainAddArrayList (logisticspipes.utils.ChainAddArrayList)1 GuiCheckBox (logisticspipes.utils.gui.GuiCheckBox)1 SmallGuiButton (logisticspipes.utils.gui.SmallGuiButton)1 ItemIdentifier (logisticspipes.utils.item.ItemIdentifier)1 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)1 GuiButton (net.minecraft.client.gui.GuiButton)1 ItemStack (net.minecraft.item.ItemStack)1