Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
/odinmain/src/main/resources/shaders/glslopt.exe
/odinmain/src/main/resources/shaders/output/
/odinmain/src/main/resources/shaders/optimize.bat
.DS_Store
Empty file modified gradlew
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion src/main/kotlin/me/odinmain/features/ModuleManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ object ModuleManager {
//skyblock
NoCursorReset, AutoSprint, BlazeAttunement, ChatCommands, DeployableTimer, DianaHelper,
Ragnarock, MobSpawn, Splits, WardrobeKeybinds, InvincibilityTimer, ItemsHighlight, PlayerDisplay,
FarmKeys, PetKeybinds, CommandKeybinds, SpringBoots, AbilityTimers, SlotBinds,
FarmKeys, PetKeybinds, CommandKeybinds, SpringBoots, AbilityTimers, SlotBinds, HollowWand,

// kuudra
BuildHelper, FreshTools, KuudraDisplay, NoPre, PearlWaypoints, RemovePerks, SupplyHelper, TeamHighlight,
Expand Down
96 changes: 96 additions & 0 deletions src/main/kotlin/me/odinmain/features/impl/skyblock/HollowWand.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package me.odinmain.features.impl.skyblock

import me.odinmain.clickgui.settings.Setting.Companion.withDependency
import me.odinmain.clickgui.settings.impl.BooleanSetting
import me.odinmain.clickgui.settings.impl.ColorSetting
import me.odinmain.clickgui.settings.impl.NumberSetting
import me.odinmain.features.Module
import me.odinmain.utils.render.Colors
import me.odinmain.utils.render.Renderer
import me.odinmain.utils.runIn
import me.odinmain.utils.skyblock.PlayerUtils
import me.odinmain.utils.skyblock.modMessage
import me.odinmain.utils.skyblock.sendCommand
import net.minecraft.util.Vec3
import net.minecraftforge.client.event.RenderWorldLastEvent
import net.minecraftforge.event.world.WorldEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.max

object HollowWand : Module(
name = "Hollow Wand",
description = "Messages and waypoints for hollow wand casting."
) {
private val sendChatMessage by BooleanSetting("Send Message", false, "Sends a message when hollow wand is casted.")
private val showWaypoint by BooleanSetting("Show Waypoint", false, "Shows a waypoint when party hollow wand message is detected.")
private val waypointColor by ColorSetting("Waypoint Color", Colors.MINECRAFT_DARK_RED, desc = "Color of the pool waypoint.").withDependency { showWaypoint }
private val messageSize by NumberSetting("Message Size", 1f, 0.1f, 4f, 0.1f, desc = "The size of the waypoint text.").withDependency { showWaypoint }

data class CastCoordinate(val x: Double, val y: Double, val z: Double, var radius: Double = 0.0)
private val poolsToRender = mutableListOf<CastCoordinate>()
private val windsToRender = mutableListOf<CastCoordinate>()

private val incomingHollowRegex = Regex("^Party > (?:\\[[\\wዞ]+\\+*] )?[\\w_]+: (Raging Wind|Ichor Pool) x: (-?\\d+\\.\\d{3}), y: (-?\\d+), z: (-?\\d+\\.\\d{3})$")
private val outgoingHollowRegex = Regex("^Casting Spell: (Raging Wind|Ichor Pool)!$")

init {
onMessage(outgoingHollowRegex) {
if(!sendChatMessage) return@onMessage
val type = it.groups[1]?.value ?: return@onMessage
sendCommand("pc $type ${PlayerUtils.getPositionString(true)}")
}

onMessage(incomingHollowRegex) {
if(!showWaypoint) return@onMessage
val type = it.groups[1]?.value ?: return@onMessage
val x = it.groups[2]?.value?.toDouble() ?: return@onMessage
val y = it.groups[3]?.value?.toDouble() ?: return@onMessage
val z = it.groups[4]?.value?.toDouble() ?: return@onMessage
val thisCast = CastCoordinate(x, y, z)
when(type) {
"Raging Wind" -> {
windsToRender.add(thisCast)
if(PlayerUtils.getDistanceTo(x, y, z) <= 25) {
PlayerUtils.alert("Raging Winds", color = Colors.MINECRAFT_RED)
modMessage("Raging Winds applied")
}
Comment on lines +53 to +56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The alert and modMessage calls are both triggered when the player is within 25 blocks of a Raging Wind. Consider consolidating these into a single function call or a more descriptive combined message to avoid redundancy and improve clarity.

Suggested change
if(PlayerUtils.getDistanceTo(x, y, z) <= 25) {
PlayerUtils.alert("Raging Winds", color = Colors.MINECRAFT_RED)
modMessage("Raging Winds applied")
}
if(PlayerUtils.getDistanceTo(x, y, z) <= 25) {
PlayerUtils.alert("Raging Winds applied", color = Colors.MINECRAFT_RED)
modMessage("Raging Winds applied")
}

}
"Ichor Pool" -> {
poolsToRender.add(thisCast)
runIn(400, true) {
poolsToRender.remove(thisCast)
}
}
}
}
}

@SubscribeEvent
fun onRenderWorldLast(event: RenderWorldLastEvent) {
if(!showWaypoint) return
val fps = mc.debug?.split(" ")?.get(0)?.toDoubleOrNull() ?: 60.0
val windIncrement = 25.0 / max(60.0, fps)
Comment on lines +71 to +72
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The fps variable is used to calculate windIncrement. If mc.debug is null, split will throw an exception. Add a null check to prevent this.

Suggested change
val fps = mc.debug?.split(" ")?.get(0)?.toDoubleOrNull() ?: 60.0
val windIncrement = 25.0 / max(60.0, fps)
if(!showWaypoint) return
val fps = mc.debug?.split(" ")?.get(0)?.toDoubleOrNull() ?: 60.0


poolsToRender.forEach { pool ->
Renderer.drawCylinder(Vec3(pool.x, pool.y, pool.z), 8, 8, 0.05, 80f, 1f, 0f, 90f, 90f, waypointColor, true)
Renderer.drawStringInWorld("Ichor Pool", Vec3(pool.x, pool.y + 0.5, pool.z), Colors.WHITE, true, 0.03f * messageSize)
}

windsToRender.toList().forEach { wind ->
wind.radius += windIncrement
if(wind.radius > 25) {
windsToRender.remove(wind)
return@forEach
}

Renderer.drawCylinder(Vec3(wind.x, wind.y, wind.z), wind.radius, wind.radius, 0.05, 80f, 1f, 0f, 90f, 90f, waypointColor, true)
Renderer.drawStringInWorld("Raging Wind", Vec3(wind.x, wind.y + 0.5, wind.z), Colors.WHITE, true, 0.03f * messageSize)
}
}

@SubscribeEvent
fun onWorldLoad(event: WorldEvent.Load) {
poolsToRender.clear()
windsToRender.clear()
}
}
22 changes: 19 additions & 3 deletions src/main/kotlin/me/odinmain/utils/skyblock/PlayerUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ import me.odinmain.utils.postAndCatch
import me.odinmain.utils.render.Color
import me.odinmain.utils.render.Colors
import me.odinmain.utils.render.Renderer
import me.odinmain.utils.round
import me.odinmain.utils.toFixed
import net.minecraft.network.play.client.C0EPacketClickWindow
import net.minecraft.util.BlockPos
import net.minecraft.util.Vec3
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.math.pow
import kotlin.math.sqrt

object PlayerUtils {
var shouldBypassVolume = false
Expand Down Expand Up @@ -49,9 +53,21 @@ object PlayerUtils {
inline val posY get() = mc.thePlayer?.posY ?: 0.0
inline val posZ get() = mc.thePlayer?.posZ ?: 0.0

fun getPositionString(): String {
val blockPos = BlockPos(posX, posY, posZ)
return "x: ${blockPos.x}, y: ${blockPos.y}, z: ${blockPos.z}"
fun getPositionString(getSpecificCoordinates: Boolean = false): String {
return if(getSpecificCoordinates) {
"x: ${posX.toFixed(3)}, y: ${posY.toFixed(0)}, z: ${posZ.toFixed(3)}"
}
else {
val blockPos = BlockPos(posX, posY, posZ)
"x: ${blockPos.x}, y: ${blockPos.y}, z: ${blockPos.z}"
}
}

fun getDistanceTo(x: Double, y: Double, z: Double): Double {
val xDist = (posX - x).pow(2)
val yDist = (posY - y).pow(2)
val zDist = (posZ - z).pow(2)
return sqrt(xDist + yDist + zDist)
}

private var lastClickSent = 0L
Expand Down