Search in sources :

Example 1 with ILegacyActiveModule

use of logisticspipes.interfaces.ILegacyActiveModule in project LogisticsPipes by RS485.

the class PipeLogisticsChassi method onAllowedRemoval.

@Override
public void onAllowedRemoval() {
    _moduleInventory.removeListener(this);
    if (MainProxy.isServer(getWorld())) {
        for (int i = 0; i < getChassiSize(); i++) {
            LogisticsModule x = _module.getSubModule(i);
            if (x instanceof ILegacyActiveModule) {
                ILegacyActiveModule y = (ILegacyActiveModule) x;
                y.onBlockRemoval();
            }
        }
        for (int i = 0; i < _moduleInventory.getSizeInventory(); i++) {
            ItemIdentifierStack ms = _moduleInventory.getIDStackInSlot(i);
            if (ms != null) {
                ItemStack s = ms.makeNormalStack();
                ItemModuleInformationManager.saveInfotmation(s, getLogisticsModule().getSubModule(i));
                _moduleInventory.setInventorySlotContents(i, s);
            }
        }
        _moduleInventory.dropContents(getWorld(), getX(), getY(), getZ());
    }
}
Also used : ILegacyActiveModule(logisticspipes.interfaces.ILegacyActiveModule) LogisticsModule(logisticspipes.modules.abstractmodules.LogisticsModule) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) ItemStack(net.minecraft.item.ItemStack)

Example 2 with ILegacyActiveModule

use of logisticspipes.interfaces.ILegacyActiveModule in project LogisticsPipes by RS485.

the class PipeLogisticsChassi method canProvide.

/*** IProvideItems ***/
@Override
public void canProvide(RequestTreeNode tree, RequestTree root, List<IFilter> filters) {
    if (!isEnabled()) {
        return;
    }
    for (IFilter filter : filters) {
        if (filter.isBlocked() == filter.isFilteredItem(tree.getRequestType()) || filter.blockProvider()) {
            return;
        }
    }
    for (int i = 0; i < getChassiSize(); i++) {
        LogisticsModule x = _module.getSubModule(i);
        if (x instanceof ILegacyActiveModule) {
            ILegacyActiveModule y = (ILegacyActiveModule) x;
            y.canProvide(tree, root, filters);
        }
    }
}
Also used : ILegacyActiveModule(logisticspipes.interfaces.ILegacyActiveModule) IFilter(logisticspipes.interfaces.routing.IFilter) LogisticsModule(logisticspipes.modules.abstractmodules.LogisticsModule)

Example 3 with ILegacyActiveModule

use of logisticspipes.interfaces.ILegacyActiveModule in project LogisticsPipes by RS485.

the class PipeLogisticsChassis method canProvide.

/**
 * IProvideItems **
 */
@Override
public void canProvide(RequestTreeNode tree, RequestTree root, List<IFilter> filters) {
    if (!isEnabled()) {
        return;
    }
    for (IFilter filter : filters) {
        if (filter.isBlocked() == filter.isFilteredItem(tree.getRequestType()) || filter.blockProvider()) {
            return;
        }
    }
    for (int i = 0; i < getChassisSize(); i++) {
        LogisticsModule x = getSubModule(i);
        if (x instanceof ILegacyActiveModule) {
            ILegacyActiveModule y = (ILegacyActiveModule) x;
            y.canProvide(tree, root, filters);
        }
    }
}
Also used : ILegacyActiveModule(logisticspipes.interfaces.ILegacyActiveModule) IFilter(logisticspipes.interfaces.routing.IFilter) LogisticsModule(logisticspipes.modules.LogisticsModule)

Example 4 with ILegacyActiveModule

use of logisticspipes.interfaces.ILegacyActiveModule in project LogisticsPipes by RS485.

the class PipeLogisticsChassis method getAllItems.

@Override
public void getAllItems(Map<ItemIdentifier, Integer> list, List<IFilter> filter) {
    if (!isEnabled()) {
        return;
    }
    for (int i = 0; i < getChassisSize(); i++) {
        LogisticsModule x = getSubModule(i);
        if (x instanceof ILegacyActiveModule) {
            ILegacyActiveModule y = (ILegacyActiveModule) x;
            y.getAllItems(list, filter);
        }
    }
}
Also used : ILegacyActiveModule(logisticspipes.interfaces.ILegacyActiveModule) LogisticsModule(logisticspipes.modules.LogisticsModule)

Example 5 with ILegacyActiveModule

use of logisticspipes.interfaces.ILegacyActiveModule in project LogisticsPipes by RS485.

the class PipeLogisticsChassis method fullFill.

@Override
public LogisticsOrder fullFill(LogisticsPromise promise, IRequestItems destination, IAdditionalTargetInformation info) {
    if (!isEnabled()) {
        return null;
    }
    for (int i = 0; i < getChassisSize(); i++) {
        LogisticsModule x = getSubModule(i);
        if (x instanceof ILegacyActiveModule) {
            ILegacyActiveModule y = (ILegacyActiveModule) x;
            LogisticsOrder result = y.fullFill(promise, destination, info);
            if (result != null) {
                spawnParticle(Particles.WhiteParticle, 2);
                return result;
            }
        }
    }
    return null;
}
Also used : ILegacyActiveModule(logisticspipes.interfaces.ILegacyActiveModule) LogisticsOrder(logisticspipes.routing.order.LogisticsOrder) LogisticsModule(logisticspipes.modules.LogisticsModule)

Aggregations

ILegacyActiveModule (logisticspipes.interfaces.ILegacyActiveModule)8 LogisticsModule (logisticspipes.modules.LogisticsModule)4 LogisticsModule (logisticspipes.modules.abstractmodules.LogisticsModule)4 IFilter (logisticspipes.interfaces.routing.IFilter)2 LogisticsOrder (logisticspipes.routing.order.LogisticsOrder)2 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)2 ItemStack (net.minecraft.item.ItemStack)2