aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/features
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-07-05 05:08:31 -0500
committeringlettronald <inglettronald@gmail.com>2023-07-05 05:08:31 -0500
commit82430aa8aa728d15a174afe7a263ad120d9092ce (patch)
treee6db607b3a389f89184c13986e1ac8ff00fcebd2 /src/main/kotlin/com/dulkirfabric/features
parent5a38a3b4297709cc25c7b3e5953ea9b7c22b42ee (diff)
downloadDulkirMod-Fabric-82430aa8aa728d15a174afe7a263ad120d9092ce.tar.gz
DulkirMod-Fabric-82430aa8aa728d15a174afe7a263ad120d9092ce.tar.bz2
DulkirMod-Fabric-82430aa8aa728d15a174afe7a263ad120d9092ce.zip
Added inactive Effigy Display
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features')
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt61
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/RenderTest.kt3
2 files changed, 62 insertions, 2 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt b/src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt
new file mode 100644
index 0000000..9e8c75f
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt
@@ -0,0 +1,61 @@
+package com.dulkirfabric.features
+
+import com.dulkirfabric.config.DulkirConfig
+import com.dulkirfabric.events.LongUpdateEvent
+import com.dulkirfabric.events.WorldRenderLastEvent
+import com.dulkirfabric.util.ScoreBoardUtils
+import com.dulkirfabric.util.TablistUtils
+import com.dulkirfabric.util.Utils
+import com.dulkirfabric.util.WorldRenderUtils
+import meteordevelopment.orbit.EventHandler
+import net.minecraft.text.Style
+import net.minecraft.text.Text
+import net.minecraft.util.Formatting
+import net.minecraft.util.math.Vec3d
+
+object EffigyDisplay {
+ private var effigyWaypoints = arrayOf(
+ Effigy(Vec3d(150.5, 76.0, 95.5)),
+ Effigy(Vec3d(193.5, 90.0, 119.5)),
+ Effigy(Vec3d(235.5, 107.0, 147.5)),
+ Effigy(Vec3d(293.5, 93.0, 134.5)),
+ Effigy(Vec3d(262.5, 96.0, 94.5)),
+ Effigy(Vec3d(240.5, 126.0, 118.5))
+ )
+
+ private val c7OnlyRegex = Regex("[^c7]")
+
+ @EventHandler
+ fun onRender(event: WorldRenderLastEvent) {
+ // if we have any waypoints that need rendering, Do so.
+ for (effigy in effigyWaypoints) {
+ if (effigy.render) {
+ WorldRenderUtils.renderWaypoint(
+ Text.literal("Inactive").setStyle(Style.EMPTY.withColor(Formatting.GOLD)), event.context, effigy.coords
+ )
+ }
+ }
+ }
+ @EventHandler
+ fun checkEffigies(event: LongUpdateEvent) {
+ if (!DulkirConfig.configOptions.inactiveEffigyDisplay) return
+ if (!Utils.isInSkyblock()) return
+ if (TablistUtils.area != "The Rift") {
+ effigyWaypoints.forEach { it.render = false }
+ return
+ }
+ val lines = ScoreBoardUtils.getLinesWithColor() ?: return
+ if (lines.size <= 7) return
+ if (!lines[3].contains("Stillgore")) return
+ val effigyStatusLine = lines[6].replace(c7OnlyRegex, "").substring(1)
+ if (effigyStatusLine.length != 6) return
+ for (i in 0..5) {
+ effigyWaypoints[i].render = (effigyStatusLine[i] == '7')
+ }
+ }
+
+ /**
+ * data class for storing the effigy coordinates and whether they need to be rendered
+ */
+ data class Effigy(val coords: Vec3d, var render: Boolean = false)
+} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt b/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
index 93c4ad9..8ad270d 100644
--- a/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/RenderTest.kt
@@ -12,10 +12,9 @@ object RenderTest {
@EventHandler
fun onRender(event: WorldRenderLastEvent) {
-
WorldRenderUtils.renderWaypoint(
Text.literal("Home Base").setStyle(Style.EMPTY.withColor(Color(255, 100, 150, 255).rgb)), event.context,
- Vec3d(-183.5, 79.0, -465.5), false
+ Vec3d(-183.5, 79.0, -465.5)
)
}
} \ No newline at end of file