From a40c50b99186d425b3fcf42336940c29b97a8219 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 13 Oct 2024 22:00:04 +0200 Subject: Add completed commission highlight --- .../kotlin/features/mining/CommissionFeatures.kt | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/kotlin/features/mining/CommissionFeatures.kt (limited to 'src/main/kotlin/features/mining') diff --git a/src/main/kotlin/features/mining/CommissionFeatures.kt b/src/main/kotlin/features/mining/CommissionFeatures.kt new file mode 100644 index 0000000..d1b501e --- /dev/null +++ b/src/main/kotlin/features/mining/CommissionFeatures.kt @@ -0,0 +1,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")) + ) + } + } +} -- cgit