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/hannibal2/skyhanni/features/rift | |
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/hannibal2/skyhanni/features/rift')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/rift/RiftLavaMazeParkour.kt | 75 |
1 files changed, 75 insertions, 0 deletions
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 +} |