Search in sources :

Example 6 with ILegacyActiveModule

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

the class PipeLogisticsChassi method getAllItems.

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

Example 7 with ILegacyActiveModule

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

the class PipeLogisticsChassi method fullFill.

@Override
public LogisticsOrder fullFill(LogisticsPromise promise, IRequestItems destination, IAdditionalTargetInformation info) {
    if (!isEnabled()) {
        return null;
    }
    for (int i = 0; i < getChassiSize(); i++) {
        LogisticsModule x = _module.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.abstractmodules.LogisticsModule)

Example 8 with ILegacyActiveModule

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

the class PipeLogisticsChassis method onAllowedRemoval.

@Override
public void onAllowedRemoval() {
    _moduleInventory.removeListener(this);
    if (MainProxy.isServer(getWorld())) {
        for (int i = 0; i < getChassisSize(); i++) {
            LogisticsModule x = 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 stack = ms.makeNormalStack();
                ItemModuleInformationManager.saveInformation(stack, getSubModule(i));
                _moduleInventory.setInventorySlotContents(i, stack);
            }
        }
        _moduleInventory.dropContents(getWorld(), getX(), getY(), getZ());
        for (int i = 0; i < getChassisSize(); i++) {
            getModuleUpgradeManager(i).dropUpgrades();
        }
    }
}
Also used : ILegacyActiveModule(logisticspipes.interfaces.ILegacyActiveModule) LogisticsModule(logisticspipes.modules.LogisticsModule) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) ItemStack(net.minecraft.item.ItemStack)

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