From f925bd2a8d10d017a8aabb637ccd6546ad9cc123 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Fri, 9 May 2025 19:03:27 +0200 Subject: refactor: Make use of generic crafting recipe --- src/main/kotlin/repo/recipes/GenericRecipeRenderer.kt | 1 + src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/kotlin/repo/recipes/GenericRecipeRenderer.kt b/src/main/kotlin/repo/recipes/GenericRecipeRenderer.kt index 9a1aea5..6768b4e 100644 --- a/src/main/kotlin/repo/recipes/GenericRecipeRenderer.kt +++ b/src/main/kotlin/repo/recipes/GenericRecipeRenderer.kt @@ -16,4 +16,5 @@ interface GenericRecipeRenderer { val title: Text val identifier: Identifier fun findAllRecipes(neuRepository: NEURepository): Iterable + val typ: Class } diff --git a/src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt b/src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt index 679aec8..c02afcb 100644 --- a/src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt +++ b/src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt @@ -12,7 +12,7 @@ import moe.nea.firmament.Firmament import moe.nea.firmament.repo.SBItemStack import moe.nea.firmament.util.tr -class SBCraftingRecipeRenderer : GenericRecipeRenderer { +object SBCraftingRecipeRenderer : GenericRecipeRenderer { override fun render(recipe: NEUCraftingRecipe, bounds: Rectangle, layouter: RecipeLayouter) { val point = Point(bounds.centerX - 58, bounds.centerY - 27) layouter.createArrow(point.x + 60, point.y + 18) @@ -32,6 +32,9 @@ class SBCraftingRecipeRenderer : GenericRecipeRenderer { ) } + override val typ: Class + get() = NEUCraftingRecipe::class.java + override fun getInputs(recipe: NEUCraftingRecipe): Collection { return recipe.allInputs.mapNotNull { SBItemStack(it) } } -- cgit