Search in sources :

Example 6 with DummyContainer

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

the class PipeController method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    LogisticsTileGenericPipe tile = getTileAs(player.world, LogisticsTileGenericPipe.class);
    if (!(tile.pipe instanceof CoreRoutedPipe)) {
        return null;
    }
    final CoreRoutedPipe pipe = (CoreRoutedPipe) tile.pipe;
    DummyContainer dummy = new DummyContainer(player, null, pipe.getOriginalUpgradeManager().getGuiController(), new IGuiOpenControler() {

        // Network Statistics
        @Override
        public void guiOpenedByPlayer(EntityPlayer player) {
            pipe.playerStartWatching(player, 0);
        }

        @Override
        public void guiClosedByPlayer(EntityPlayer player) {
            pipe.playerStopWatching(player, 0);
        }
    });
    dummy.addNormalSlotsForPlayerInventory(0, 0);
    // TAB_1 SLOTS
    for (int pipeSlot = 0; pipeSlot < 9; pipeSlot++) {
        dummy.addUpgradeSlot(pipeSlot, pipe.getOriginalUpgradeManager(), pipeSlot, 8 + pipeSlot * 18, 18, itemStack -> !itemStack.isEmpty() && itemStack.getItem() instanceof ItemUpgrade && ((ItemUpgrade) itemStack.getItem()).getUpgradeForItem(itemStack, null).isAllowedForPipe(pipe));
    }
    for (int pipeSlot = 0; pipeSlot < 9; pipeSlot++) {
        dummy.addSneakyUpgradeSlot(pipeSlot, pipe.getOriginalUpgradeManager(), pipeSlot + 9, 8 + pipeSlot * 18, 48, itemStack -> {
            if (itemStack.isEmpty()) {
                return false;
            }
            if (itemStack.getItem() instanceof ItemUpgrade) {
                IPipeUpgrade upgrade = ((ItemUpgrade) itemStack.getItem()).getUpgradeForItem(itemStack, null);
                return upgrade instanceof SneakyUpgradeConfig && upgrade.isAllowedForPipe(pipe);
            } else {
                return false;
            }
        });
    }
    // TAB_2 SLOTS
    dummy.addStaticRestrictedSlot(0, pipe.getOriginalUpgradeManager().secInv, 8 + 8 * 18, 18, itemStack -> {
        if (itemStack.isEmpty()) {
            return false;
        }
        if (itemStack.getItem() != LPItems.itemCard) {
            return false;
        }
        if (itemStack.getItemDamage() != LogisticsItemCard.SEC_CARD) {
            return false;
        }
        final NBTTagCompound tag = Objects.requireNonNull(itemStack.getTagCompound());
        return SimpleServiceLocator.securityStationManager.isAuthorized(UUID.fromString(tag.getString("UUID")));
    }, 1);
    dummy.addRestrictedSlot(0, tile.logicController.diskInv, 14, 36, LPItems.disk);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) IPipeUpgrade(logisticspipes.pipes.upgrades.IPipeUpgrade) IGuiOpenControler(logisticspipes.interfaces.IGuiOpenControler) ItemUpgrade(logisticspipes.items.ItemUpgrade) SneakyUpgradeConfig(logisticspipes.pipes.upgrades.SneakyUpgradeConfig) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 7 with DummyContainer

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

the class PowerJunctionGui method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    DummyContainer dummy = new DummyContainer(player, null, getTileAs(player.world, LogisticsPowerJunctionTileEntity.class));
    dummy.addNormalSlotsForPlayerInventory(8, 80);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) LogisticsPowerJunctionTileEntity(logisticspipes.blocks.powertile.LogisticsPowerJunctionTileEntity)

Example 8 with DummyContainer

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

the class ProgramCompilerGui method getContainer.

@Override
public Container getContainer(EntityPlayer player) {
    LogisticsProgramCompilerTileEntity compilerBlock = getTileAs(player.world, LogisticsProgramCompilerTileEntity.class);
    DummyContainer dummy = new DummyContainer(player, null, compilerBlock);
    dummy.addRestrictedSlot(0, compilerBlock.getInventory(), 10, 10, LPItems.disk);
    dummy.addRestrictedSlot(1, compilerBlock.getInventory(), 154, 10, LPItems.logisticsProgrammer);
    dummy.addNormalSlotsForPlayerInventory(10, 45);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) LogisticsProgramCompilerTileEntity(logisticspipes.blocks.LogisticsProgramCompilerTileEntity)

Example 9 with DummyContainer

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

the class ItemAmountSignGui method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = getTileAs(player.world, LogisticsTileGenericPipe.class);
    if (!(pipe.pipe instanceof CoreRoutedPipe)) {
        return null;
    }
    ItemAmountPipeSign sign = ((ItemAmountPipeSign) ((CoreRoutedPipe) pipe.pipe).getPipeSign(dir));
    Objects.requireNonNull(sign);
    DummyContainer dummy = new DummyContainer(player.inventory, sign.itemTypeInv);
    dummy.addDummySlot(0, 0, 0);
    dummy.addNormalSlotsForPlayerInventory(0, 0);
    return dummy;
}
Also used : DummyContainer(logisticspipes.utils.gui.DummyContainer) ItemAmountPipeSign(logisticspipes.pipes.signs.ItemAmountPipeSign) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

Example 10 with DummyContainer

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

the class LogicControllerGuiProvider method getContainer.

@Override
public Container getContainer(EntityPlayer player) {
    TileEntity pipe = getTileAs(player.world, TileEntity.class);
    if (pipe instanceof ILogicControllerTile) {
        DummyContainer dummy = new DummyContainer(player.inventory, null);
        dummy.addNormalSlotsForPlayerInventory(50, 190);
        return dummy;
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) DummyContainer(logisticspipes.utils.gui.DummyContainer) ILogicControllerTile(logisticspipes.logic.interfaces.ILogicControllerTile)

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