Search in sources :

Example 66 with CoreRoutedPipe

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

the class ServerRouter method getPipe.

@Override
public CoreRoutedPipe getPipe() {
    CoreRoutedPipe crp = getCachedPipe();
    if (crp != null) {
        return crp;
    }
    World worldObj = DimensionManager.getWorld(_dimension);
    if (worldObj == null) {
        return null;
    }
    TileEntity tile = worldObj.getTileEntity(_xCoord, _yCoord, _zCoord);
    if (!(tile instanceof LogisticsTileGenericPipe)) {
        return null;
    }
    LogisticsTileGenericPipe pipe = (LogisticsTileGenericPipe) tile;
    if (!(pipe.pipe instanceof CoreRoutedPipe)) {
        return null;
    }
    _myPipeCache = new WeakReference<>((CoreRoutedPipe) pipe.pipe);
    return (CoreRoutedPipe) pipe.pipe;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) World(net.minecraft.world.World)

Example 67 with CoreRoutedPipe

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

the class ServerRouter method checkAdjacentUpdate.

@Override
public boolean checkAdjacentUpdate() {
    boolean blockNeedsUpdate = recheckAdjacent();
    if (!blockNeedsUpdate) {
        return false;
    }
    CoreRoutedPipe pipe = getPipe();
    if (pipe == null) {
        return true;
    }
    pipe.refreshRender(true);
    return true;
}
Also used : CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

Example 68 with CoreRoutedPipe

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

the class HudUpdateTick method tick.

public static void tick() {
    if (HudUpdateTick.firstRouter == -1) {
        return;
    }
    IRouterManager rm = SimpleServiceLocator.routerManager;
    int slotSentCount = 0;
    //cork the compressor
    SimpleServiceLocator.serverBufferHandler.setPause(true);
    while (HudUpdateTick.firstRouter != -1 && slotSentCount < HudUpdateTick.inventorySlotsToUpdatePerTick) {
        HudUpdateTick.routersNeedingUpdate.clear(HudUpdateTick.firstRouter);
        IRouter currentRouter = rm.getRouterUnsafe(HudUpdateTick.firstRouter, false);
        if (currentRouter != null) {
            CoreRoutedPipe pipe = currentRouter.getCachedPipe();
            if (pipe != null) {
                slotSentCount += pipe.sendQueueChanged(true);
            }
        }
        HudUpdateTick.firstRouter = HudUpdateTick.routersNeedingUpdate.nextSetBit(HudUpdateTick.firstRouter);
    }
    //and let it compress and send
    SimpleServiceLocator.serverBufferHandler.setPause(false);
}
Also used : IRouter(logisticspipes.routing.IRouter) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) IRouterManager(logisticspipes.routing.IRouterManager)

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