diff options
author | Empa <42304516+ItsEmpa@users.noreply.github.com> | 2024-08-11 13:44:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-11 13:44:16 +0200 |
commit | 4482c2ac717340d6e80f24df9e4ac6cfb65a1d05 (patch) | |
tree | 508b916d62dcc7329c2b818a0e32544434b3a811 /src/main/java/at/hannibal2/skyhanni | |
parent | 8903d9fa783455558d20eb32a2038c87ab5913be (diff) | |
download | skyhanni-4482c2ac717340d6e80f24df9e4ac6cfb65a1d05.tar.gz skyhanni-4482c2ac717340d6e80f24df9e4ac6cfb65a1d05.tar.bz2 skyhanni-4482c2ac717340d6e80f24df9e4ac6cfb65a1d05.zip |
Feature: Splatter Hearts (#2318)
Co-authored-by: ItsEmpa <itsempa@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
2 files changed, 55 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/stillgorechateau/StillgoreChateauConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/stillgorechateau/StillgoreChateauConfig.java index eee9e2c69..2ea71f610 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/stillgorechateau/StillgoreChateauConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/rift/area/stillgorechateau/StillgoreChateauConfig.java @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.config.features.rift.area.stillgorechateau; import com.google.gson.annotations.Expose; import io.github.notenoughupdates.moulconfig.annotations.Accordion; +import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; public class StillgoreChateauConfig { @@ -11,4 +12,9 @@ public class StillgoreChateauConfig { @Accordion public EffigiesConfig bloodEffigies = new EffigiesConfig(); + @Expose + @ConfigOption(name = "Highlight Splatter Hearts", desc = "Highlight heart particles of hearts removed by Splatter Cruxes.") + @ConfigEditorBoolean + public boolean highlightSplatterHearts = true; + } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/SplatterHearts.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/SplatterHearts.kt new file mode 100644 index 000000000..cd4059437 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/stillgorechateau/SplatterHearts.kt @@ -0,0 +1,49 @@ +package at.hannibal2.skyhanni.features.rift.area.stillgorechateau + +import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent +import at.hannibal2.skyhanni.events.ReceiveParticleEvent +import at.hannibal2.skyhanni.features.rift.RiftAPI +import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule +import at.hannibal2.skyhanni.utils.LorenzColor +import at.hannibal2.skyhanni.utils.LorenzVec +import at.hannibal2.skyhanni.utils.RenderUtils.drawFilledBoundingBox_nea +import at.hannibal2.skyhanni.utils.SimpleTimeMark +import net.minecraft.util.EnumParticleTypes +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.milliseconds + +@SkyHanniModule +object SplatterHearts { + private val config get() = RiftAPI.config.area.stillgoreChateau + private var lastHearts = SimpleTimeMark.farPast() + + private var shownHearts = setOf<LorenzVec>() + private val currentHearts = mutableSetOf<LorenzVec>() + + @SubscribeEvent + fun onParticle(event: ReceiveParticleEvent) { + if (!isEnabled()) return + if (event.type != EnumParticleTypes.HEART) return + if (event.count != 3 || event.speed != 0f) return + + if (lastHearts.passedSince() > 50.milliseconds) { + shownHearts = currentHearts + currentHearts.clear() + } + lastHearts = SimpleTimeMark.now() + currentHearts += event.location + } + + @SubscribeEvent + fun onRenderWorld(event: LorenzRenderWorldEvent) { + if (!isEnabled()) return + if (lastHearts.passedSince() > 300.milliseconds) return + shownHearts.forEach { + val pos = it.add(-0.5, 0.3, -0.5) + val aabb = pos.axisAlignedTo(pos.add(1, 1, 1)) + event.drawFilledBoundingBox_nea(aabb, LorenzColor.RED.addOpacity(100)) + } + } + + private fun isEnabled() = RiftAPI.inRift() && RiftAPI.inStillgoreChateau() && config.highlightSplatterHearts +} |