From 8c66016bb3041793961375178d470546519e0e69 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sat, 18 May 2024 17:33:19 +0200 Subject: Add more screens at once [no changelog] --- .../firmament/features/texturepack/CustomGlobalTextures.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament/features/texturepack/CustomGlobalTextures.kt') diff --git a/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomGlobalTextures.kt b/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomGlobalTextures.kt index 2eb4ee1..c2a003a 100644 --- a/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomGlobalTextures.kt +++ b/src/main/kotlin/moe/nea/firmament/features/texturepack/CustomGlobalTextures.kt @@ -33,6 +33,7 @@ import moe.nea.firmament.events.subscription.SubscriptionOwner import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.util.IdentifierSerializer import moe.nea.firmament.util.MC +import moe.nea.firmament.util.json.SingletonSerializableList import moe.nea.firmament.util.runNull object CustomGlobalTextures : SinglePreparationResourceReloader(), @@ -46,7 +47,7 @@ object CustomGlobalTextures : SinglePreparationResourceReloader, val model: Identifier, val predicate: FirmamentModelPredicate, ) @@ -107,7 +108,8 @@ object CustomGlobalTextures : SinglePreparationResourceReloader override.screen.toSet().map { it to override } } + .groupBy { it.first } val guiClasses = byGuiClass.entries .mapNotNull { val key = it.key @@ -123,7 +125,7 @@ object CustomGlobalTextures : SinglePreparationResourceReloader = listOf() + var matchingOverrides: Set = setOf() @Subscribe fun onOpenGui(event: ScreenChangeEvent) { val newTitle = event.new?.title matchingOverrides = - if (newTitle == null) listOf() - else guiClassOverrides.classes.filter { it.screenFilter.title.matches(newTitle) } + if (newTitle == null) setOf() + else guiClassOverrides.classes.filterTo(mutableSetOf()) { it.screenFilter.title.matches(newTitle) } } @JvmStatic -- cgit