From 3dfb4c916ac99cbd154cbc037dac2a76f234ebca Mon Sep 17 00:00:00 2001 From: odtheking Date: Mon, 2 Dec 2024 07:45:08 +0200 Subject: [PATCH] Cleanup --- .../features/impl/dungeon/SpringBoots.kt | 22 ++++++++++++------- .../features/impl/floor7/TickTimers.kt | 19 ++++++++-------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/main/kotlin/me/odinmain/features/impl/dungeon/SpringBoots.kt b/src/main/kotlin/me/odinmain/features/impl/dungeon/SpringBoots.kt index 8a093feba..521d0d0ea 100644 --- a/src/main/kotlin/me/odinmain/features/impl/dungeon/SpringBoots.kt +++ b/src/main/kotlin/me/odinmain/features/impl/dungeon/SpringBoots.kt @@ -29,21 +29,17 @@ object SpringBoots : Module( ) { private val hud by HudSetting("Display", 10f, 10f, 1f, true) { if (it) { - val color = if (6.5 >= threshold) Color.PURPLE else Color.WHITE - mcText("Jump: 6.5", 1f, 1f, 1, color) + mcText("Jump: 6.5", 1f, 1f, 1, Color.WHITE) getTextWidth("Jump: 6.5", 12f) to 12f } else { - val blockAmount = blocksList.getSafe(pitchCounts.sum()) ?: return@HudSetting 0f to 0f - if (blockAmount == 0.0) return@HudSetting 0f to 0f - val color = if (blockAmount >= threshold) Color.PURPLE else Color.WHITE - mcText("Jump: ${blockAmount ?: "61 (MAX)"}", 1f, 1f, 1, color) - getTextWidth("Jump: ${blockAmount ?: "61 (MAX)"}", 12f) to 12f + val blockAmount = blocksList.getSafe(pitchCounts.sum()).takeIf { it != 0.0 } ?: return@HudSetting 0f to 0f + mcText("Jump: ${colorHud(blockAmount)}", 1f, 1f, 1, Color.WHITE) + getTextWidth("Jump: ${colorHud(blockAmount)}", 12f) to 12f } } private val renderGoal by BooleanSetting("Render Goal", true, description = "Render the goal block.") private val goalColor by ColorSetting("Goal Color", Color.GREEN, description = "Color of the goal block.") private val offset by NumberSetting("Offset", 0.0, -10.0, 10.0, 0.1, description = "The offset of the goal block.") - private val threshold by NumberSetting("Threshold", 18.5, 5.0, 61.0, description = "If your spring boots will take you higher than this number, the text becomes purple.") private val blocksList: List = listOf( 0.0, 3.0, 6.5, 9.0, 11.5, 13.5, 16.0, 18.0, 19.0, @@ -83,4 +79,14 @@ object SpringBoots : Module( if (!renderGoal || !LocationUtils.isInSkyblock) return blockPos?.let { Renderer.drawBox(it.toAABB(), goalColor, fillAlpha = 0f) } } + + private fun colorHud(blocks: Double): String { + return when { + blocks <= 13.5 -> "§c" + blocks <= 22.5 -> "§e" + blocks <= 33.0 -> "§6" + blocks <= 43.5 -> "§a" + else -> "§b" + } + blocks + } } \ No newline at end of file diff --git a/src/main/kotlin/me/odinmain/features/impl/floor7/TickTimers.kt b/src/main/kotlin/me/odinmain/features/impl/floor7/TickTimers.kt index 5e8987254..24b8606c8 100644 --- a/src/main/kotlin/me/odinmain/features/impl/floor7/TickTimers.kt +++ b/src/main/kotlin/me/odinmain/features/impl/floor7/TickTimers.kt @@ -4,11 +4,12 @@ import me.odinmain.events.impl.ServerTickEvent import me.odinmain.features.Category import me.odinmain.features.Module import me.odinmain.features.settings.Setting.Companion.withDependency -import me.odinmain.features.settings.impl.* +import me.odinmain.features.settings.impl.BooleanSetting +import me.odinmain.features.settings.impl.HudSetting import me.odinmain.utils.render.Color import me.odinmain.utils.render.mcTextAndWidth import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.util.Locale +import java.util.* object TickTimers : Module( name = "Tick Timers", @@ -73,14 +74,12 @@ object TickTimers : Module( @SubscribeEvent fun onServerTick(event: ServerTickEvent) { - when { - necronTime >= 0 && necronHud.enabled -> necronTime-- - padTickTime >= 0 && stormHud.enabled -> padTickTime-- - padTickTime == 0 && stormHud.enabled -> padTickTime = 20 - goldorTickTime >= 0 && goldorHud.enabled -> goldorTickTime-- - goldorStartTime >= 0 && goldorHud.enabled -> goldorStartTime-- - goldorTickTime == 0 && goldorStartTime <= 0 && goldorHud.enabled -> goldorTickTime = 60 - } + if (necronTime >= 0 && necronHud.enabled) necronTime-- + if (padTickTime >= 0 && stormHud.enabled) padTickTime-- + if (padTickTime == 0 && stormHud.enabled) padTickTime = 20 + if (goldorTickTime >= 0 && goldorHud.enabled) goldorTickTime-- + if (goldorStartTime >= 0 && goldorHud.enabled) goldorStartTime-- + if (goldorTickTime == 0 && goldorStartTime <= 0 && goldorHud.enabled) { goldorTickTime = 60 } } private fun formatTimer(time: Int, max: Int, prefix: String): String {