aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-07-24 02:22:30 +0200
committerLinnea Gräf <nea@nea.moe>2024-07-24 02:22:30 +0200
commitc7143936d7a1bf3ae49362049541b2d23b11ab8c (patch)
tree4e905377b8abf56d1a9e253543a6d3a251f9da82 /src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt
parent4585a11434f44fa0900351825eb3ca38ce64f187 (diff)
downloadfirmament-c7143936d7a1bf3ae49362049541b2d23b11ab8c.tar.gz
firmament-c7143936d7a1bf3ae49362049541b2d23b11ab8c.tar.bz2
firmament-c7143936d7a1bf3ae49362049541b2d23b11ab8c.zip
Add essence upgrade recipes
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/repo/RepoManager.kt16
1 files changed, 11 insertions, 5 deletions
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 <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* 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<NEURecipe> = recipeCache.recipes[skyblockId.neuItem] ?: setOf()
- fun getUsagesFor(skyblockId: SkyblockId): Set<NEURecipe> = recipeCache.usages[skyblockId.neuItem] ?: setOf()
+ fun getRecipesFor(skyblockId: SkyblockId): Set<NEURecipe> = recipeCache.recipes[skyblockId] ?: setOf()
+ fun getUsagesFor(skyblockId: SkyblockId): Set<NEURecipe> = recipeCache.usages[skyblockId] ?: setOf()
private fun trySendClientboundUpdateRecipesPacket(): Boolean {
return MinecraftClient.getInstance().world != null && MinecraftClient.getInstance().networkHandler?.onSynchronizeRecipes(