diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-05 16:20:01 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-07-05 16:20:01 +0200 |
commit | 0d284cf02fb68873212e5b394ebeb3509370cbfb (patch) | |
tree | 635bac8dee24890ec58f5a2aa53462b56891359f /src/main/java/at | |
parent | 69564669dba7bd147d94d4dd68e32ab07bc64ce0 (diff) | |
download | skyhanni-0d284cf02fb68873212e5b394ebeb3509370cbfb.tar.gz skyhanni-0d284cf02fb68873212e5b394ebeb3509370cbfb.tar.bz2 skyhanni-0d284cf02fb68873212e5b394ebeb3509370cbfb.zip |
Added Lava Maze
Diffstat (limited to 'src/main/java/at')
5 files changed, 118 insertions, 11 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 4dac5f6c7..2d2189823 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -318,6 +318,7 @@ class SkyHanniMod { loadModule(LaserParkour()) loadModule(CustomTextBox()) loadModule(RiftUpsideDownParkour()) + loadModule(RiftLavaMazeParkour()) init() diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java index 3a54bfff7..60593471d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/DevConfig.java @@ -69,7 +69,7 @@ public class DevConfig { @ConfigAccordionId(id = 0) public boolean highlightMissingRepo = false; - @ConfigOption(name = "Parcour Waypoints", desc = "") + @ConfigOption(name = "Parkour Waypoints", desc = "") @Accordion @Expose public Waypoints waypoint = new Waypoints(); 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 a728bbb2f..030a2b68e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java @@ -169,6 +169,39 @@ public class RiftConfig { public static class MirrorVerse { + @ConfigOption(name = "Lava Maze", desc = "") + @Accordion + @Expose + public LavaMazeConfig lavaMazeConfig = new LavaMazeConfig(); + + public static class LavaMazeConfig { + + @Expose + @ConfigOption(name = "Enabled", desc = "Helps solving the lava maze in the mirror verse by showing the correct way.") + @ConfigEditorBoolean + public boolean enabled = true; + + @Expose + @ConfigOption(name = "Look Ahead", desc = "Change how many platforms should be shown in front of you.") + @ConfigEditorSlider(minStep = 1, maxValue = 30, minValue = 1) + public Property<Integer> lookAhead = Property.of(3); + + @Expose + @ConfigOption(name = "Rainbow Color", desc = "Show the rainbow color effect instead of a boring monochrome.") + @ConfigEditorBoolean + public Property<Boolean> rainbowColor = Property.of(true); + + @Expose + @ConfigOption(name = "Monochrome Color", desc = "Set a boring monochrome color for the parkour platforms.") + @ConfigEditorColour + public Property<String> monochromeColor = Property.of("0:60:0:0:255"); + + @Expose + @ConfigOption(name = "Hide others players", desc = "Hide other players while doing the lava maze.") + @ConfigEditorBoolean + public boolean hidePlayers = false; + } + @ConfigOption(name = "Dance Room Helper", desc = "") @Accordion @Expose @@ -198,7 +231,6 @@ public class RiftConfig { @Expose public Position position = new Position(442, 239, false, true); - } @ConfigOption(name = "Upside Down Parkour", desc = "") diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLavaMazeParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLavaMazeParkour.kt new file mode 100644 index 000000000..20029f9b7 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/RiftLavaMazeParkour.kt @@ -0,0 +1,75 @@ +package at.hannibal2.skyhanni.features.rift + +import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.CheckRenderEntityEvent +import at.hannibal2.skyhanni.events.ConfigLoadEvent +import at.hannibal2.skyhanni.events.LorenzChatEvent +import at.hannibal2.skyhanni.events.RepositoryReloadEvent +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.toChromaColor +import at.hannibal2.skyhanni.utils.ParkourHelper +import at.hannibal2.skyhanni.utils.jsonobjects.ParkourJson +import net.minecraftforge.client.event.RenderWorldLastEvent +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent + +class RiftLavaMazeParkour { + private val config get() = SkyHanniMod.feature.rift.mirrorVerse.lavaMazeConfig + private var parkourHelper: ParkourHelper? = null + + @SubscribeEvent + fun onRepoReload(event: RepositoryReloadEvent) { + val data = event.getConstant<ParkourJson>("RiftLavaMazeParkour") ?: return + parkourHelper = ParkourHelper( + data.locations, + data.shortCuts, + platformSize = 1.0, + detectionRange = 1.0 + ) + updateConfig() + } + + @SubscribeEvent + fun onCheckRender(event: CheckRenderEntityEvent<*>) { + if (!isEnabled()) return + if (!config.hidePlayers) return + + parkourHelper?.let { + if (it.inParkour()) { + event.isCanceled = true + } + } + } + + @SubscribeEvent + fun onChatMessage(event: LorenzChatEvent) { + if (!isEnabled()) return + + if (event.message == "§c§lEEK! THE LAVA OOFED YOU!") { + parkourHelper?.reset() + } + } + + @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + LorenzUtils.onToggle(config.rainbowColor, config.monochromeColor, config.lookAhead) { + updateConfig() + } + } + + private fun updateConfig() { + parkourHelper?.run { + rainbowColor = config.rainbowColor.get() + monochromeColor = config.monochromeColor.get().toChromaColor() + lookAhead = config.lookAhead.get() + 1 + } + } + + @SubscribeEvent + fun onRenderWorld(event: RenderWorldLastEvent) { + if (!isEnabled()) return + + parkourHelper?.render(event) + } + + fun isEnabled() = RiftAPI.inRift() && LorenzUtils.skyBlockArea == "Mirrorverse" && config.enabled +} diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt index 531cc59b1..fd74c5d0c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt @@ -89,15 +89,14 @@ class ParkourHelper( val nextShortcuts = current until current + lookAhead for (shortCut in shortCuts) { if (shortCut.from in nextShortcuts && shortCut.to in locations.indices) { - event.draw3DLine( - locations[shortCut.from].offsetCenter(), - locations[shortCut.to].offsetCenter(), - Color.RED, - 3, - false - ) - event.drawFilledBoundingBox(axisAlignedBB(locations[shortCut.to]), Color.RED, 1f) - event.drawDynamicText(locations[shortCut.to].add(-0.5, 1.0, -0.5), "§cShortcut", 2.5) + val from = locations[shortCut.from].offsetCenter() + val to = locations[shortCut.to].offsetCenter() + event.draw3DLine(from, to, Color.RED, 3, false) + + val aabb = axisAlignedBB(locations[shortCut.to]) + event.drawFilledBoundingBox(aabb, Color.RED, 1f) + val textLocation = from.add(to.subtract(from).normalize()) + event.drawDynamicText(textLocation.add(-0.5, 1.0, -0.5), "§cShortcut", 1.8) } } |