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(); }