From c7143936d7a1bf3ae49362049541b2d23b11ab8c Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Wed, 24 Jul 2024 02:22:30 +0200 Subject: Add essence upgrade recipes --- src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt') diff --git a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt index f556a8b..179b720 100644 --- a/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt +++ b/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt @@ -1,5 +1,6 @@ /* * SPDX-FileCopyrightText: 2023 Linnea Gräf + * SPDX-FileCopyrightText: 2024 Linnea Gräf * * SPDX-License-Identifier: GPL-3.0-or-later */ @@ -28,12 +29,12 @@ object RepoManager { object Config : ManagedConfig("repo") { var username by string("username") { "NotEnoughUpdates" } var reponame by string("reponame") { "NotEnoughUpdates-REPO" } - var branch by string("branch") { "prerelease" } + var branch by string("branch") { "master" } val autoUpdate by toggle("autoUpdate") { true } val reset by button("reset") { username = "NotEnoughUpdates" reponame = "NotEnoughUpdates-REPO" - branch = "prerelease" + branch = "master" save() } @@ -66,12 +67,17 @@ object RepoManager { } } - private val recipeCache = NEURecipeCache.forRepo(neuRepo) + val essenceRecipeProvider = EssenceRecipeProvider() + val recipeCache = BetterRepoRecipeCache(essenceRecipeProvider) + init { + neuRepo.registerReloadListener(essenceRecipeProvider) + neuRepo.registerReloadListener(recipeCache) + } fun getAllRecipes() = neuRepo.items.items.values.asSequence().flatMap { it.recipes } - fun getRecipesFor(skyblockId: SkyblockId): Set = recipeCache.recipes[skyblockId.neuItem] ?: setOf() - fun getUsagesFor(skyblockId: SkyblockId): Set = recipeCache.usages[skyblockId.neuItem] ?: setOf() + fun getRecipesFor(skyblockId: SkyblockId): Set = recipeCache.recipes[skyblockId] ?: setOf() + fun getUsagesFor(skyblockId: SkyblockId): Set = recipeCache.usages[skyblockId] ?: setOf() private fun trySendClientboundUpdateRecipesPacket(): Boolean { return MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().networkHandler?.onSynchronizeRecipes( -- cgit