aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/repo/recipes/RecipeLayouter.kt
blob: b211d9c389a5d04369d96624e52b548006be314d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package moe.nea.firmament.repo.recipes

import io.github.notenoughupdates.moulconfig.gui.GuiComponent
import me.shedaniel.math.Point
import me.shedaniel.math.Rectangle
import net.minecraft.network.chat.Component
import net.minecraft.world.entity.Entity
import net.minecraft.world.entity.LivingEntity
import net.minecraft.world.entity.npc.Villager
import moe.nea.firmament.repo.SBItemStack

interface RecipeLayouter {
	enum class SlotKind {
		SMALL_INPUT,
		SMALL_OUTPUT,

		/**
		 * Create a bigger background and mark the slot as output. The coordinates should still refer the upper left corner of the item stack, not of the bigger background.
		 */
		BIG_OUTPUT,
		DISPLAY,
	}


	fun createCyclingItemSlot(
		x: Int, y: Int,
		content: List<SBItemStack>,
		slotKind: SlotKind
	): CyclingItemSlot

	fun createItemSlot(
		x: Int, y: Int,
		content: SBItemStack?,
		slotKind: SlotKind,
	): ItemSlot

	interface CyclingItemSlot : ItemSlot {
		fun onUpdate(action: () -> Unit)
	}

	interface ItemSlot : Updater<SBItemStack> {
		fun current(): SBItemStack
	}

	interface Updater<T> {
		fun update(newValue: T)
	}

	fun createTooltip(rectangle: Rectangle, label: List<Component>)
	fun createTooltip(rectangle: Rectangle, vararg label: Component) =
		createTooltip(rectangle, label.toList())


	fun createLabel(
		x: Int, y: Int,
		text: Component
	): Updater<Component>

	fun createArrow(x: Int, y: Int): Rectangle

	fun createMoulConfig(x: Int, y: Int, w: Int, h: Int, component: GuiComponent)
	fun createFire(ingredientsCenter: Point, animationTicks: Int)
	fun createEntity(rectangle: Rectangle, entity: LivingEntity)
}