Skip to content

Commit

Permalink
fixed pastel networks not filtering items
Browse files Browse the repository at this point in the history
DaFuqs committed Nov 14, 2023
1 parent 4a2d291 commit 3ca00bd
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@
import org.jgrapht.graph.*;

import java.util.*;
import java.util.function.*;

public class PastelTransmissionLogic {

@@ -103,16 +104,19 @@ private void tryTransferToType(PastelNodeBlockEntity sourceNode, Storage<ItemVar
}

private boolean transferBetween(PastelNodeBlockEntity sourceNode, Storage<ItemVariant> sourceStorage, PastelNodeBlockEntity destinationNode, Storage<ItemVariant> destinationStorage, TransferMode transferMode) {
Predicate<ItemVariant> filter = sourceNode.getTransferFilterTo(destinationNode);

try (Transaction transaction = Transaction.openOuter()) {
for (StorageView<ItemVariant> view : sourceStorage) {
if (view.isResourceBlank()) {
continue;
}

ItemVariant storedResource = view.getResource(); // Current resource
if (storedResource.isBlank()) {
if (storedResource.isBlank() || !filter.test(storedResource)) {
continue;
}

long storedAmount = view.getAmount();
if (storedAmount <= 0) {
continue;

0 comments on commit 3ca00bd

Please sign in to comment.