aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-07 22:32:13 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-01-07 22:32:13 +0100
commit204bef3f09e51c88b655e80faa13bb52357d0ff8 (patch)
treef29ce1397e4a886935a56eeb0d3f3cd3151236b2 /src/main/java/at/hannibal2/skyhanni/features
parent6c19d8e279079879e065e586ee5cc86e7ef74b70 (diff)
downloadskyhanni-204bef3f09e51c88b655e80faa13bb52357d0ff8.tar.gz
skyhanni-204bef3f09e51c88b655e80faa13bb52357d0ff8.tar.bz2
skyhanni-204bef3f09e51c88b655e80faa13bb52357d0ff8.zip
Fixed an error when showing all elements in Powder Tracker.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
index ce5a8dd48..be35e0e55 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/mining/powdertracker/PowderTracker.kt
@@ -18,6 +18,8 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatNumber
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker
import at.hannibal2.skyhanni.utils.tracker.TrackerData
+import com.google.gson.JsonArray
+import com.google.gson.JsonNull
import com.google.gson.annotations.Expose
import net.minecraft.entity.boss.BossStatus
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -178,10 +180,24 @@ object PowderTracker {
event.transform(11, "mining.powderTracker.textFormat") { element ->
ConfigUtils.migrateIntArrayListToEnumArrayList(element, PowderDisplayEntry::class.java)
}
+
+ event.transform(20, "mining.powderTracker.textFormat") { element ->
+ val newList = JsonArray()
+ for (entry in element.asJsonArray) {
+ if (entry is JsonNull) continue
+ if (entry.asString.let { it != "TITLE" && it != "DISPLAY_MODE" }) {
+ newList.add(entry)
+ }
+ }
+ newList
+ }
}
- private fun formatDisplay(map: List<List<Any>>) = buildList {
+ private fun formatDisplay(map: List<List<Any>>) = buildList<List<Any>> {
if (map.isEmpty()) return@buildList
+
+ addAsSingletonList("§b§lPowder Tracker")
+
for (index in config.textFormat.get()) {
// TODO, change functionality to use enum rather than ordinals
add(map[index.ordinal])
@@ -195,12 +211,6 @@ object PowderTracker {
calculate(data, goldEssenceInfo, PowderChestReward.GOLD_ESSENCE)
calculateChest(data)
- addAsSingletonList("§b§lPowder Tracker")
-
- if (!tracker.isInventoryOpen()) {
- addAsSingletonList("")
- }
-
val chestPerHour = format(chestInfo.perHour)
addAsSingletonList("§d${data.totalChestPicked.addSeparators()} Total Chests Picked §7($chestPerHour/h)")
addAsSingletonList("§bDouble Powder: ${if (doublePowder) "§aActive! §7($powderTimer)" else "§cInactive!"}")