Search in sources :

Example 1 with SelectItemOutOfList

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

the class ClientProxy method openFluidSelectGui.

@Override
public void openFluidSelectGui(final int slotId) {
    if (Minecraft.getMinecraft().currentScreen instanceof LogisticsBaseGuiScreen) {
        final List<ItemIdentifierStack> list = new ArrayList<>();
        for (FluidIdentifier fluid : FluidIdentifier.all()) {
            if (fluid == null) {
                continue;
            }
            list.add(fluid.getItemIdentifier().makeStack(1));
        }
        SelectItemOutOfList subGui = new SelectItemOutOfList(list, slot -> MainProxy.sendPacketToServer(PacketHandler.getPacket(DummyContainerSlotClick.class).setSlotId(slotId).setStack(list.get(slot).makeNormalStack()).setButton(0)));
        LogisticsBaseGuiScreen gui = (LogisticsBaseGuiScreen) Minecraft.getMinecraft().currentScreen;
        if (!gui.hasSubGui()) {
            gui.setSubGui(subGui);
        } else {
            SubGuiScreen nextGui = gui.getSubGui();
            while (nextGui.hasSubGui()) {
                nextGui = nextGui.getSubGui();
            }
            nextGui.setSubGui(subGui);
        }
    } else {
        throw new UnsupportedOperationException(String.valueOf(Minecraft.getMinecraft().currentScreen));
    }
}
Also used : LogisticsBaseGuiScreen(logisticspipes.utils.gui.LogisticsBaseGuiScreen) SelectItemOutOfList(logisticspipes.gui.popup.SelectItemOutOfList) ArrayList(java.util.ArrayList) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) FluidIdentifier(logisticspipes.utils.FluidIdentifier) DummyContainerSlotClick(logisticspipes.network.packets.gui.DummyContainerSlotClick) SubGuiScreen(logisticspipes.utils.gui.SubGuiScreen)

Aggregations

ArrayList (java.util.ArrayList)1 SelectItemOutOfList (logisticspipes.gui.popup.SelectItemOutOfList)1 DummyContainerSlotClick (logisticspipes.network.packets.gui.DummyContainerSlotClick)1 FluidIdentifier (logisticspipes.utils.FluidIdentifier)1 LogisticsBaseGuiScreen (logisticspipes.utils.gui.LogisticsBaseGuiScreen)1 SubGuiScreen (logisticspipes.utils.gui.SubGuiScreen)1 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)1