Search in sources :

Example 1 with Target

use of crazypants.enderio.conduits.conduit.item.NetworkedInventory.Target in project EnderIO by SleepyTrousers.

the class ItemConduitNetwork method getTargetsForExtraction.

public List<String> getTargetsForExtraction(@Nonnull BlockPos extractFrom, @Nonnull IItemConduit con, @Nonnull ItemStack input) {
    List<String> result = new ArrayList<String>();
    List<NetworkedInventory> invs = getOrCreate(extractFrom);
    for (NetworkedInventory source : invs) {
        if (source.getCon().getBundle().getLocation().equals(con.getBundle().getLocation())) {
            List<Target> sendPriority = source.getSendPriority();
            if (sendPriority != null) {
                for (Target t : sendPriority) {
                    IItemFilter f = t.inv.getCon().getOutputFilter(t.inv.getConDir());
                    if (input.isEmpty() || f == null || f.doesItemPassFilter(getTargetInventory(t), input)) {
                        String s = t.inv.getLocalizedInventoryName() + " " + t.inv.getLocation().toString() + " Distance [" + t.distance + "] ";
                        result.add(s);
                    }
                }
            }
        }
    }
    return result;
}
Also used : Target(crazypants.enderio.conduits.conduit.item.NetworkedInventory.Target) IItemFilter(crazypants.enderio.base.filter.IItemFilter) ArrayList(java.util.ArrayList)

Aggregations

IItemFilter (crazypants.enderio.base.filter.IItemFilter)1 Target (crazypants.enderio.conduits.conduit.item.NetworkedInventory.Target)1 ArrayList (java.util.ArrayList)1