-
-
Notifications
You must be signed in to change notification settings - Fork 93
Hollow wand utilities v2 #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Soon2BeATaco
wants to merge
18
commits into
odtheking:main
Choose a base branch
from
Soon2BeATaco:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
76d8674
Hollow wand utilities
Soon2BeATaco 793dd83
Remove .DS_Store files from repo
Soon2BeATaco 4d3d4e7
Remove all .DS_Store files
Soon2BeATaco fbce5c4
Changed base color for ichor pool display
Soon2BeATaco ee1958c
commit test
Soon2BeATaco 1368ee4
attempt to improve accuracy of ichor pool coordinates
Soon2BeATaco e595605
Added coordinate specificity
Soon2BeATaco 98ce87a
Removed decimals on y coordinate
Soon2BeATaco 86c4634
Merge branch 'odtheking:main' into main
Soon2BeATaco 0a91215
moved hollow wand module over to skyblock from dungeon because I am s…
Soon2BeATaco 76000a6
Switched hollow wand module's category from dungeon to skyblock
Soon2BeATaco da4eeb0
Merge branch 'odtheking:main' into main
Soon2BeATaco 455448e
Cleaned up the code base and made it work with another spell
Soon2BeATaco 0086d7e
Removed the crash from modifying a list
Soon2BeATaco 5ce5251
Made the raging wind spell waypoint scale according to fps so it's mo…
Soon2BeATaco e5ea7f1
Fixed raging wind spell waypoint math
Soon2BeATaco 402f1e3
Added title for Raging Winds spell
Soon2BeATaco f98fe40
Removed a divide by zero error
Soon2BeATaco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
src/main/kotlin/me/odinmain/features/impl/skyblock/HollowWand.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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") | ||||||||||
| } | ||||||||||
| } | ||||||||||
| "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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||
|
|
||||||||||
| 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() | ||||||||||
| } | ||||||||||
| } | ||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
alertandmodMessagecalls 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.