From 82430aa8aa728d15a174afe7a263ad120d9092ce Mon Sep 17 00:00:00 2001 From: inglettronald Date: Wed, 5 Jul 2023 05:08:31 -0500 Subject: Added inactive Effigy Display --- .../com/dulkirfabric/features/EffigyDisplay.kt | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt (limited to 'src/main/kotlin/com/dulkirfabric/features/EffigyDisplay.kt') 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 -- cgit