fixed node caches not being invalidated correctly for small networks

This commit is contained in:
Ellpeck 2020-04-19 22:04:39 +02:00
parent 34f037a8fd
commit 1865eaa8cb

View file

@ -295,6 +295,10 @@ public class PipeNetwork implements ICapabilitySerializable<CompoundNBT>, GraphL
public void clearDestinationCache(BlockPos... nodes) { public void clearDestinationCache(BlockPos... nodes) {
this.startProfile("clear_node_cache"); this.startProfile("clear_node_cache");
// remove caches for the nodes
for(BlockPos node : nodes)
this.nodeToConnectedNodes.keySet().remove(node);
// remove caches that contain the node as a destination
this.nodeToConnectedNodes.values().removeIf(cached -> Arrays.stream(nodes).anyMatch(cached::contains)); this.nodeToConnectedNodes.values().removeIf(cached -> Arrays.stream(nodes).anyMatch(cached::contains));
this.endProfile(); this.endProfile();
} }