aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiZe_ <superhize@hotmail.com>2023-07-04 14:25:48 +0200
committerGitHub <noreply@github.com>2023-07-04 14:25:48 +0200
commita58f5cea0a3378b0f32a57750ad5c750aeec92d3 (patch)
treeb2028f6b3fe710b61637b5fa7b43e8b5011245e9
parentdd1dc872a97dcc14fe7842fc69c1bd34b44223fe (diff)
downloadskyhanni-a58f5cea0a3378b0f32a57750ad5c750aeec92d3.tar.gz
skyhanni-a58f5cea0a3378b0f32a57750ad5c750aeec92d3.tar.bz2
skyhanni-a58f5cea0a3378b0f32a57750ad5c750aeec92d3.zip
Merge pull request #278
* start * i sleep * hide others players * change * thing * useless import * config option to change space between lines of text * removed useless val * Code cleanup * Merge branch 'beta' into danceroom_helper * use repo for instructions * merged beta * display a message when instructions list is empty * more beautiful colors and moved category into mirror verse
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java40
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt129
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DanceRoomInstructionsJson.java10
4 files changed, 175 insertions, 5 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index d863f5ee8..55a334691 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -314,6 +314,7 @@ class SkyHanniMod {
loadModule(EnigmaSoulWaypoints)
loadModule(DungeonLividFinder)
loadModule(CruxTalismanDisplay)
+ loadModule(DanceRoomHelper)
loadModule(LaserParkour())
loadModule(CustomTextBox())
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 f0457530d..d3ec06d2b 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/RiftConfig.java
@@ -2,10 +2,7 @@ package at.hannibal2.skyhanni.config.features;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
-import io.github.moulberry.moulconfig.annotations.Accordion;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorColour;
-import io.github.moulberry.moulconfig.annotations.ConfigOption;
+import io.github.moulberry.moulconfig.annotations.*;
import io.github.moulberry.moulconfig.observer.Property;
public class RiftConfig {
@@ -172,8 +169,40 @@ public class RiftConfig {
public static class MirrorVerse {
+ @ConfigOption(name = "Dance Room Helper", desc = "")
+ @Accordion
@Expose
- @ConfigOption(name = "Laser Parkour", desc = "Highlights the location of the invisible blocks.")
+ public DanceRoomHelper danceRoomHelper = new DanceRoomHelper();
+
+ public static class DanceRoomHelper{
+
+ @Expose
+ @ConfigOption(name= "Enabled", desc = "Helps solving the dance room in the mirror verse by showing multiple tasks at once.")
+ @ConfigEditorBoolean
+ public boolean enabled = false;
+
+ @Expose
+ @ConfigOption(name = "Lines to show", desc = "How many tasks you should see.")
+ @ConfigEditorSlider(minStep = 1, maxValue = 49, minValue = 1)
+ public int lineToShow = 3;
+
+ @Expose
+ @ConfigOption(name = "Space", desc = "Change the space between each line.")
+ @ConfigEditorSlider(minStep = 1, maxValue = 10, minValue = -5)
+ public int extraSpace = 0;
+
+ @Expose
+ @ConfigOption(name = "Hide others players", desc = "Hide other players inside the dance room.")
+ @ConfigEditorBoolean
+ public boolean hidePlayers = false;
+
+ @Expose
+ public Position position = new Position(442, 239, false, true);
+
+ }
+
+ @Expose
+ @ConfigOption(name = "Tubulator", desc = "Highlights the location of the invisible blocks (Laser Parkour).")
@ConfigEditorBoolean
public boolean laserParkour = true;
@@ -202,4 +231,5 @@ public class RiftConfig {
public boolean waypoints = true;
}
+
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt
new file mode 100644
index 000000000..300dd2b23
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/rift/DanceRoomHelper.kt
@@ -0,0 +1,129 @@
+package at.hannibal2.skyhanni.features.rift
+
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.CheckRenderEntityEvent
+import at.hannibal2.skyhanni.events.GuiRenderEvent
+import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.events.RepositoryReloadEvent
+import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
+import at.hannibal2.skyhanni.utils.StringUtils.firstLetterUppercase
+import at.hannibal2.skyhanni.utils.getLorenzVec
+import at.hannibal2.skyhanni.utils.jsonobjects.DanceRoomInstructionsJson
+import kotlinx.coroutines.*
+import net.minecraft.client.Minecraft
+import net.minecraft.client.entity.EntityOtherPlayerMP
+import net.minecraft.util.AxisAlignedBB
+import net.minecraftforge.event.world.WorldEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object DanceRoomHelper {
+
+ private var display = emptyList<String>()
+ private val config get() = SkyHanniMod.feature.rift.mirrorVerse.danceRoomHelper
+ private var index = 0
+ private var found = false
+ private val danceRoom = AxisAlignedBB(-260.0, 32.0, -110.0, -267.0, 40.0, -102.0)
+ private var inRoom = false
+ private var instructions = emptyList<String>()
+
+ fun update() {
+ display = buildList {
+ if (instructions.isEmpty()) {
+ add("§cError fetching Dance Room Instructions!")
+ add("§cTry §e/shreloadlocalrepo §cor §e/shupdaterepo")
+ }
+ for (line in instructions.withIndex()) {
+ if (index == line.index) {
+ add("§7Now: ${line.value.format()}")
+ } else if (index + 1 == line.index) {
+ add("§7Next: ${line.value.format()}")
+ } else if ((index + 2..index + config.lineToShow).contains(line.index)) {
+ add("§7Later: ${line.value.format()}")
+ }
+ }
+ }
+ }
+
+ private fun String.format() = split(" ").joinToString(" ") { it.firstLetterUppercase().addColor() }
+
+ private fun String.addColor() = when (this) {
+ "Move" -> "§e"
+ "Stand" -> "§e"
+ "Sneak" -> "§5"
+ "Jump" -> "§b"
+ "Punch" -> "§d"
+ else -> "§f"
+ } + this
+
+ @SubscribeEvent
+ fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
+ if (!isEnabled()) return
+ config.position.renderStrings(
+ display,
+ config.extraSpace,
+ posLabel = "Dance Room Helper"
+ )
+ }
+
+ @SubscribeEvent
+ fun onWorldChange(event: WorldEvent.Load) {
+ inRoom = false
+ }
+
+ @SubscribeEvent
+ fun onTick(event: LorenzTickEvent) {
+ if (!isEnabled()) return
+ if (event.isMod(10)) {
+ inRoom = danceRoom.isVecInside(Minecraft.getMinecraft().thePlayer.positionVector)
+ }
+ if (inRoom) {
+ update()
+ }
+ }
+
+ @SubscribeEvent
+ fun onSound(event: at.hannibal2.skyhanni.events.PlaySoundEvent) {
+ if (!isEnabled() && !inRoom) return
+ if (event.soundName == "random.burp" && event.volume == 0.8f) {
+ index = 0
+ found = false
+ update()
+ }
+ if (event.soundName == "note.bassattack" && event.pitch == 0.6984127f && event.volume == 1.0f && !found) {
+ found = true
+ start(2000)
+ update()
+ }
+ }
+
+ @SubscribeEvent
+ fun onCheckRender(event: CheckRenderEntityEvent<*>) {
+ if (RiftAPI.inRift() && config.hidePlayers) {
+ val entity = event.entity
+ if (entity is EntityOtherPlayerMP) {
+ if (danceRoom.isVecInside(entity.getLorenzVec().toVec3())) {
+ event.isCanceled = true
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onRepoReload(event: RepositoryReloadEvent) {
+ event.getConstant<DanceRoomInstructionsJson>("DanceRoomInstructions")?.let {
+ instructions = it.instructions
+ }
+ }
+
+ fun start(interval: Long): Job {
+ return CoroutineScope(Dispatchers.Default).launch {
+ while (NonCancellable.isActive && found) {
+ index++
+ delay(interval)
+ }
+ }
+ }
+
+ fun isEnabled() = RiftAPI.inRift() && config.enabled
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DanceRoomInstructionsJson.java b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DanceRoomInstructionsJson.java
new file mode 100644
index 000000000..0f4568bbd
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/utils/jsonobjects/DanceRoomInstructionsJson.java
@@ -0,0 +1,10 @@
+package at.hannibal2.skyhanni.utils.jsonobjects;
+
+import com.google.gson.annotations.Expose;
+
+import java.util.List;
+
+public class DanceRoomInstructionsJson {
+ @Expose
+ public List<String> instructions;
+}