use of logisticspipes.gui.popup.RequestMonitorPopup 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();
}
}
}
Aggregations