-
-
Notifications
You must be signed in to change notification settings - Fork 89
Hollow wand utilities #223
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
Conversation
Soon2BeATaco
commented
Oct 9, 2025
- Added hollow wand module for ichor pool (with message sending and waypoint features)
- Added a "specific coordinates" optional parameter to PlayerUtils.getPositionString()
Summary of ChangesHello @Soon2BeATaco, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This PR introduces a new 'Hollow Wand' module for Ichor Pool management, enabling automatic party chat messages with precise coordinates upon casting and displaying temporary waypoints for incoming Ichor Pool messages. It also updates Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
Thank you for this contribution! I've reviewed the changes and have a few suggestions to improve correctness, maintainability, and clarity. My main points are:
- In
HollowWand.kt, the logic for removing waypoints is not entirely safe and could lead to a crash. I've suggested a more robust implementation. - I've also pointed out a few places where using named arguments would significantly improve code readability, especially for function calls with multiple parameters or boolean flags.
- In
PlayerUtils.kt, there's a small optimization to be made to avoid unnecessary object creation.
Overall, this is a great addition. Please take a look at my comments. Keep up the good work!
| val x: Double = it.groups[1]?.value?.toDouble() ?: return@onMessage | ||
| val y: Double = it.groups[2]?.value?.toDouble() ?: return@onMessage | ||
| val z: Double = it.groups[3]?.value?.toDouble() ?: return@onMessage | ||
| poolsToRender.add(IchorPoolCoordinate(x, y, z)) | ||
|
|
||
| runIn(400, true) { | ||
| poolsToRender.removeAt(0) | ||
| } |
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.
Using removeAt(0) is not safe and can lead to an IndexOutOfBoundsException if poolsToRender is cleared (e.g., on world load) before the runIn task executes. It's also fragile if the list is modified elsewhere.
A more robust approach is to remove the specific IchorPoolCoordinate instance that was added. This ensures you're always removing the correct element and avoids crashes on an empty list. I've also used toDoubleOrNull() which is slightly safer.
val x = it.groups[1]?.value?.toDoubleOrNull() ?: return@onMessage
val y = it.groups[2]?.value?.toDoubleOrNull() ?: return@onMessage
val z = it.groups[3]?.value?.toDoubleOrNull() ?: return@onMessage
val newPool = IchorPoolCoordinate(x, y, z)
poolsToRender.add(newPool)
runIn(400, true) {
poolsToRender.remove(newPool)
}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.
Implmenet ^
|
|
||
| private val incomingIchorRegex = Regex("""^Party > (?:\[[\wዞ]+\+*] )?[\w_]+: Ichor Pool x: (-?\d+\.\d{3}), y: (-?\d+), z: (-?\d+\.\d{3})$""") | ||
| private val outgoingIchorRegex = Regex("""^Casting Spell: Ichor Pool!$""") | ||
| private val messageSize by NumberSetting("Message Size", 1f, 0.1f, 4f, 0.1f, desc = "Whether or not to display the message size in the box.").withDependency { true } |
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 dependency { true } is redundant, as settings are visible by default.
Additionally, the description is a bit misleading for a NumberSetting. A clearer description would be better.
Since this setting only affects rendering when showWaypoint is enabled, it should be dependent on it to improve the user experience in the GUI.
| private val messageSize by NumberSetting("Message Size", 1f, 0.1f, 4f, 0.1f, desc = "Whether or not to display the message size in the box.").withDependency { true } | |
| private val messageSize by NumberSetting("Message Size", 1f, 0.1f, 4f, 0.1f, desc = "The size of the waypoint text.").withDependency { showWaypoint } |
| if(!showWaypoint) return | ||
|
|
||
| poolsToRender.forEach { pool -> | ||
| Renderer.drawCylinder(Vec3(pool.x, pool.y, pool.z), 6, 6, 0.05, 80f, 1f, 0f, 90f, 90f, waypointColor, true) |
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.
This call to drawCylinder uses many magic numbers, which makes the code hard to understand and maintain. What do 6, 0.05, 80f, etc., represent?
Using named arguments would significantly improve readability by making the purpose of each argument explicit. Consider also defining these values as constants if they are used elsewhere or have special meaning.
Example with named arguments:
Renderer.drawCylinder(
pos = Vec3(pool.x, pool.y, pool.z),
baseRadius = 6,
topRadius = 6,
height = 0.05,
slices = 80,
stacks = 1,
rot1 = 0f,
rot2 = 90f,
rot3 = 90f,
color = waypointColor,
depth = true
)|
|
||
| poolsToRender.forEach { pool -> | ||
| Renderer.drawCylinder(Vec3(pool.x, pool.y, pool.z), 6, 6, 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) |
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.
Using positional arguments with default values can make the call ambiguous and hard to read. For example, it's not immediately clear what true refers to without looking up the function definition.
Using named arguments would make this call much clearer and more maintainable.
Renderer.drawStringInWorld("Ichor Pool", Vec3(pool.x, pool.y + 0.5, pool.z), color = Colors.WHITE, depth = true, scale = 0.03f * messageSize)|
|
||
| fun getPositionString(): String { | ||
| fun getPositionString(getSpecificCoordinates: Boolean = false): String { | ||
| val blockPos = BlockPos(posX, posY, posZ) |
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 BlockPos object is created unconditionally, but it's only used in the else branch. To avoid unnecessary object allocation when getSpecificCoordinates is true, you can move the blockPos instantiation inside the else block.
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}"
}
}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.
Why was this file modified?
| data class IchorPoolCoordinate(val x: Double, val y: Double, val z: Double) | ||
| private val poolsToRender = mutableListOf<IchorPoolCoordinate>() | ||
|
|
||
| private val incomingIchorRegex = Regex("""^Party > (?:\[[\wዞ]+\+*] )?[\w_]+: Ichor Pool x: (-?\d+\.\d{3}), y: (-?\d+), z: (-?\d+\.\d{3})$""") |
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.
Use a single " when defining all the regexes
| ) { | ||
| private val sendChatMessage by BooleanSetting("Send Message", false, "Sends a message when ichor pool is casted.") | ||
| private val showWaypoint by BooleanSetting("Show Waypoint", false,"Sends a waypoint when party ichor pool message is detected.") | ||
| private val waypointColor by ColorSetting("Waypoint Color", Color(166, 21, 3), allowAlpha = false, desc = "Color of the ichor pool waypoint.").withDependency { showWaypoint } |
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.
Simply use Colors.MINECRAFT_RED default is allow alpha off so remvoe that
| description = "Messages and waypoints for ichor pool casting." | ||
| ) { | ||
| private val sendChatMessage by BooleanSetting("Send Message", false, "Sends a message when ichor pool is casted.") | ||
| private val showWaypoint by BooleanSetting("Show Waypoint", false,"Sends a waypoint when party ichor pool message is detected.") |
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.
Add a space between the false, and the description
| private val messageSize by NumberSetting("Message Size", 1f, 0.1f, 4f, 0.1f, desc = "Whether or not to display the message size in the box.").withDependency { true } | ||
|
|
||
| init { | ||
| // Sending Ichor Pool Messages |
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.
Pointless comments
| init { | ||
| // Sending Ichor Pool Messages | ||
| onMessage(outgoingIchorRegex) { | ||
| if(!sendChatMessage) return@onMessage |
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.
Invert the if statement and inline the send command function call
|
|
||
| // Receiving Ichor Pool Messages | ||
| onMessage(incomingIchorRegex) { | ||
| val x: Double = it.groups[1]?.value?.toDouble() ?: return@onMessage |
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.
No need to explicitly tell its a double
| val x: Double = it.groups[1]?.value?.toDouble() ?: return@onMessage | ||
| val y: Double = it.groups[2]?.value?.toDouble() ?: return@onMessage | ||
| val z: Double = it.groups[3]?.value?.toDouble() ?: return@onMessage | ||
| poolsToRender.add(IchorPoolCoordinate(x, y, z)) | ||
|
|
||
| runIn(400, true) { | ||
| poolsToRender.removeAt(0) | ||
| } |
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.
Implmenet ^