aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-10-13 22:00:04 +0200
committerLinnea Gräf <nea@nea.moe>2024-10-13 22:00:04 +0200
commita40c50b99186d425b3fcf42336940c29b97a8219 (patch)
tree9dc513cfdb3362edac4e069bf7c19b29b285858d
parent4e9b0ded27df8b6ce7f5b2fa1b4b1ddbc1cbd452 (diff)
downloadfirmament-a40c50b99186d425b3fcf42336940c29b97a8219.tar.gz
firmament-a40c50b99186d425b3fcf42336940c29b97a8219.tar.bz2
firmament-a40c50b99186d425b3fcf42336940c29b97a8219.zip
Add completed commission highlight
-rw-r--r--src/main/kotlin/features/mining/CommissionFeatures.kt29
-rw-r--r--src/main/resources/assets/firmament/lang/en_us.json2
-rw-r--r--src/main/resources/assets/firmament/textures/gui/sprites/completed_commission_background.pngbin0 -> 558 bytes
3 files changed, 31 insertions, 0 deletions
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"))
+ )
+ }
+ }
+}
diff --git a/src/main/resources/assets/firmament/lang/en_us.json b/src/main/resources/assets/firmament/lang/en_us.json
index 8e8478b..eb0e551 100644
--- a/src/main/resources/assets/firmament/lang/en_us.json
+++ b/src/main/resources/assets/firmament/lang/en_us.json
@@ -76,6 +76,8 @@
"firmament.config.configconfig.enable-yacl": "Use YACL Config",
"firmament.config.repo.branch": "Repo Branch",
"firmament.config.configconfig": "Firmaments Config",
+ "firmament.config.commissions": "Commissions",
+ "firmament.config.commissions.highlight-completed": "Highlight Completed",
"firmament.config.repo.branch.hint": "dangerous",
"firmament.config.repo.reset": "Reset",
"firmament.config.repo.disable-item-groups": "Disable Item Groups",
diff --git a/src/main/resources/assets/firmament/textures/gui/sprites/completed_commission_background.png b/src/main/resources/assets/firmament/textures/gui/sprites/completed_commission_background.png
new file mode 100644
index 0000000..a19f227
--- /dev/null
+++ b/src/main/resources/assets/firmament/textures/gui/sprites/completed_commission_background.png
Binary files differ