aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-05 17:21:22 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-07-05 17:21:22 +0200
commite041b9205fed5b550a5e3e2986d68def6d14b6ca (patch)
treebcf40f611c69eec4be545f6f2ed87a9d98ebb352 /src/main/java/at
parent35f90f67e6e5c4f5a395e4ce9335388c998cde38 (diff)
downloadskyhanni-e041b9205fed5b550a5e3e2986d68def6d14b6ca.tar.gz
skyhanni-e041b9205fed5b550a5e3e2986d68def6d14b6ca.tar.bz2
skyhanni-e041b9205fed5b550a5e3e2986d68def6d14b6ca.zip
using ParkourHelper for TubulatorParkour
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java37
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt55
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/TubulatorParkour.kt70
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt18
5 files changed, 115 insertions, 67 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index fcb285960..12b607792 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -315,7 +315,7 @@ class SkyHanniMod {
loadModule(DungeonLividFinder)
loadModule(CruxTalismanDisplay)
loadModule(DanceRoomHelper)
- loadModule(LaserParkour())
+ loadModule(TubulatorParkour())
loadModule(CustomTextBox())
loadModule(RiftUpsideDownParkour())
loadModule(RiftLavaMazeParkour())
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 9e3107208..9464cd420 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
@@ -271,11 +271,42 @@ public class RiftConfig {
}
+ @ConfigOption(name = "Tubulator", desc = "")
+ @Accordion
@Expose
- @ConfigOption(name = "Tubulator", desc = "Highlights the location of the invisible blocks (Laser Parkour).")
- @ConfigEditorBoolean
- public boolean laserParkour = true;
+ public TubulatorConfig tubulatorConfig = new TubulatorConfig();
+ public static class TubulatorConfig {
+
+ @Expose
+ @ConfigOption(name = "Enabled", desc = "Highlights the location of the invisible Tubulator blocks (Laser Parkour).")
+ @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(2);
+
+ @Expose
+ @ConfigOption(name = "Outline", desc = "Outlines the top edge of the platforms.")
+ @ConfigEditorBoolean
+ public boolean outline = true;
+ @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 = "Kloon Hacking", desc = "")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt
deleted file mode 100644
index ff19e52fd..000000000
--- a/src/main/java/at/hannibal2/skyhanni/features/rift/LaserParkour.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package at.hannibal2.skyhanni.features.rift
-
-import at.hannibal2.skyhanni.SkyHanniMod
-import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
-import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside
-import at.hannibal2.skyhanni.utils.LorenzColor
-import at.hannibal2.skyhanni.utils.LorenzVec
-import net.minecraft.util.AxisAlignedBB
-import net.minecraftforge.client.event.RenderWorldLastEvent
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-class LaserParkour {
- private val config get() = SkyHanniMod.feature.rift.mirrorVerse
- private val puzzleRoom = AxisAlignedBB(-298.0, 0.0, -112.0, -309.0, 63.0, -101.0)
-
- @SubscribeEvent
- fun onRenderWorld(event: RenderWorldLastEvent) {
- if (!RiftAPI.inRift()) return
- if (!config.laserParkour) return
- if (!puzzleRoom.isPlayerInside()) return
- for (location in locations) {
- event.drawWaypointFilled(location, LorenzColor.GREEN.toColor())
- }
- }
-
- private var locations = mutableListOf(
- LorenzVec(-304.0, 2.0, -107.0),
- LorenzVec(-306.0, 4.0, -103.0),
- LorenzVec(-308.0, 6.0, -105.0),
- LorenzVec(-304.0, 8.0, -109.0),
- LorenzVec(-300.0, 10.0, -111.0),
- LorenzVec(-304.0, 12.0, -107.0),
- LorenzVec(-308.0, 14.0, -103.0),
- LorenzVec(-306.0, 16.0, -107.0),
- LorenzVec(-302.0, 18.0, -111.0),
- LorenzVec(-300.0, 20.0, -107.0),
- LorenzVec(-304.0, 22.0, -111.0),
- LorenzVec(-306.0, 24.0, -109.0),
- LorenzVec(-302.0, 26.0, -111.0),
- LorenzVec(-300.0, 28.0, -107.0),
- LorenzVec(-304.0, 30.0, -103.0),
- LorenzVec(-306.0, 32.0, -105.0),
- LorenzVec(-302.0, 34.0, -107.0),
- LorenzVec(-300.0, 36.0, -109.0),
- LorenzVec(-302.0, 38.0, -105.0),
- LorenzVec(-304.0, 40.0, -107.0),
- LorenzVec(-306.0, 42.0, -111.0),
- LorenzVec(-302.0, 44.0, -107.0),
- LorenzVec(-300.0, 46.0, -103.0),
- LorenzVec(-304.0, 48.0, -107.0),
- LorenzVec(-308.0, 50.0, -105.0),
- LorenzVec(-304.0, 52.0, -109.0),
- LorenzVec(-306.0, 54.0, -111.0)
- )
-} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/TubulatorParkour.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/TubulatorParkour.kt
new file mode 100644
index 000000000..5b476962b
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/TubulatorParkour.kt
@@ -0,0 +1,70 @@
+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.RepositoryReloadEvent
+import at.hannibal2.skyhanni.utils.LocationUtils.isPlayerInside
+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.minecraft.util.AxisAlignedBB
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class TubulatorParkour {
+ private val config get() = SkyHanniMod.feature.rift.mirrorVerse.tubulatorConfig
+ private var parkourHelper: ParkourHelper? = null
+ private val puzzleRoom = AxisAlignedBB(-298.0, 0.0, -112.0, -309.0, 63.0, -101.0)
+
+ @SubscribeEvent
+ fun onRepoReload(event: RepositoryReloadEvent) {
+ val data = event.getConstant<ParkourJson>("RiftTubulator") ?: return
+ parkourHelper = ParkourHelper(
+ data.locations,
+ data.shortCuts,
+ platformSize = 1.0,
+ detectionRange = 2.0,
+ )
+ updateConfig()
+ }
+
+ @SubscribeEvent
+ fun onCheckRender(event: CheckRenderEntityEvent<*>) {
+ if (!isEnabled()) return
+ if (!config.hidePlayers) return
+
+ parkourHelper?.let {
+ if (it.inParkour()) {
+ event.isCanceled = true
+ }
+ }
+ }
+
+ @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
+ outline = config.outline
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderWorld(event: RenderWorldLastEvent) {
+ if (!isEnabled()) return
+
+ parkourHelper?.render(event)
+ }
+
+ fun isEnabled() =
+ RiftAPI.inRift() && LorenzUtils.skyBlockArea == "Mirrorverse" && config.enabled && puzzleRoom.isPlayerInside()
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt
index 1c663ac52..73a529cbc 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ParkourHelper.kt
@@ -51,6 +51,16 @@ class ParkourHelper(
if (!showEverything) {
if (current == locations.size - 1) visible = false
+ if (visible) {
+ for ((index, location) in locations.withIndex()) {
+ if (location.offsetCenter().distanceToPlayer() < detectionRange) {
+ if (Minecraft.getMinecraft().thePlayer.onGround) {
+ current = index
+ }
+ }
+ }
+ }
+
val distanceToPlayer = locations.first().offsetCenter().distanceToPlayer()
if (distanceToPlayer < detectionRange) {
visible = true
@@ -62,14 +72,6 @@ class ParkourHelper(
if (!visible) return
- for ((index, location) in locations.withIndex()) {
- if (location.offsetCenter().distanceToPlayer() < detectionRange) {
- if (Minecraft.getMinecraft().thePlayer.onGround) {
- current = index
- }
- }
- }
-
if (current < 0) return
} else {
current = 0