aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/mining/CommissionFeatures.kt
blob: d1b501e24f4b789b8ea0a4df3a6fe91ee2076790 (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
package moe.nea.firmament.features.mining

import net.minecraft.util.Identifier
import moe.nea.firmament.annotations.Subscribe
import moe.nea.firmament.events.SlotRenderEvents
import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.mc.loreAccordingToNbt
import moe.nea.firmament.util.unformattedString

object CommissionFeatures {
	object Config : ManagedConfig("commissions", Category.MINING) {
		val highlightCompletedCommissions by toggle("highlight-completed") { true }
	}


	@Subscribe
	fun onSlotRender(event: SlotRenderEvents.Before) {
		if (!Config.highlightCompletedCommissions) return
		if (MC.screenName != "Commissions") return
		val stack = event.slot.stack
		if(stack.loreAccordingToNbt.any { it.unformattedString == "COMPLETED" }) {
			event.context.drawSprite(
				event.slot.x, event.slot.y, 0, 16, 16,
				MC.guiAtlasManager.getSprite(Identifier.of("firmament:completed_commission_background"))
			)
		}
	}
}