diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java index a98d10e..df767ad 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java @@ -461,13 +461,13 @@ public class PipeNetwork implements ICapabilitySerializable, GraphL return ret; } - public void clearDestinationCache(BlockPos... nodes) { + public void clearDestinationCache(List nodes) { this.startProfile("clear_node_cache"); // remove caches for the nodes for (var node : nodes) this.nodeToConnectedNodes.keySet().remove(node); // remove caches that contain the nodes as a destination - this.nodeToConnectedNodes.values().removeIf(cached -> Arrays.stream(nodes).anyMatch(cached::contains)); + this.nodeToConnectedNodes.values().removeIf(cached -> nodes.stream().anyMatch(cached::contains)); this.endProfile(); } @@ -490,12 +490,12 @@ public class PipeNetwork implements ICapabilitySerializable, GraphL @Override public void edgeAdded(GraphEdgeChangeEvent e) { - this.clearDestinationCache(e.getEdgeSource(), e.getEdgeTarget()); + this.clearDestinationCache(e.getEdge().pipes); } @Override public void edgeRemoved(GraphEdgeChangeEvent e) { - this.clearDestinationCache(e.getEdgeSource(), e.getEdgeTarget()); + this.clearDestinationCache(e.getEdge().pipes); } @Override diff --git a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java index 7d29092..acb78a7 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeBlockEntity.java @@ -437,7 +437,7 @@ public class PipeBlockEntity extends BlockEntity implements MenuProvider, IPipeC if (prio != pipe.priority) { pipe.priority = prio; // clear the cache so that it's reevaluated based on priority - PipeNetwork.get(pipe.level).clearDestinationCache(pipe.worldPosition); + PipeNetwork.get(pipe.level).clearDestinationCache(Collections.singletonList(pipe.worldPosition)); } profiler.pop(); }