Search in sources :

Example 26 with DummyContainer

use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.

the class ItemMangerGui method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    final CardManagmentInventory Cinv = new CardManagmentInventory();
    DummyContainer dummy = new DummyContainer(player, Cinv, new IGuiOpenControler() {

        @Override
        public void guiOpenedByPlayer(EntityPlayer player) {
        }

        @Override
        public void guiClosedByPlayer(EntityPlayer player) {
            Cinv.close(player, (int) player.posX, (int) player.posY, (int) player.posZ);
        }
    });
    for (int i = 0; i < 2; i++) {
        dummy.addRestrictedSlot(i, Cinv, 0, 0, ItemModule.class);
    }
    dummy.addRestrictedSlot(2, Cinv, 0, 0, itemStack -> false);
    dummy.addRestrictedSlot(3, Cinv, 0, 0, LPItems.itemCard);
    for (int i = 4; i < 10; i++) {
        dummy.addColorSlot(i, Cinv, 0, 0);
    }
    dummy.addNormalSlotsForPlayerInventory(0, 0);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) CardManagmentInventory(logisticspipes.utils.CardManagmentInventory) IGuiOpenControler(logisticspipes.interfaces.IGuiOpenControler) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 27 with DummyContainer

use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.

the class SecurityStationGui method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    LogisticsSecurityTileEntity securityStation = getTileAs(player.world, LogisticsSecurityTileEntity.class);
    DummyContainer dummy = new DummyContainer(player, null, securityStation);
    dummy.addRestrictedSlot(0, securityStation.inv, 50, 50, (Item) null);
    dummy.addNormalSlotsForPlayerInventory(10, 210);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) LogisticsSecurityTileEntity(logisticspipes.blocks.LogisticsSecurityTileEntity)

Example 28 with DummyContainer

use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.

the class StringBasedItemSinkModuleGuiSlot method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    IStringBasedModule module = this.getLogisticsModule(player.getEntityWorld(), IStringBasedModule.class);
    if (module == null) {
        return null;
    }
    DummyContainer dummy = new DummyContainer(player.inventory, new ItemIdentifierInventory(1, "TMP", 1));
    dummy.addDummySlot(0, 0, 0);
    dummy.addNormalSlotsForPlayerInventory(0, 0);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) IStringBasedModule(logisticspipes.interfaces.IStringBasedModule) ItemIdentifierInventory(logisticspipes.utils.item.ItemIdentifierInventory)

Example 29 with DummyContainer

use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.

the class InvSysConGuiProvider method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = getTileAs(player.world, LogisticsTileGenericPipe.class);
    if (!(pipe.pipe instanceof PipeItemsInvSysConnector)) {
        return null;
    }
    DummyContainer dummy = new DummyContainer(player, null, (PipeItemsInvSysConnector) pipe.pipe);
    dummy.addNormalSlotsForPlayerInventory(0, 50);
    return dummy;
}
Also used : PipeItemsInvSysConnector(logisticspipes.pipes.PipeItemsInvSysConnector) DummyContainer(logisticspipes.utils.gui.DummyContainer) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe)

Example 30 with DummyContainer

use of logisticspipes.utils.gui.DummyContainer in project LogisticsPipes by RS485.

the class GuiHandler method getServerGuiElement.

