Search in sources :

Example 36 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.

the class SubmitFluidRequestPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    final LogisticsTileGenericPipe pipe = MainProxy.proxy.getPipeInDimensionAt(getDimension(), getPosX(), getPosY(), getPosZ(), player);
    if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe) || !(pipe.pipe instanceof IRequestFluid)) {
        return;
    }
    RequestHandler.requestFluid(player, getStack(), (CoreRoutedPipe) pipe.pipe, (IRequestFluid) pipe.pipe);
}
Also used : IRequestFluid(logisticspipes.interfaces.routing.IRequestFluid) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

Example 37 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.

the class FluidSupplierMode method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    final LogisticsTileGenericPipe pipe = this.getPipe(player.world);
    if (pipe == null) {
        return;
    }
    if (MainProxy.isClient(player.world)) {
        if (pipe.pipe instanceof PipeItemsFluidSupplier) {
            ((PipeItemsFluidSupplier) pipe.pipe).setRequestingPartials((getInteger() % 10) == 1);
        }
        if (pipe.pipe instanceof PipeFluidSupplierMk2) {
            ((PipeFluidSupplierMk2) pipe.pipe).setRequestingPartials((getInteger() % 10) == 1);
        }
    } else {
        if (pipe.pipe instanceof PipeItemsFluidSupplier) {
            PipeItemsFluidSupplier liquid = (PipeItemsFluidSupplier) pipe.pipe;
            liquid.setRequestingPartials((getInteger() % 10) == 1);
        }
        if (pipe.pipe instanceof PipeFluidSupplierMk2) {
            PipeFluidSupplierMk2 liquid = (PipeFluidSupplierMk2) pipe.pipe;
            liquid.setRequestingPartials((getInteger() % 10) == 1);
        }
    }
}
Also used : PipeFluidSupplierMk2(logisticspipes.pipes.PipeFluidSupplierMk2) PipeItemsFluidSupplier(logisticspipes.pipes.PipeItemsFluidSupplier) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe)

Example 38 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe 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 39 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe 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 40 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.

the class CraftingSetType method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    TileEntity table = this.getTileAs(player.getEntityWorld(), TileEntity.class);
    if (table instanceof LogisticsCraftingTableTileEntity) {
        ((LogisticsCraftingTableTileEntity) table).targetType = targetType;
        ((LogisticsCraftingTableTileEntity) table).cacheRecipe();
    } else if (table instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) table).pipe instanceof PipeBlockRequestTable) {
        ((PipeBlockRequestTable) ((LogisticsTileGenericPipe) table).pipe).targetType = targetType;
        ((PipeBlockRequestTable) ((LogisticsTileGenericPipe) table).pipe).cacheRecipe();
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)

Aggregations

LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)115 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)47 TileEntity (net.minecraft.tileentity.TileEntity)45 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)21 EnumFacing (net.minecraft.util.EnumFacing)15 ArrayList (java.util.ArrayList)14 List (java.util.List)12 EntityPlayer (net.minecraft.entity.player.EntityPlayer)10 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)10 BlockPos (net.minecraft.util.math.BlockPos)10 World (net.minecraft.world.World)9 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)9 HashMap (java.util.HashMap)8 LinkedList (java.util.LinkedList)8 PipeBlockRequestTable (logisticspipes.pipes.PipeBlockRequestTable)8 LogisticsPowerJunctionTileEntity (logisticspipes.blocks.powertile.LogisticsPowerJunctionTileEntity)7 MainProxy (logisticspipes.proxy.MainProxy)7 ExitRoute (logisticspipes.routing.ExitRoute)7 PipeLogisticsChassi (logisticspipes.pipes.PipeLogisticsChassi)6 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)6