aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-05-09 19:03:27 +0200
committerLinnea Gräf <nea@nea.moe>2025-05-09 22:03:42 +0200
commitf925bd2a8d10d017a8aabb637ccd6546ad9cc123 (patch)
tree967b13edc2ee26f368b948757a092c81d27dfb4d /src/main/kotlin
parent44c24712b71141ca6e1f28265d4ccd649dc1c893 (diff)
downloadFirmament-f925bd2a8d10d017a8aabb637ccd6546ad9cc123.tar.gz
Firmament-f925bd2a8d10d017a8aabb637ccd6546ad9cc123.tar.bz2
Firmament-f925bd2a8d10d017a8aabb637ccd6546ad9cc123.zip
refactor: Make use of generic crafting recipe
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/repo/recipes/GenericRecipeRenderer.kt1
-rw-r--r--src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt5
2 files changed, 5 insertions, 1 deletions
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<T : NEURecipe> {
val title: Text
val identifier: Identifier
fun findAllRecipes(neuRepository: NEURepository): Iterable<T>
+ val typ: Class<T>
}
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<NEUCraftingRecipe> {
+object SBCraftingRecipeRenderer : GenericRecipeRenderer<NEUCraftingRecipe> {
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<NEUCraftingRecipe> {
)
}
+ override val typ: Class<NEUCraftingRecipe>
+ get() = NEUCraftingRecipe::class.java
+
override fun getInputs(recipe: NEUCraftingRecipe): Collection<SBItemStack> {
return recipe.allInputs.mapNotNull { SBItemStack(it) }
}