@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, final int x, final int y, final int z) {
    TileEntity tile = null;
    if (y != -1) {
        tile = world.getTileEntity(new BlockPos(x, y, z));
    }
    LogisticsTileGenericPipe pipe = null;
    if (tile instanceof LogisticsTileGenericPipe) {
        pipe = (LogisticsTileGenericPipe) tile;
    }
    final LogisticsTileGenericPipe fpipe = pipe;
    DummyContainer dummy;
    int xOffset;
    int yOffset;
    if (ID > 10000) {
        ID -= 10000;
    }
    // Handle Module Configuration
    if (ID == -1) {
        return getServerGuiElement(100 * -20 + x, player, world, 0, -1, z);
    }
    if (ID < 110 && ID > 0) {
        switch(ID) {
            case GuiIDs.GUI_FluidSupplier_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeItemsFluidSupplier)) {
                    return null;
                }
                dummy = new DummyContainer(player.inventory, ((PipeItemsFluidSupplier) pipe.pipe).getDummyInventory());
                dummy.addNormalSlotsForPlayerInventory(18, 97);
                xOffset = 72;
                yOffset = 18;
                for (int row = 0; row < 3; row++) {
                    for (int column = 0; column < 3; column++) {
                        dummy.addDummySlot(column + row * 3, xOffset + column * 18, yOffset + row * 18);
                    }
                }
                MainProxy.sendPacketToPlayer(PacketHandler.getPacket(FluidSupplierMode.class).setInteger((((PipeItemsFluidSupplier) pipe.pipe).isRequestingPartials() ? 1 : 0)).setBlockPos(pipe.getPos()), player);
                return dummy;
            case GuiIDs.GUI_FluidSupplier_MK2_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeFluidSupplierMk2)) {
                    return null;
                }
                dummy = new DummyContainer(player.inventory, ((PipeFluidSupplierMk2) pipe.pipe).getDummyInventory());
                dummy.addNormalSlotsForPlayerInventory(18, 97);
                dummy.addFluidSlot(0, ((PipeFluidSupplierMk2) pipe.pipe).getDummyInventory(), 0, 0);
                MainProxy.sendPacketToPlayer(PacketHandler.getPacket(FluidSupplierMode.class).setInteger((((PipeFluidSupplierMk2) pipe.pipe).isRequestingPartials() ? 1 : 0)).setBlockPos(pipe.getPos()), player);
                MainProxy.sendPacketToPlayer(PacketHandler.getPacket(FluidSupplierMinMode.class).setInteger(((PipeFluidSupplierMk2) pipe.pipe).getMinMode().ordinal()).setBlockPos(pipe.getPos()), player);
                return dummy;
            case GuiIDs.GUI_SatellitePipe_ID:
                if (pipe != null && pipe.pipe instanceof PipeItemsSatelliteLogistics) {
                    return new DummyContainer(player.inventory, null);
                }
                if (pipe != null && pipe.pipe instanceof PipeFluidSatellite) {
                    return new DummyContainer(player.inventory, null);
                }
            case GuiIDs.GUI_Normal_Orderer_ID:
                if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe)) {
                    return null;
                }
                return new DummyContainer(player.inventory, null);
            case GuiIDs.GUI_Normal_Mk2_Orderer_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeItemsRequestLogisticsMk2)) {
                    return null;
                }
                return new DummyContainer(player.inventory, null);
            case GuiIDs.GUI_Fluid_Orderer_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeFluidRequestLogistics)) {
                    return null;
                }
                return new DummyContainer(player.inventory, null);
            case GuiIDs.GUI_Freq_Card_ID:
                if (pipe == null || !((pipe.pipe instanceof PipeItemsSystemEntranceLogistics) || (pipe.pipe instanceof PipeItemsSystemDestinationLogistics))) {
                    return null;
                }
                IInventory inv = null;
                if (pipe.pipe instanceof PipeItemsSystemEntranceLogistics) {
                    inv = ((PipeItemsSystemEntranceLogistics) pipe.pipe).inv;
                } else if (pipe.pipe instanceof PipeItemsSystemDestinationLogistics) {
                    inv = ((PipeItemsSystemDestinationLogistics) pipe.pipe).inv;
                }
                dummy = new DummyContainer(player.inventory, inv);
                dummy.addRestrictedSlot(0, inv, 40, 40, itemStack -> {
                    if (itemStack.isEmpty()) {
                        return false;
                    }
                    if (itemStack.getItem() != LPItems.itemCard) {
                        return false;
                    }
                    return itemStack.getItemDamage() == LogisticsItemCard.FREQ_CARD;
                });
                dummy.addNormalSlotsForPlayerInventory(0, 0);
                return dummy;
            case GuiIDs.GUI_HUD_Settings:
                dummy = new DummyContainer(player.inventory, null);
                dummy.addRestrictedHotbarForPlayerInventory(10, 160);
                dummy.addRestrictedArmorForPlayerInventory(10, 60);
                return dummy;
            case GuiIDs.GUI_Fluid_Basic_ID:
                if (pipe == null || !((pipe.pipe instanceof PipeFluidBasic))) {
                    return null;
                }
                dummy = new DummyContainer(player, ((PipeFluidBasic) pipe.pipe).getSinkInv(), new IGuiOpenControler() {

                    @Override
                    public void guiOpenedByPlayer(EntityPlayer player) {
                        ((PipeFluidBasic) fpipe.pipe).guiOpenedByPlayer(player);
                    }

                    @Override
                    public void guiClosedByPlayer(EntityPlayer player) {
                        ((PipeFluidBasic) fpipe.pipe).guiClosedByPlayer(player);
                    }
                });
                dummy.addFluidSlot(0, ((PipeFluidBasic) pipe.pipe).getSinkInv(), 28, 15);
                dummy.addNormalSlotsForPlayerInventory(10, 45);
                return dummy;
            case GuiIDs.GUI_Fluid_Terminus_ID:
                if (pipe == null || !((pipe.pipe instanceof PipeFluidTerminus))) {
                    return null;
                }
                dummy = new DummyContainer(player, ((PipeFluidTerminus) pipe.pipe).getSinkInv(), new IGuiOpenControler() {

                    @Override
                    public void guiOpenedByPlayer(EntityPlayer player) {
                        ((PipeFluidTerminus) fpipe.pipe).guiOpenedByPlayer(player);
                    }

                    @Override
                    public void guiClosedByPlayer(EntityPlayer player) {
                        ((PipeFluidTerminus) fpipe.pipe).guiClosedByPlayer(player);
                    }
                });
                for (int i = 0; i < 9; i++) {
                    dummy.addFluidSlot(i, ((PipeFluidTerminus) pipe.pipe).getSinkInv(), 8 + i * 18, 13);
                }
                dummy.addNormalSlotsForPlayerInventory(10, 45);
                return dummy;
            case GuiIDs.GUI_FIREWALL:
                if (pipe == null || !((pipe.pipe instanceof PipeItemsFirewall))) {
                    return null;
                }
                dummy = new DummyContainer(player.inventory, ((PipeItemsFirewall) pipe.pipe).inv);
                dummy.addNormalSlotsForPlayerInventory(33, 147);
                for (int i = 0; i < 6; i++) {
                    for (int j = 0; j < 6; j++) {
                        dummy.addDummySlot(i * 6 + j, 0, 0);
                    }
                }
                return dummy;
            case GuiIDs.GUI_Request_Table_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeBlockRequestTable)) {
                    return null;
                }
                dummy = new DummyContainer(player, ((PipeBlockRequestTable) pipe.pipe).matrix, (PipeBlockRequestTable) pipe.pipe);
                int i = 0;
                for (int Y = 0; Y < 3; Y++) {
                    for (int X = 0; X < 9; X++) {
                        dummy.addNormalSlot(i++, ((PipeBlockRequestTable) pipe.pipe).inv, 0, 0);
                    }
                }
                i = 0;
                for (int Y = 0; Y < 3; Y++) {
                    for (int X = 0; X < 3; X++) {
                        dummy.addDummySlot(i++, 0, 0);
                    }
                }
                dummy.addCallableSlotHandler(0, ((PipeBlockRequestTable) pipe.pipe).resultInv, 0, 0, () -> ((PipeBlockRequestTable) fpipe.pipe).getResultForClick());
                dummy.addNormalSlot(0, ((PipeBlockRequestTable) pipe.pipe).toSortInv, 0, 0);
                dummy.addNormalSlot(0, ((PipeBlockRequestTable) pipe.pipe).diskInv, 0, 0);
                dummy.addNormalSlotsForPlayerInventory(0, 0);
                return dummy;
            default:
                break;
        }
    }
    return null;
}
Also used : IInventory(net.minecraft.inventory.IInventory) DummyContainer(logisticspipes.utils.gui.DummyContainer) PipeItemsFirewall(logisticspipes.pipes.PipeItemsFirewall) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) PipeItemsSatelliteLogistics(logisticspipes.pipes.PipeItemsSatelliteLogistics) PipeItemsSystemEntranceLogistics(logisticspipes.pipes.PipeItemsSystemEntranceLogistics) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) PipeFluidTerminus(logisticspipes.pipes.PipeFluidTerminus) PipeFluidBasic(logisticspipes.pipes.PipeFluidBasic) PipeFluidSatellite(logisticspipes.pipes.PipeFluidSatellite) TileEntity(net.minecraft.tileentity.TileEntity) PipeFluidSupplierMk2(logisticspipes.pipes.PipeFluidSupplierMk2) PipeItemsFluidSupplier(logisticspipes.pipes.PipeItemsFluidSupplier) PipeFluidRequestLogistics(logisticspipes.pipes.PipeFluidRequestLogistics) PipeItemsSystemDestinationLogistics(logisticspipes.pipes.PipeItemsSystemDestinationLogistics) IGuiOpenControler(logisticspipes.interfaces.IGuiOpenControler) FluidSupplierMode(logisticspipes.network.packets.pipe.FluidSupplierMode) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos) PipeItemsRequestLogisticsMk2(logisticspipes.pipes.PipeItemsRequestLogisticsMk2) FluidSupplierMinMode(logisticspipes.network.packets.pipe.FluidSupplierMinMode)

Aggregations

DummyContainer (logisticspipes.utils.gui.DummyContainer)31 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 IGuiOpenControler (logisticspipes.interfaces.IGuiOpenControler)3 IInventory (net.minecraft.inventory.IInventory)3 TileEntity (net.minecraft.tileentity.TileEntity)3 Nullable (javax.annotation.Nullable)2 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)2 ItemIdentifierInventory (logisticspipes.utils.item.ItemIdentifierInventory)2 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Stream (java.util.stream.Stream)1 Nonnull (javax.annotation.Nonnull)1 LogisticsProgramCompilerTileEntity (logisticspipes.blocks.LogisticsProgramCompilerTileEntity)1 LogisticsSecurityTileEntity (logisticspipes.blocks.LogisticsSecurityTileEntity)1 LogisticsSolderingTileEntity (logisticspipes.blocks.LogisticsSolderingTileEntity)1 LogisticsCraftingTableTileEntity (logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)1 LogisticsPowerJunctionTileEntity (logisticspipes.blocks.powertile.LogisticsPowerJunctionTileEntity)1 LogisticsPowerProviderTileEntity (logisticspipes.blocks.powertile.LogisticsPowerProviderTileEntity)1