aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-25 03:36:16 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-25 03:36:16 +0200
commit4acfc5313cb68d28167c4fe4c91ad7666befc677 (patch)
treeabe83581a533a06d8063601d3142059a1c344f92 /src/main/java/at/hannibal2/skyhanni/data
parente2c7746ab27d8abdfef3e93743ed243a68469192 (diff)
downloadskyhanni-4acfc5313cb68d28167c4fe4c91ad7666befc677.tar.gz
skyhanni-4acfc5313cb68d28167c4fe4c91ad7666befc677.tar.bz2
skyhanni-4acfc5313cb68d28167c4fe4c91ad7666befc677.zip
Show locations of inactive Blood Effigy
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt11
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt22
2 files changed, 22 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
index 20d6f4d5c..340e3b621 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/MinecraftData.kt
@@ -1,14 +1,12 @@
package at.hannibal2.skyhanni.data
-import at.hannibal2.skyhanni.events.LorenzTickEvent
-import at.hannibal2.skyhanni.events.PacketEvent
-import at.hannibal2.skyhanni.events.PlaySoundEvent
-import at.hannibal2.skyhanni.events.ReceiveParticleEvent
+import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import net.minecraft.client.Minecraft
import net.minecraft.network.play.server.S29PacketSoundEffect
import net.minecraft.network.play.server.S2APacketParticles
+import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
@@ -32,6 +30,11 @@ class MinecraftData {
}
}
+ @SubscribeEvent
+ fun onWorldLoad(event: WorldEvent.Load) {
+ LorenzWorldSwitchEvent().postAndCatch()
+ }
+
@SubscribeEvent(receiveCanceled = true)
fun onParticlePacketReceive(event: PacketEvent.ReceiveEvent) {
if (!LorenzUtils.inSkyBlock) return
diff --git a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
index 6da73b554..9602c1b59 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/ScoreboardData.kt
@@ -1,5 +1,7 @@
package at.hannibal2.skyhanni.data
+import at.hannibal2.skyhanni.events.ScoreboardChangeEvent
+import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent
import net.minecraft.client.Minecraft
import net.minecraft.scoreboard.Score
import net.minecraft.scoreboard.ScorePlayerTeam
@@ -37,9 +39,7 @@ class ScoreboardData {
if (end.length >= 2) {
end = end.substring(2)
}
-
list.add(start + end)
-
}
return list
@@ -47,9 +47,8 @@ class ScoreboardData {
var sidebarLinesFormatted: List<String> = emptyList()
- // TODO remove these two
- var sidebarLines: List<String> = emptyList()
- var sidebarLinesRaw: List<String> = emptyList()
+ var sidebarLines: List<String> = emptyList() // TODO rename to raw
+ var sidebarLinesRaw: List<String> = emptyList() // TODO delete
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
@@ -57,9 +56,18 @@ class ScoreboardData {
if (event.phase != TickEvent.Phase.START) return
val list = fetchScoreboardLines().reversed()
- sidebarLines = list.map { cleanSB(it) }
+ val semiFormatted = list.map { cleanSB(it) }
+ if (semiFormatted != sidebarLines) {
+ ScoreboardRawChangeEvent(sidebarLines, semiFormatted).postAndCatch()
+ sidebarLines = semiFormatted
+ }
+
sidebarLinesRaw = list
- sidebarLinesFormatted = formatLines(list)
+ val new = formatLines(list)
+ if (new != sidebarLinesFormatted) {
+ ScoreboardChangeEvent(sidebarLinesFormatted, new).postAndCatch()
+ sidebarLinesFormatted = new
+ }
}
private fun cleanSB(scoreboard: String): String {