From dfc35f393fef94ffd117ee16cc5b6737ebd9bf3d Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 25 Feb 2025 22:13:36 +0700 Subject: [PATCH] Add clearSlotFilters to IMatteryContainer --- .../mc/otm/container/CombinedContainer.kt | 13 +++++++++++++ .../mc/otm/container/IMatteryContainer.kt | 2 ++ .../mc/otm/container/MatteryContainer.kt | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/container/CombinedContainer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/container/CombinedContainer.kt index 76be00a2b..542ebb252 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/container/CombinedContainer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/container/CombinedContainer.kt @@ -90,6 +90,19 @@ class CombinedContainer(containers: Stream>>) : IM } } + override fun clearSlotFilters() { + for (container in fullCoverage) { + if (container is IMatteryContainer) + container.clearSlotFilters() + } + + for (slots in notFullCoverage.values) { + for (slot in slots) { + slot.setFilter() + } + } + } + override fun getContainerSize(): Int { return slots.size } diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/container/IMatteryContainer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/container/IMatteryContainer.kt index cb2dfce45..03644d292 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/container/IMatteryContainer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/container/IMatteryContainer.kt @@ -19,6 +19,8 @@ interface IMatteryContainer : IContainer, RecipeInput, Iterable { return false } + fun clearSlotFilters() + override fun isEmpty(): Boolean fun setChanged(slot: Int) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/container/MatteryContainer.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/container/MatteryContainer.kt index c201c6706..7cee2b9e7 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/container/MatteryContainer.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/container/MatteryContainer.kt @@ -81,7 +81,7 @@ open class MatteryContainer(var listener: ContainerListener, private val size: I var changeset = 0 private set - fun clearSlotFilters() { + override fun clearSlotFilters() { Arrays.fill(filters, null) }