Search in sources :

Example 1 with IRouterManager

use of logisticspipes.routing.IRouterManager 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)1 IRouter (logisticspipes.routing.IRouter)1 IRouterManager (logisticspipes.routing.IRouterManager)1