fixed retrieval modules ignoring filter extensions

Closes #59
This commit is contained in:
Ell 2020-11-22 19:29:04 +01:00
parent 3632c619ec
commit f9d72a3b87
2 changed files with 18 additions and 21 deletions

View file

@ -122,7 +122,7 @@ public class ItemFilter extends ItemStackHandler {
return false;
}
private List<ItemFilter> getAllFilters() {
public List<ItemFilter> getAllFilters() {
List<ItemFilter> filters = this.pipe.streamModules()
.filter(p -> p.getRight() instanceof FilterIncreaseModuleItem)
.map(p -> new ItemFilter(18, p.getLeft(), this.pipe))

View file

@ -6,8 +6,6 @@ import de.ellpeck.prettypipes.items.ModuleItem;
import de.ellpeck.prettypipes.items.ModuleTier;
import de.ellpeck.prettypipes.misc.ItemEqualityType;
import de.ellpeck.prettypipes.misc.ItemFilter;
import de.ellpeck.prettypipes.network.NetworkLocation;
import de.ellpeck.prettypipes.network.PipeItem;
import de.ellpeck.prettypipes.network.PipeNetwork;
import de.ellpeck.prettypipes.pipe.PipeTileEntity;
import de.ellpeck.prettypipes.pipe.containers.AbstractPipeContainer;
@ -15,11 +13,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.items.IItemHandler;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
public class RetrievalModuleItem extends ModuleItem {
private final int maxExtraction;
private final int speed;
@ -45,9 +40,10 @@ public class RetrievalModuleItem extends ModuleItem {
ItemFilter filter = new ItemFilter(this.filterSlots, module, tile);
ItemEqualityType[] equalityTypes = ItemFilter.getEqualityTypes(tile);
filter.isWhitelist = true;
// loop through filter to see which items to pull
for (int f = 0; f < filter.getSlots(); f++) {
ItemStack filtered = filter.getStackInSlot(f);
// loop through filters to see which items to pull
for (ItemFilter subFilter : filter.getAllFilters()) {
for (int f = 0; f < subFilter.getSlots(); f++) {
ItemStack filtered = subFilter.getStackInSlot(f);
if (filtered.isEmpty())
continue;
ItemStack copy = filtered.copy();
@ -62,6 +58,7 @@ public class RetrievalModuleItem extends ModuleItem {
break;
}
}
}
@Override
public boolean canNetworkSee(ItemStack module, PipeTileEntity tile) {