From 2f75a2c774f054b8b7d5fe03b7106df01c600483 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Wed, 30 Mar 2022 14:45:28 +0200 Subject: [PATCH] backport bf7760c5fb3e2957064cd07d756226c47bf38193 --- .../java/de/ellpeck/prettypipes/network/PipeNetwork.java | 8 ++++---- .../java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java index d8b873f..7d5323a 100644 --- a/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java +++ b/src/main/java/de/ellpeck/prettypipes/network/PipeNetwork.java @@ -464,13 +464,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 (BlockPos 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(); } @@ -493,12 +493,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/PipeTileEntity.java b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java index 68ea124..64b038c 100644 --- a/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java +++ b/src/main/java/de/ellpeck/prettypipes/pipe/PipeTileEntity.java @@ -180,7 +180,7 @@ public class PipeTileEntity extends TileEntity implements INamedContainerProvide if (prio != this.priority) { this.priority = prio; // clear the cache so that it's reevaluated based on priority - PipeNetwork.get(this.world).clearDestinationCache(this.pos); + PipeNetwork.get(this.world).clearDestinationCache(Collections.singletonList(this.pos)); } profiler.endSection(); }