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));
}
}
Aggregations