From 9038003f2f9749b4825f0ac403db04a4bfe7d15b Mon Sep 17 00:00:00 2001
From: DBotThePony <dbotthepony@yandex.ru>
Date: Thu, 6 Mar 2025 21:48:38 +0700
Subject: [PATCH] Fix error in loop logic in Matter scanner

---
 .../mc/otm/block/entity/matter/MatterScannerBlockEntity.kt      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt
index d57799340..2378e78ce 100644
--- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt
+++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterScannerBlockEntity.kt
@@ -119,7 +119,7 @@ class MatterScannerBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
 		var findState: PatternState? = null
 
 		for (state in matterNode.graph.patterns.filter { it.item === stack.item }) {
-			if (state.researchPercent < 1.0) {
+			if (state.researchPercent < 1.0 && findState == null) {
 				findState = state
 			} else if (state.researchPercent >= 1.0) {
 				return JobContainer.noItem()