aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/rei/SkyblockCraftingRecipeDynamicGenerator.kt
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-05-16 01:23:43 +0200
committernea <nea@nea.moe>2023-05-16 01:23:43 +0200
commitead6762eb1c005914b05f9d3c29f334989c67513 (patch)
treecd1409756be2bc4a93195c31d432fef053afe002 /src/main/kotlin/moe/nea/notenoughupdates/rei/SkyblockCraftingRecipeDynamicGenerator.kt
parent96c546cc73880a7c502c17aadda6ca84c847692d (diff)
downloadfirmament-ead6762eb1c005914b05f9d3c29f334989c67513.tar.gz
firmament-ead6762eb1c005914b05f9d3c29f334989c67513.tar.bz2
firmament-ead6762eb1c005914b05f9d3c29f334989c67513.zip
Replace references to NEU with Firmament
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/rei/SkyblockCraftingRecipeDynamicGenerator.kt')
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/rei/SkyblockCraftingRecipeDynamicGenerator.kt52
1 files changed, 0 insertions, 52 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/rei/SkyblockCraftingRecipeDynamicGenerator.kt b/src/main/kotlin/moe/nea/notenoughupdates/rei/SkyblockCraftingRecipeDynamicGenerator.kt
deleted file mode 100644
index cc31427..0000000
--- a/src/main/kotlin/moe/nea/notenoughupdates/rei/SkyblockCraftingRecipeDynamicGenerator.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package moe.nea.notenoughupdates.rei
-
-import io.github.moulberry.repo.data.NEUCraftingRecipe
-import io.github.moulberry.repo.data.NEUForgeRecipe
-import io.github.moulberry.repo.data.NEUItem
-import io.github.moulberry.repo.data.NEURecipe
-import java.util.*
-import me.shedaniel.rei.api.client.registry.display.DynamicDisplayGenerator
-import me.shedaniel.rei.api.client.view.ViewSearchBuilder
-import me.shedaniel.rei.api.common.display.Display
-import me.shedaniel.rei.api.common.entry.EntryStack
-import moe.nea.notenoughupdates.recipes.SBCraftingRecipe
-import moe.nea.notenoughupdates.recipes.SBForgeRecipe
-import moe.nea.notenoughupdates.repo.RepoManager
-import moe.nea.notenoughupdates.util.skyblockId
-
-
-val SkyblockCraftingRecipeDynamicGenerator = neuDisplayGenerator<SBCraftingRecipe, NEUCraftingRecipe> {
- SBCraftingRecipe(it)
-}
-
-val SkyblockForgeRecipeDynamicGenerator = neuDisplayGenerator<SBForgeRecipe, NEUForgeRecipe> {
- SBForgeRecipe(it)
-}
-
-inline fun <D : Display, reified T : NEURecipe> neuDisplayGenerator(noinline mapper: (T) -> D) =
- object : DynamicDisplayGenerator<D> {
- override fun getRecipeFor(entry: EntryStack<*>): Optional<List<D>> {
- if (entry.type != SBItemEntryDefinition.type) return Optional.empty()
- val item = entry.castValue<NEUItem>()
- val recipes = RepoManager.getRecipesFor(item.skyblockId)
- val craftingRecipes = recipes.filterIsInstance<T>()
- return Optional.of(craftingRecipes.map(mapper))
- }
-
- override fun generate(builder: ViewSearchBuilder): Optional<List<D>> {
- if (SBCraftingRecipe.Category.catIdentifier !in builder.categories) return Optional.empty()
- return Optional.of(
- RepoManager.getAllRecipes().filterIsInstance<T>().map(mapper)
- .toList()
- )
- }
-
- override fun getUsageFor(entry: EntryStack<*>): Optional<List<D>> {
- if (entry.type != SBItemEntryDefinition.type) return Optional.empty()
- val item = entry.castValue<NEUItem>()
- val recipes = RepoManager.getUsagesFor(item.skyblockId)
- val craftingRecipes = recipes.filterIsInstance<T>()
- return Optional.of(craftingRecipes.map(mapper))
-
- }
- }