Search in sources :

Example 1 with ModuleUpgradeManager

use of logisticspipes.pipes.upgrades.ModuleUpgradeManager in project LogisticsPipes by RS485.

the class ChassisGuiProvider method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = getTileAs(player.world, LogisticsTileGenericPipe.class);
    if (!(pipe.pipe instanceof PipeLogisticsChassis)) {
        return null;
    }
    final PipeLogisticsChassis _chassiPipe = (PipeLogisticsChassis) pipe.pipe;
    IInventory _moduleInventory = _chassiPipe.getModuleInventory();
    DummyContainer dummy = new DummyContainer(player.inventory, _moduleInventory);
    if (_chassiPipe.getChassisSize() < 5) {
        dummy.addNormalSlotsForPlayerInventory(18, 97);
    } else {
        dummy.addNormalSlotsForPlayerInventory(18, 174);
    }
    for (int i = 0; i < _chassiPipe.getChassisSize(); i++) {
        dummy.addModuleSlot(i, _moduleInventory, 19, 9 + 20 * i, _chassiPipe);
    }
    if (_chassiPipe.getUpgradeManager().hasUpgradeModuleUpgrade()) {
        for (int i = 0; i < _chassiPipe.getChassisSize(); i++) {
            final int fI = i;
            ModuleUpgradeManager upgradeManager = _chassiPipe.getModuleUpgradeManager(i);
            dummy.addUpgradeSlot(0, upgradeManager, 0, 145, 9 + i * 20, itemStack -> ChassisGuiProvider.checkStack(itemStack, _chassiPipe, fI));
            dummy.addUpgradeSlot(1, upgradeManager, 1, 165, 9 + i * 20, itemStack -> ChassisGuiProvider.checkStack(itemStack, _chassiPipe, fI));
        }
    }
    return dummy;
}
Also used : IInventory(net.minecraft.inventory.IInventory) DummyContainer(logisticspipes.utils.gui.DummyContainer) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) PipeLogisticsChassis(logisticspipes.pipes.PipeLogisticsChassis) ModuleUpgradeManager(logisticspipes.pipes.upgrades.ModuleUpgradeManager)

Example 2 with ModuleUpgradeManager

use of logisticspipes.pipes.upgrades.ModuleUpgradeManager in project LogisticsPipes by RS485.

the class ChassiGuiProvider method getContainer.

@Override
public DummyContainer getContainer(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = getPipe(player.getEntityWorld());
    if (pipe == null || !(pipe.pipe instanceof PipeLogisticsChassi)) {
        return null;
    }
    final PipeLogisticsChassi _chassiPipe = (PipeLogisticsChassi) pipe.pipe;
    IInventory _moduleInventory = _chassiPipe.getModuleInventory();
    DummyContainer dummy = new DummyContainer(player.inventory, _moduleInventory);
    if (_chassiPipe.getChassiSize() < 5) {
        dummy.addNormalSlotsForPlayerInventory(18, 97);
    } else {
        dummy.addNormalSlotsForPlayerInventory(18, 174);
    }
    if (_chassiPipe.getChassiSize() > 0) {
        dummy.addModuleSlot(0, _moduleInventory, 19, 9, _chassiPipe);
    }
    if (_chassiPipe.getChassiSize() > 1) {
        dummy.addModuleSlot(1, _moduleInventory, 19, 29, _chassiPipe);
    }
    if (_chassiPipe.getChassiSize() > 2) {
        dummy.addModuleSlot(2, _moduleInventory, 19, 49, _chassiPipe);
    }
    if (_chassiPipe.getChassiSize() > 3) {
        dummy.addModuleSlot(3, _moduleInventory, 19, 69, _chassiPipe);
    }
    if (_chassiPipe.getChassiSize() > 4) {
        dummy.addModuleSlot(4, _moduleInventory, 19, 89, _chassiPipe);
        dummy.addModuleSlot(5, _moduleInventory, 19, 109, _chassiPipe);
        dummy.addModuleSlot(6, _moduleInventory, 19, 129, _chassiPipe);
        dummy.addModuleSlot(7, _moduleInventory, 19, 149, _chassiPipe);
    }
    if (_chassiPipe.getUpgradeManager().hasUpgradeModuleUpgrade()) {
        for (int i = 0; i < _chassiPipe.getChassiSize(); i++) {
            final int fI = i;
            ModuleUpgradeManager upgradeManager = _chassiPipe.getModuleUpgradeManager(i);
            dummy.addUpgradeSlot(0, upgradeManager, 0, 145, 9 + i * 20, itemStack -> ChassiGuiProvider.checkStack(itemStack, _chassiPipe, fI));
            dummy.addUpgradeSlot(1, upgradeManager, 1, 165, 9 + i * 20, itemStack -> ChassiGuiProvider.checkStack(itemStack, _chassiPipe, fI));
        }
    }
    return dummy;
}
Also used : IInventory(net.minecraft.inventory.IInventory) DummyContainer(logisticspipes.utils.gui.DummyContainer) PipeLogisticsChassi(logisticspipes.pipes.PipeLogisticsChassi) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) ModuleUpgradeManager(logisticspipes.pipes.upgrades.ModuleUpgradeManager)

Aggregations

LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)2 ModuleUpgradeManager (logisticspipes.pipes.upgrades.ModuleUpgradeManager)2 DummyContainer (logisticspipes.utils.gui.DummyContainer)2 IInventory (net.minecraft.inventory.IInventory)2 PipeLogisticsChassi (logisticspipes.pipes.PipeLogisticsChassi)1 PipeLogisticsChassis (logisticspipes.pipes.PipeLogisticsChassis)1