From 4acfc5313cb68d28167c4fe4c91ad7666befc677 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 25 Jul 2023 03:36:16 +0200 Subject: Show locations of inactive Blood Effigy --- src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt | 4 + .../skyhanni/config/features/RiftConfig.java | 47 +++++-- .../at/hannibal2/skyhanni/data/MinecraftData.kt | 11 +- .../at/hannibal2/skyhanni/data/ScoreboardData.kt | 22 +++- .../skyhanni/events/LorenzWorldSwitchEvent.kt | 3 + .../skyhanni/events/ScoreboardChangeEvent.kt | 3 + .../skyhanni/events/ScoreboardRawChangeEvent.kt | 3 + .../area/stillgorechateau/RiftBloodEffigies.kt | 141 +++++++++++++++++++++ .../java/at/hannibal2/skyhanni/utils/TimeUtils.kt | 6 +- .../utils/jsonobjects/RiftEffingesJson.java | 11 ++ 10 files changed, 230 insertions(+), 21 deletions(-) create mode 100644 src/main/java/at/hannibal2/skyhanni/events/LorenzWorldSwitchEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/ScoreboardChangeEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/ScoreboardRawChangeEvent.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/RiftEffingesJson.java (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 29e1ce9b0..042dec43c 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -76,6 +76,7 @@ import at.hannibal2.skyhanni.features.rift.area.mirrorverse.DanceRoomHelper import at.hannibal2.skyhanni.features.rift.area.mirrorverse.RiftLavaMazeParkour import at.hannibal2.skyhanni.features.rift.area.mirrorverse.RiftUpsideDownParkour import at.hannibal2.skyhanni.features.rift.area.mirrorverse.TubulatorParkour +import at.hannibal2.skyhanni.features.rift.area.stillgorechateau.RiftBloodEffigies import at.hannibal2.skyhanni.features.rift.area.westvillage.KloonHacking import at.hannibal2.skyhanni.features.rift.area.wyldwoods.RiftOdonata import at.hannibal2.skyhanni.features.rift.area.wyldwoods.ShyCruxWarnings @@ -355,6 +356,9 @@ class SkyHanniMod { loadModule(LivingCaveLivingMetalHelper()) loadModule(RiftMotesOrb()) loadModule(SlayerBossSpawnSoon()) + // + loadModule(RiftBloodEffigies()) + init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java index 48882f49e..1585c390b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -525,14 +525,45 @@ public class RiftConfig { public boolean highlightBlobbercysts = true; } -// @Expose -// @ConfigOption(name = "Stillgore Chateau", desc = "") -// @Accordion -// public StillgoreChateauConfig stillgoreChateauConfig = new StillgoreChateauConfig(); -// -// public static class StillgoreChateauConfig { -// -// } + @Expose + @ConfigOption(name = "Stillgore Chateau", desc = "") + @Accordion + public StillgoreChateauConfig stillgoreChateauConfig = new StillgoreChateauConfig(); + + public static class StillgoreChateauConfig { + + @Expose + @ConfigOption(name = "Blood Effigies", desc = "") + @Accordion + public EffigiesConfig bloodEffigies = new EffigiesConfig(); + + public static class EffigiesConfig { + + @Expose + @ConfigOption(name = "Enabled", desc = "Show locations of inactive Blood Effigy.") + @ConfigEditorBoolean + public boolean enabled = false; + + @Expose + @ConfigOption(name = "Respawning Soon", desc = "Show effigies that are about to respawn.") + @ConfigEditorBoolean + public boolean respawningSoon = false; + + @Expose + @ConfigOption(name = "Respawning Time", desc = "Time before effigies respawn to show.") + @ConfigEditorSlider( + minValue = 1, + maxValue = 15, + minStep = 1 + ) + public int respwningSoonTime = 3; + + @Expose + @ConfigOption(name = "Unknown Times", desc = "Show effigies without known time.") + @ConfigEditorBoolean + public boolean unknownTime = false; + } + } // @Expose // @ConfigOption(name = "Mountaintop", desc = "") 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 = emptyList() - // TODO remove these two - var sidebarLines: List = emptyList() - var sidebarLinesRaw: List = emptyList() + var sidebarLines: List = emptyList() // TODO rename to raw + var sidebarLinesRaw: List = 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 { diff --git a/src/main/java/at/hannibal2/skyhanni/events/LorenzWorldSwitchEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/LorenzWorldSwitchEvent.kt new file mode 100644 index 000000000..503e0fd3c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/LorenzWorldSwitchEvent.kt @@ -0,0 +1,3 @@ +package at.hannibal2.skyhanni.events + +class LorenzWorldSwitchEvent() : LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardChangeEvent.kt new file mode 100644 index 000000000..c2976629f --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardChangeEvent.kt @@ -0,0 +1,3 @@ +package at.hannibal2.skyhanni.events + +class ScoreboardChangeEvent(val oldList: List, val newList: List): LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/events/ScoreboardRawChangeEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardRawChangeEvent.kt new file mode 100644 index 000000000..6f7301701 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/ScoreboardRawChangeEvent.kt @@ -0,0 +1,3 @@ +package at.hannibal2.skyhanni.events + +class ScoreboardRawChangeEvent(val oldList: List, val newList: List): LorenzEvent() \ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt new file mode 100644 index 000000000..9892be944 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/RiftBloodEffigies.kt @@ -0,0 +1,141 @@ +package at.hannibal2.skyhanni.features.rift.area.stillgorechateau + +import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.LorenzWorldSwitchEvent +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.events.ScoreboardRawChangeEvent +import at.hannibal2.skyhanni.features.rift.everywhere.RiftAPI +import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled +import at.hannibal2.skyhanni.utils.* +import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer +import at.hannibal2.skyhanni.utils.LorenzUtils.editCopy +import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText +import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher +import at.hannibal2.skyhanni.utils.jsonobjects.RiftEffingesJson +import net.minecraft.entity.item.EntityArmorStand +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class RiftBloodEffigies { + private val config get() = RiftAPI.config.area.stillgoreChateauConfig.bloodEffigies + private var locations: List = emptyList() + private var effingesTime = mapOf( + 0 to -1L, + 1 to -1L, + 2 to -1L, + 3 to -1L, + 4 to -1L, + 5 to -1L, + ) + + private val effigiesTimerPattern = "§eRespawn §c(?