Search in sources :

Example 1 with QIOModIDFilter

use of mekanism.common.content.qio.filter.QIOModIDFilter in project Mekanism by mekanism.

the class TileEntityQIOExporter method getFilterEjectMap.

private Object2LongMap<HashedItem> getFilterEjectMap(TileEntity back, QIOFrequency freq) {
    Object2LongMap<HashedItem> map = new Object2LongOpenHashMap<>();
    for (QIOFilter<?> filter : getFilters()) {
        if (filter instanceof QIOItemStackFilter) {
            QIOItemStackFilter itemFilter = (QIOItemStackFilter) filter;
            if (itemFilter.fuzzyMode) {
                map.putAll(freq.getStacksByItem(itemFilter.getItemStack().getItem()));
            } else {
                HashedItem type = HashedItem.create(itemFilter.getItemStack());
                map.put(type, freq.getStored(type));
            }
        } else if (filter instanceof QIOTagFilter) {
            String tagName = ((QIOTagFilter) filter).getTagName();
            map.putAll(freq.getStacksByTagWildcard(tagName));
        } else if (filter instanceof QIOModIDFilter) {
            String modID = ((QIOModIDFilter) filter).getModID();
            map.putAll(freq.getStacksByModIDWildcard(modID));
        }
    }
    return map;
}
Also used : Object2LongOpenHashMap(it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap) HashedItem(mekanism.common.lib.inventory.HashedItem) QIOTagFilter(mekanism.common.content.qio.filter.QIOTagFilter) QIOModIDFilter(mekanism.common.content.qio.filter.QIOModIDFilter) QIOItemStackFilter(mekanism.common.content.qio.filter.QIOItemStackFilter)

Aggregations

Object2LongOpenHashMap (it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap)1 QIOItemStackFilter (mekanism.common.content.qio.filter.QIOItemStackFilter)1 QIOModIDFilter (mekanism.common.content.qio.filter.QIOModIDFilter)1 QIOTagFilter (mekanism.common.content.qio.filter.QIOTagFilter)1 HashedItem (mekanism.common.lib.inventory.HashedItem)1