aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-11-08 22:02:10 +0100
committerLinnea Gräf <nea@nea.moe>2024-11-08 22:02:10 +0100
commit0e1ddd2c913656a631e26dd0c560f25179a7dc2d (patch)
tree4b4ed01165aa51c23115333dec20075473f4e8c6 /src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt
parentf6f8fef556e74f24187ad2a6296f573024a378b3 (diff)
downloadFirmament-0e1ddd2c913656a631e26dd0c560f25179a7dc2d.tar.gz
Firmament-0e1ddd2c913656a631e26dd0c560f25179a7dc2d.tar.bz2
Firmament-0e1ddd2c913656a631e26dd0c560f25179a7dc2d.zip
Fix missing tags in REI renderingupdate
Diffstat (limited to 'src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt')
-rw-r--r--src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt b/src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt
new file mode 100644
index 0000000..fd0c750
--- /dev/null
+++ b/src/main/kotlin/repo/recipes/SBCraftingRecipeRenderer.kt
@@ -0,0 +1,50 @@
+package moe.nea.firmament.repo.recipes
+
+import io.github.moulberry.repo.NEURepository
+import io.github.moulberry.repo.data.NEUCraftingRecipe
+import me.shedaniel.math.Point
+import me.shedaniel.math.Rectangle
+import net.minecraft.block.Blocks
+import net.minecraft.item.ItemStack
+import net.minecraft.text.Text
+import net.minecraft.util.Identifier
+import moe.nea.firmament.Firmament
+import moe.nea.firmament.repo.SBItemStack
+import moe.nea.firmament.util.tr
+
+class 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)
+ for (i in 0 until 3) {
+ for (j in 0 until 3) {
+ val item = recipe.inputs[i + j * 3]
+ layouter.createItemSlot(point.x + 1 + i * 18,
+ point.y + 1 + j * 18,
+ SBItemStack(item),
+ RecipeLayouter.SlotKind.SMALL_INPUT)
+ }
+ }
+ layouter.createItemSlot(
+ point.x + 95, point.y + 19,
+ SBItemStack(recipe.output),
+ RecipeLayouter.SlotKind.BIG_OUTPUT
+ )
+ }
+
+ override fun getInputs(recipe: NEUCraftingRecipe): Collection<SBItemStack> {
+ return recipe.allInputs.mapNotNull { SBItemStack(it) }
+ }
+
+ override fun getOutputs(recipe: NEUCraftingRecipe): Collection<SBItemStack> {
+ return SBItemStack(recipe.output)?.let(::listOf) ?: emptyList()
+ }
+
+ override fun findAllRecipes(neuRepository: NEURepository): Iterable<NEUCraftingRecipe> {
+ return neuRepository.items.items.values.flatMap { it.recipes }.filterIsInstance<NEUCraftingRecipe>()
+ }
+
+ override val icon: ItemStack = ItemStack(Blocks.CRAFTING_TABLE)
+ override val title: Text = tr("firmament.category.crafting", "SkyBlock Crafting")
+ override val identifier: Identifier = Firmament.identifier("crafting_recipe")
+}