From 89ca0fbce82948e3ef4332dac639dc9cba70a39c Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 11 Feb 2025 11:12:11 +0700 Subject: [PATCH] Improve cable path search performance when there are a lot of paths existing already --- .../mc/otm/block/entity/cable/EnergyCableGraph.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt index 867599c3b..6ab9b9646 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt @@ -426,6 +426,9 @@ class EnergyCableGraph : GraphNodeList() + existing.forEach { existingNodes.addAll(it.nodes) } + while (openNodes.isNotEmpty()) { val first = openNodes.remove() openNodes.remove(first) @@ -466,7 +469,7 @@ class EnergyCableGraph : GraphNodeList