Search in sources :

Example 16 with LogisticsModule

use of logisticspipes.modules.abstractmodules.LogisticsModule in project LogisticsPipes by RS485.

the class LogisticsManager method canSink.

public static SinkReply canSink(IRouter destination, IRouter sourceRouter, boolean excludeSource, ItemIdentifier stack, SinkReply result, boolean activeRequest, boolean allowDefault) {
    SinkReply reply = null;
    LogisticsModule module = destination.getLogisticsModule();
    CoreRoutedPipe crp = destination.getPipe();
    if (module == null) {
        return null;
    }
    if (!(module.recievePassive() || activeRequest)) {
        return null;
    }
    if (crp == null || !crp.isEnabled()) {
        return null;
    }
    if (excludeSource && sourceRouter != null) {
        if (destination.getPipe().sharesInterestWith(sourceRouter.getPipe())) {
            return null;
        }
    }
    if (result == null) {
        reply = module.sinksItem(stack, -1, 0, allowDefault, true);
    } else {
        reply = module.sinksItem(stack, result.fixedPriority.ordinal(), result.customPriority, allowDefault, true);
    }
    if (result != null && result.maxNumberOfItems < 0) {
        return null;
    }
    return reply;
}
Also used : SinkReply(logisticspipes.utils.SinkReply) LogisticsModule(logisticspipes.modules.abstractmodules.LogisticsModule) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

Aggregations

LogisticsModule (logisticspipes.modules.abstractmodules.LogisticsModule)16 ILegacyActiveModule (logisticspipes.interfaces.ILegacyActiveModule)4 ItemStack (net.minecraft.item.ItemStack)4 SinkReply (logisticspipes.utils.SinkReply)3 IInventoryUtil (logisticspipes.interfaces.IInventoryUtil)2 IRequireReliableTransport (logisticspipes.interfaces.routing.IRequireReliableTransport)2 TreeSet (java.util.TreeSet)1 GuiChassiPipe (logisticspipes.gui.GuiChassiPipe)1 IBufferItems (logisticspipes.interfaces.IBufferItems)1 IFilter (logisticspipes.interfaces.routing.IFilter)1 ItemModule (logisticspipes.items.ItemModule)1 LogisticsGuiModule (logisticspipes.modules.abstractmodules.LogisticsGuiModule)1 ModernPacket (logisticspipes.network.abstractpackets.ModernPacket)1 ChassiePipeModuleContent (logisticspipes.network.packets.pipe.ChassiePipeModuleContent)1 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)1 LogisticsOrder (logisticspipes.routing.order.LogisticsOrder)1 DummyWorldProvider (logisticspipes.utils.DummyWorldProvider)1 ItemIdentifier (logisticspipes.utils.item.ItemIdentifier)1 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1