Search in sources :

Example 16 with CoreRoutedPipe

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

the class AdvancedExtractorSneakyGuiPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    if (getType() == ModulePositionType.IN_HAND) {
        if (player.openContainer instanceof DummyModuleContainer) {
            DummyModuleContainer dummy = (DummyModuleContainer) player.openContainer;
            if (dummy.getModule() instanceof ModuleAdvancedExtractor) {
                player.closeScreen();
                NewGuiHandler.getGui(ExtractorModuleInHand.class).setInvSlot(getPositionInt()).open(player);
            }
        }
        return;
    }
    final LogisticsTileGenericPipe pipe = this.getPipe(player.worldObj);
    if (pipe == null) {
        return;
    }
    if (!(pipe.pipe instanceof CoreRoutedPipe)) {
        return;
    }
    final CoreRoutedPipe piperouted = (CoreRoutedPipe) pipe.pipe;
    if (piperouted.getLogisticsModule() == null) {
        return;
    }
    if (piperouted.getLogisticsModule().getSubModule(getPositionInt()) instanceof ModuleAdvancedExtractor) {
        final ModuleAdvancedExtractor module = (ModuleAdvancedExtractor) piperouted.getLogisticsModule().getSubModule(getPositionInt());
        NewGuiHandler.getGui(ExtractorModuleSlot.class).setSneakyOrientation(module.getSneakyDirection()).setSlot(getType()).setPositionInt(getPositionInt()).setPosX(getPosX()).setPosY(getPosY()).setPosZ(getPosZ()).open(player);
        return;
    }
}
Also used : DummyModuleContainer(logisticspipes.utils.gui.DummyModuleContainer) ModuleAdvancedExtractor(logisticspipes.modules.ModuleAdvancedExtractor) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) ExtractorModuleSlot(logisticspipes.network.guis.module.inpipe.ExtractorModuleSlot)

Example 17 with CoreRoutedPipe

use of logisticspipes.pipes.basic.CoreRoutedPipe 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 18 with CoreRoutedPipe

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

the class PipeItemsInvSysConnector method onChunkUnload.

@Override
public void onChunkUnload() {
    if (!stillNeedReplace) {
        CoreRoutedPipe CRP = SimpleServiceLocator.connectionManager.getConnectedPipe(getRouter());
        SimpleServiceLocator.connectionManager.removeDirectConnection(getRouter());
        if (CRP != null) {
            CRP.refreshRender(true);
        }
    }
    init = false;
    super.onChunkUnload();
}
Also used : CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

Example 19 with CoreRoutedPipe

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

the class PipeItemsInvSysConnector method onAllowedRemoval.

@Override
public void onAllowedRemoval() {
    if (!stillNeedReplace) {
        CoreRoutedPipe CRP = SimpleServiceLocator.connectionManager.getConnectedPipe(getRouter());
        SimpleServiceLocator.connectionManager.removeDirectConnection(getRouter());
        if (CRP != null) {
            CRP.refreshRender(true);
        }
    }
    dropFreqCard();
}
Also used : CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

Example 20 with CoreRoutedPipe

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

the class PipeItemsInvSysConnector method handleItemEnterInv.

public void handleItemEnterInv(ItemRoutingInformation info, TileEntity tile) {
    if (info.getItem().getStackSize() == 0) {
        // system.throw("why you try to insert empty stack?");
        return;
    }
    if (isConnectedInv(tile)) {
        if (hasRemoteConnection()) {
            CoreRoutedPipe CRP = SimpleServiceLocator.connectionManager.getConnectedPipe(getRouter());
            if (CRP instanceof IDirectRoutingConnection) {
                IDirectRoutingConnection pipe = (IDirectRoutingConnection) CRP;
                pipe.addItem(info);
                spawnParticle(Particles.OrangeParticle, 4);
            }
        }
    }
}
Also used : CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) IDirectRoutingConnection(logisticspipes.interfaces.routing.IDirectRoutingConnection)

Aggregations

CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)68 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)43 TileEntity (net.minecraft.tileentity.TileEntity)22 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)16 ExitRoute (logisticspipes.routing.ExitRoute)15 ArrayList (java.util.ArrayList)14 LinkedList (java.util.LinkedList)13 IRouter (logisticspipes.routing.IRouter)11 Pair (logisticspipes.utils.tuples.Pair)10 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)10 List (java.util.List)9 HashMap (java.util.HashMap)8 IFilter (logisticspipes.interfaces.routing.IFilter)8 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)7 Map (java.util.Map)6 PipeRoutingConnectionType (logisticspipes.routing.PipeRoutingConnectionType)6 World (net.minecraft.world.World)6 BitSet (java.util.BitSet)5 Collections (java.util.Collections)5 EnumSet (java.util.EnumSet)5