Skip to content

Conversation

@arvi18
Copy link

@arvi18 arvi18 commented Sep 2, 2025

User description

Type of change

  • Bug fix
  • New feature

Description

A summary of the changes along with the reasoning behind the changes.

Related issues

Mention any issues that this pr relates to.

How Has This Been Tested?

Videos or screenshots of the changes if applicable.

Checklist:

  • My code follows the style guidelines of this project.
  • I have added comments to my code in more complex areas.
  • I have tested the code in both development and production environments.

Summary by CodeRabbit

  • New Features

    • Added an Auto-Select mode to Nuker that targets the exact block type you’re aiming at and restricts breaking to that type.
    • The currently auto-selected block type can be viewed while the mode is active.
  • UX Improvements

    • On activation, if you’re not aiming at a block, nothing is selected and the mode shows no selection.
    • Auto-Select resets cleanly when the module is turned off.

✏️ Tip: You can customize this high-level summary in your review settings.


CodeAnt-AI Description

Restrict Nuker to only break the block type you target with Auto-Select

What Changed

  • Added an Auto-Select mode that, when activated, picks the block type under your crosshair and limits Nuker to breaking only that block type
  • If you activate Auto-Select while not aiming at a block, the mode stays unselected and shows a warning instead of picking a random block
  • Auto-Select selection is cleared when the module is turned off; the selected block can be retrieved for display in the GUI

Impact

✅ Fewer accidental block breaks
✅ Clearer auto-select feedback
✅ Predictable block removal

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@coderabbitai
Copy link

coderabbitai bot commented Sep 2, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds an AutoSelect mode to Nuker. On activation it captures the block under the crosshair; block iteration is then restricted to that block type. Deactivation clears the selection. Exposes getAutoSelectBlock() and adds ListMode.AutoSelect.

Changes

Cohort / File(s) Summary
World/Nuker AutoSelect
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java
Added autoSelectBlock field; capture crosshair target on onActivate() and clear on onDeactivate() when ListMode.AutoSelect is used; updated BlockIterator predicate to filter by the auto-selected block; added public Block getAutoSelectBlock(); added imports BlockHitResult and HitResult; added ListMode.AutoSelect.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Player
  participant Nuker
  participant MC as Minecraft Client
  participant BI as BlockIterator

  Player->>Nuker: Activate (ListMode = AutoSelect)
  Nuker->>MC: Read crosshairTarget
  alt crosshairTarget is BLOCK
    MC-->>Nuker: BlockHitResult(pos)
    Nuker->>Nuker: autoSelectBlock = world.getBlockState(pos).getBlock()
  else not a block
    MC-->>Nuker: Non-block HitResult
    Nuker->>Nuker: autoSelectBlock = null
  end

  loop Block iteration
    BI->>Nuker: evaluate(state, pos)
    alt ListMode == AutoSelect
      alt autoSelectBlock != null and state.block == autoSelectBlock
        Nuker-->>BI: true
      else
        Nuker-->>BI: false
      end
    else Other modes
      Nuker-->>BI: evaluate whitelist/blacklist
    end
  end

  Player->>Nuker: Deactivate
  alt ListMode == AutoSelect
    Nuker->>Nuker: autoSelectBlock = null
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I peered through sights with twitching ear,
“That block!” I thumped—crystal clear.
The Nuker nods, selects my pick,
One tasty target, gone so quick.
When dusk descends, I hop away—
AutoSelect rests till next play. 🐇⛏️

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description uses the template structure but lacks substantive content—the summary section contains only the template placeholder text with no actual explanation of what was changed or why. Replace the placeholder 'A summary of the changes along with the reasoning behind the changes' with concrete details about the AutoSelect feature implementation, its purpose, and reasoning.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: adding AutoSelect functionality to the Nuker module, which is clearly related to the file modifications and feature additions in the changeset.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 692621f and 05d3f65.

📒 Files selected for processing (1)
  • src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (2)
src/main/java/meteordevelopment/meteorclient/utils/world/BlockIterator.java (1)
  • BlockIterator (25-112)
src/main/java/meteordevelopment/meteorclient/utils/Utils.java (1)
  • Utils (75-630)
🔇 Additional comments (5)
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (5)

26-27: LGTM: Necessary imports for AutoSelect.

The imports enable crosshair target detection required for the AutoSelect mode.


187-187: LGTM: Clean field declaration.

The field is properly scoped and documented with an inline comment.


410-412: LGTM: AutoSelect filtering logic is correct.

The logic properly filters blocks to match only the selected block type. When autoSelectBlock is null or doesn't match, the block is skipped. The existing delay mechanism (lines 311-314, 446-454) already applies rate limiting uniformly across all modes, including AutoSelect.


497-499: LGTM: Simple, well-documented getter.

The public getter enables GUI or other components to display the currently selected block.


503-504: LGTM: Enum value properly added.

The AutoSelect value is correctly added to the ListMode enum, following the existing pattern.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @arvi18, 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 pull request enhances the Nuker module by introducing an AutoSelect mode. This new feature streamlines the block targeting process, allowing users to automatically select and focus the Nuker on the specific block type they are currently looking at, improving convenience and efficiency during gameplay.

Highlights

  • New AutoSelect Mode: Introduced an "AutoSelect" option within the Nuker module's ListMode, allowing the module to automatically target the block currently aimed at by the player.
  • Dynamic Block Selection: When AutoSelect mode is enabled, the Nuker now identifies and stores the block type the player is looking at upon activation, and subsequently only targets blocks of that specific type.
  • Module Lifecycle Integration: Added logic to the onActivate method to capture the targeted block and to the onDeactivate method to clear the auto-selected block, ensuring proper state management.
  • Targeting Logic Update: Modified the block iteration and filtering logic to incorporate the new AutoSelect mode, ensuring only the chosen block type is considered for breaking.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@refacto-test
Copy link

refacto-test bot commented Sep 2, 2025

Nuker Module Auto-Select Mode

TL;DR: Added an "AutoSelect" mode to the Nuker module that allows targeting specific blocks by looking at them.


Refacto PR Summary

Enhanced the Nuker module with a new AutoSelect mode that dynamically targets blocks based on player's crosshair.
This PR adds a third option to the existing ListMode enum (alongside Whitelist and Blacklist) that allows players to automatically target blocks of the same type as what they're looking at when activating the module. The implementation stores the targeted block in a new autoSelectBlock field, properly handles activation/deactivation states, and integrates with the existing block filtering logic. This improves usability by eliminating the need to manually configure block lists for common mining operations.

Change Highlights

Click to expand
  • Added new autoSelectBlock field to store the currently targeted block type
  • Enhanced onActivate() to detect and store the block under crosshair when using AutoSelect mode
  • Added onDeactivate() to clean up the selected block reference when module is disabled
  • Modified block filtering logic to support the new AutoSelect mode alongside existing Whitelist/Blacklist modes
  • Added a getter method getAutoSelectBlock() for GUI display purposes
  • Added necessary imports for BlockHitResult and HitResult classes

Sequence Diagram

sequenceDiagram
    participant User
    participant Nuker as Nuker Module
    participant World as Minecraft World
    
    User->>Nuker: Activate module (with AutoSelect)
    Nuker->>World: Get block at crosshair position
    World-->>Nuker: Return block type
    Nuker->>Nuker: Store autoSelectBlock
    
    loop Every tick
        Nuker->>World: Scan blocks in range
        World-->>Nuker: Return block positions
        Nuker->>Nuker: Filter blocks matching autoSelectBlock
        Nuker->>World: Break matching blocks
    end
    
    User->>Nuker: Deactivate module
    Nuker->>Nuker: Clear autoSelectBlock
Loading

Testing Guide

Click to expand
  1. Enable the Nuker module and set ListMode to "AutoSelect"
  2. Look at a specific block type (e.g., stone, dirt) and activate the module
  3. Verify that only blocks of the same type as what you were looking at are being targeted
  4. Test edge case: activate without looking at any block - should display a warning message
  5. Change target by deactivating, looking at a different block type, and reactivating
  6. Verify that switching to other list modes (Whitelist/Blacklist) works as expected

@arvi18
Copy link
Author

arvi18 commented Sep 2, 2025

/refacto-test

@refacto-test
Copy link

refacto-test bot commented Sep 2, 2025

Refacto is reviewing this PR. Please wait for the review comments to be posted.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an 'Auto-Select' mode to the Nuker module, allowing it to target the block currently in the player's crosshairs. The implementation is well-structured, including proper setup on activation and cleanup on deactivation. The refactoring from multiple if statements to a switch for handling list modes improves code clarity. I've suggested one improvement to enhance user experience when activating the module without a target block.

Comment on lines +279 to +280
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");

Choose a reason for hiding this comment

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

high

When AutoSelect mode is enabled but the player is not looking at a block, the module currently shows a warning and remains active without performing any action. This can be confusing for the user, who might not notice the warning and wonder why the module isn't working.

A better approach would be to provide clearer feedback by showing an error message and automatically deactivating the module. This makes it explicit that the activation failed and why.

Suggested change
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
error("You must be looking at a block to use Auto-Select. Deactivating.");
toggle();

@refacto-test
Copy link

refacto-test bot commented Sep 2, 2025

Code Review: Nuker AutoSelect Implementation

👍 Well Done
Proper Resource Cleanup

AutoSelect block reference properly cleared on deactivation preventing memory leaks.

User Feedback Added

Warning message added when no block targeted improves user experience.

Efficient Block Selection

The AutoSelect implementation efficiently stores selected block without redundant processing.

📌 Files Processed
  • src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java
📝 Additional Comments
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (5)
Inconsistent Block Selection

Block selection occurs only once at activation. If user changes target after activation, selection won't update, creating unexpected behavior.

Standards:

  • ISO-IEC-25010-Functional-Correctness-Appropriateness
  • ISO-IEC-25010-Reliability-Maturity
Block Lookup Optimization

The equals() comparison for block matching is performed for every block in range. For large ranges with many blocks, this could become a performance bottleneck. Consider using identity comparison (==) if possible for Block objects, which would be more efficient than equals() method calls in this high-frequency operation.

Standards:

  • ISO-IEC-25010-Performance-Time-Behaviour
  • Algorithm-Opt-Object-Comparison
Long Method Complexity

BlockIterator lambda contains complex nested conditionals with multiple responsibilities. This violates SRP by combining shape checking, block validation, mode handling, and list filtering in one method, making future modifications error-prone.

Standards:

  • SOLID-SRP
  • Clean-Code-Functions
Redundant Warning Message

Warning message displays on every activation without a targeted block, which could create excessive console spam. Consider showing this only when user explicitly switches to AutoSelect mode while active.

Standards:

  • Logic-Verification-User-Experience
  • Business-Rule-Validation
Target Selection Validation

AutoSelect mode stores target block without validation beyond type checking. An attacker could potentially manipulate targeting to select restricted blocks. Consider adding allowlist validation for sensitive block types.

Standards:

  • CWE-284
  • OWASP-A01

Comment on lines 273 to 282
if (listMode.get() == ListMode.AutoSelect) {
HitResult hitResult = mc.crosshairTarget;
if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
autoSelectBlock = mc.world.getBlockState(pos).getBlock();
} else {
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
}
}
Copy link

Choose a reason for hiding this comment

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

Missing Null Check

Missing null check for mc.world before accessing it. If world is null, this will cause NullPointerException when trying to get block state.

Standards
  • ISO-IEC-25010-Reliability-Fault-Tolerance
  • ISO-IEC-25010-Functional-Correctness-Appropriateness
  • DbC-Preconditions

Comment on lines 273 to 282
if (listMode.get() == ListMode.AutoSelect) {
HitResult hitResult = mc.crosshairTarget;
if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
autoSelectBlock = mc.world.getBlockState(pos).getBlock();
} else {
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
}
}
Copy link

Choose a reason for hiding this comment

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

Missing Activation Check

The AutoSelect block targeting logic executes unconditionally on module activation without checking if the world and player are initialized. This could cause NullPointerException if module activates during world loading or menu screens.

Standards
  • Logic-Verification-Null-Safety
  • Business-Rule-Validation
  • Algorithm-Correctness-Preconditions

Comment on lines +285 to 290
@Override
public void onDeactivate() {
if (listMode.get() == ListMode.AutoSelect) {
autoSelectBlock = null;
}
}
Copy link

Choose a reason for hiding this comment

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

Missing Reset Logic

onDeactivate() only resets autoSelectBlock for AutoSelect mode but ignores other state variables. This creates inconsistent state management where some fields are reset conditionally while others aren't reset at all.

Standards
  • Clean-Code-Consistency
  • Design-Pattern-State

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (6)
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (6)

187-187: Make nullability explicit for autoSelectBlock.

autoSelectBlock can be null; annotate for clarity and tooling.

Apply:

-    private Block autoSelectBlock = null; // Internal field to store the selected block for AutoSelect mode
+    @org.jetbrains.annotations.Nullable
+    private Block autoSelectBlock; // Null when no selection captured

206-209: Color defaults change—double-check contrast/theme fit.

Minor: ensure these RGBA values read well in light/dark themes and are consistent with other modules.

Also applies to: 212-216


285-290: Always clear selection on deactivate.

Clearing regardless of current listMode simplifies state and avoids stale UI.

Apply:

-    public void onDeactivate() {
-        if (listMode.get() == ListMode.AutoSelect) {
-            autoSelectBlock = null;
-        }
-    }
+    public void onDeactivate() {
+        autoSelectBlock = null;
+    }

375-426: AutoSelect predicate: prefer BlockState.isOf; review UniformCube boundary.

  • Use BlockState.isOf for identity checks (clearer and safer than equals on Block).
  • UniformCube uses chebyshevDist >= range; this excludes the boundary layer. Confirm intended (off-by-one?). If inclusion is desired, switch to >.

Apply:

-                        case AutoSelect -> {
-                            if (autoSelectBlock == null || !blockState.getBlock().equals(autoSelectBlock))
-                                return;
-                        }
+                        case AutoSelect -> {
+                            if (autoSelectBlock == null || !blockState.isOf(autoSelectBlock)) return;
+                        }

If boundary should be inclusive:

-                            if (chebyshevDist(mc.player.getBlockPos().getX(), mc.player.getBlockPos().getY(),
-                                    mc.player.getBlockPos().getZ(), blockPos.getX(), blockPos.getY(),
-                                    blockPos.getZ()) >= range.get())
+                            if (chebyshevDist(mc.player.getBlockPos().getX(), mc.player.getBlockPos().getY(),
+                                    mc.player.getBlockPos().getZ(), blockPos.getX(), blockPos.getY(),
+                                    blockPos.getZ()) > range.get())
                                 return;

496-500: Getter can return null—annotate.

Expose nullability for callers (HUD/GUI).

Apply:

-    public Block getAutoSelectBlock() {
+    public @org.jetbrains.annotations.Nullable Block getAutoSelectBlock() {
         return autoSelectBlock;
     }

501-505: Enum extension: confirm config compatibility.

Adding AutoSelect is fine; verify enum values are serialized by name (not ordinal) so existing configs remain valid.

If ordinals are used anywhere, append-only at end is safest; otherwise add a migration. Also consider updating the “Selection mode.” description to mention AutoSelect captures the block at activation.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8a74ba3 and 692621f.

📒 Files selected for processing (1)
  • src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (6 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (2)
src/main/java/meteordevelopment/meteorclient/utils/world/BlockIterator.java (1)
  • BlockIterator (25-112)
src/main/java/meteordevelopment/meteorclient/utils/Utils.java (1)
  • Utils (75-630)
🔇 Additional comments (1)
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (1)

26-27: Correct imports for crosshair targeting.

Using BlockHitResult and HitResult is appropriate for reading the crosshair target.

Comment on lines 273 to 283
if (listMode.get() == ListMode.AutoSelect) {
HitResult hitResult = mc.crosshairTarget;
if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
autoSelectBlock = mc.world.getBlockState(pos).getBlock();
} else {
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
}
}
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Guard onActivate with Utils.canUpdate to prevent NPEs.

onActivate can be triggered when world/player is null (e.g., main menu, early join). Add a guard.

Apply:

     public void onActivate() {
         firstBlock = true;
         timer = 0;
         noBlockTimer = 0;
 
-        if (listMode.get() == ListMode.AutoSelect) {
+        if (!Utils.canUpdate()) {
+            autoSelectBlock = null;
+            return;
+        }
+        if (listMode.get() == ListMode.AutoSelect) {
             HitResult hitResult = mc.crosshairTarget;
             if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
                 BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
                 autoSelectBlock = mc.world.getBlockState(pos).getBlock();
             } else {
                 autoSelectBlock = null;
                 warning("No block is being targeted for auto-select mode.");
             }
         }
     }

Optional: capture selection when switching listMode to AutoSelect while enabled (via an onChanged callback), so users don’t have to toggle the module.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (listMode.get() == ListMode.AutoSelect) {
HitResult hitResult = mc.crosshairTarget;
if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
autoSelectBlock = mc.world.getBlockState(pos).getBlock();
} else {
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
}
}
}
public void onActivate() {
firstBlock = true;
timer = 0;
noBlockTimer = 0;
if (!Utils.canUpdate()) {
autoSelectBlock = null;
return;
}
if (listMode.get() == ListMode.AutoSelect) {
HitResult hitResult = mc.crosshairTarget;
if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
autoSelectBlock = mc.world.getBlockState(pos).getBlock();
} else {
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
}
}
}
🤖 Prompt for AI Agents
In src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java
around lines 273 to 283, onActivate can run when mc/world/player are null
causing NPEs; add a guard using Utils.canUpdate() at the start of onActivate
(return early if false) before accessing mc.crosshairTarget/world/player, then
perform the AutoSelect logic only when the guard passes. Additionally
(optional), register an onChanged callback for listMode to run the same
selection logic when switching to AutoSelect while the module is enabled so
users don’t need to toggle the module to capture the current targeted block.

@visz11
Copy link
Collaborator

visz11 commented Sep 11, 2025

/refacto-test

@refacto-test
Copy link

refacto-test bot commented Sep 11, 2025

Refacto is reviewing this PR. Please wait for the review comments to be posted.

@refacto-test
Copy link

refacto-test bot commented Sep 11, 2025

Code Review: Nuker AutoSelect Implementation

👍 Well Done
Proper Error Handling

Warning message when no block targeted prevents silent failure.

Clean State Management

AutoSelect state properly cleared on module deactivation.

Feature Implementation Completeness

AutoSelect mode properly captures targeted block and maintains state throughout module lifecycle.

Proper Input Validation

Added validation for AutoSelect mode when no block is targeted.

📌 Files Processed
  • src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java
📝 Additional Comments
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (5)
Optimize Block Iteration

The block iteration process performs multiple conditional checks for each block in range. Consider early-exit optimization by checking the most restrictive conditions first (like AutoSelect block matching) before performing distance calculations. This would reduce unnecessary calculations when using AutoSelect mode, especially in dense areas with many blocks.

Standards:

  • ISO-IEC-25010-Performance-Time-Behaviour
  • Algorithm-Opt-Early-Exit
Incomplete Switch Logic

Switch statement lacks a default case to handle potential future ListMode enum values. If new modes are added without updating this switch, the logic will silently fall through without applying any filtering, potentially breaking the module's behavior.

Standards:

  • Logic-Verification-Completeness
  • Control-Flow-Exhaustiveness
Cache Player Position

Multiple calls to mc.player.getBlockPos() within the iteration lambda could be inefficient. Consider caching the player's BlockPos before the iteration to avoid repeated method calls for each block checked. This would reduce overhead in the hot path, especially when scanning large areas.

Standards:

  • ISO-IEC-25010-Performance-Resource-Utilization
  • Algorithm-Opt-Hot-Path
Extraction Opportunity

Block selection logic could be extracted to a separate method for better organization and potential reuse in other contexts.

Standards:

  • Clean-Code-Method-Extraction
  • SOLID-SRP
Missing Rate Limiting

AutoSelect implementation lacks rate limiting when selecting target blocks. Could allow rapid switching between different block types, potentially bypassing server-side anti-cheat mechanisms.

Standards:

  • CWE-770
  • OWASP-A04

Comment on lines 274 to 281
HitResult hitResult = mc.crosshairTarget;
if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
autoSelectBlock = mc.world.getBlockState(pos).getBlock();
} else {
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
}
Copy link

Choose a reason for hiding this comment

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

Missing Error Handling

Warning is displayed when no block is targeted, but module remains active in a potentially non-functional state. AutoSelect mode requires a valid block selection to function properly, yet the module continues execution without validating this critical requirement.

Suggested change
HitResult hitResult = mc.crosshairTarget;
if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
autoSelectBlock = mc.world.getBlockState(pos).getBlock();
} else {
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
}
if (hitResult != null && hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos pos = ((BlockHitResult) hitResult).getBlockPos();
autoSelectBlock = mc.world.getBlockState(pos).getBlock();
} else {
autoSelectBlock = null;
warning("No block is being targeted for auto-select mode.");
toggle();
}
Standards
  • Logic-Verification-Preconditions
  • Business-Rule-Validation
  • Algorithm-Correctness-State-Validation

Comment on lines +285 to +289
@Override
public void onDeactivate() {
if (listMode.get() == ListMode.AutoSelect) {
autoSelectBlock = null;
}
Copy link

Choose a reason for hiding this comment

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

Missing State Reset

The onDeactivate method only resets autoSelectBlock but doesn't call the parent class implementation. This could lead to incomplete state reset when module is deactivated.

Standards
  • Clean-Code-Method-Completeness
  • Design-Pattern-Template-Method

Comment on lines +410 to +412
case AutoSelect -> {
if (autoSelectBlock == null || !blockState.getBlock().equals(autoSelectBlock))
return;
Copy link

Choose a reason for hiding this comment

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

Unrestricted Block Breaking

AutoSelect mode allows breaking specific blocks without rate limiting. Malicious users could target valuable blocks for rapid destruction, potentially causing server-side performance issues or griefing.

Suggested change
case AutoSelect -> {
if (autoSelectBlock == null || !blockState.getBlock().equals(autoSelectBlock))
return;
if (autoSelectBlock == null || !blockState.getBlock().equals(autoSelectBlock))
return;
// Apply rate limiting for AutoSelect mode
if (timer < delay.get()) return;
Standards
  • CWE-284
  • OWASP-A01

…orld/Nuker.java

Co-authored-by: refacto-test[bot] <217047508+refacto-test[bot]@users.noreply.github.com>
@codeant-ai
Copy link

codeant-ai bot commented Jan 5, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jan 5, 2026
@codeant-ai
Copy link

codeant-ai bot commented Jan 5, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • AutoSelect behavior
    The AutoSelect block type is only captured once in onActivate(). If the player changes where they're aiming while the module is active the autoSelectBlock will not update, which can result in no blocks being selected/broken or the module breaking a stale block type. Consider updating the selected block while active or providing an explicit "reselect" interaction.

  • AutoSelect and block iteration interaction
    The BlockIterator filtering uses the autoSelectBlock field at iteration time. Ensure the field is kept up-to-date while iterating (see the first issue). Also validate that the block identity comparison (blockState.getBlock().equals(autoSelectBlock)) matches how blocks are represented in your BlockListSetting so there are no mismatches between instances or registries.

  • Lifecycle cleanup
    autoSelectBlock is cleared in onDeactivate() only when listMode == ListMode.AutoSelect. If listMode changes while the module is active (or if other code paths expect clearing) a stale block reference can remain. Consider unconditionally clearing the field on deactivate and/or clearing it on switching away from AutoSelect.

Comment on lines +376 to +377
BlockIterator.register(Math.max((int) Math.ceil(range.get() + 1), maxh),
Math.max((int) Math.ceil(range.get()), maxv), (blockPos, blockState) -> {
Copy link

Choose a reason for hiding this comment

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

Suggestion: When switching from cube to uniform cube shape, the maxh/maxv values computed for the cube shape are still used inside BlockIterator.register, causing the iterator to scan a much larger volume than the current range requires, which can severely degrade performance by iterating over far more blocks than necessary. [possible bug]

Severity Level: Critical 🚨

Suggested change
BlockIterator.register(Math.max((int) Math.ceil(range.get() + 1), maxh),
Math.max((int) Math.ceil(range.get()), maxv), (blockPos, blockState) -> {
int hRadius;
int vRadius;
if (shape.get() == Shape.Cube) {
hRadius = maxh;
vRadius = maxv;
} else {
hRadius = (int) Math.ceil(range.get() + 1);
vRadius = (int) Math.ceil(range.get());
}
BlockIterator.register(hRadius, vRadius, (blockPos, blockState) -> {
Why it matters? ⭐

The suggestion correctly points out a real performance bug. maxh/maxv are computed only in the branch for the non-sphere/non-uniform cube (the code sets them inside the else for shape != UniformCube). If the user switches from Cube to UniformCube without resetting maxh/maxv, the previously computed larger values remain and Math.max(...) will pick those, causing BlockIterator to scan a much bigger volume than required by the uniform cube range. The proposed conditional selection of radii limits the iterator to the actual needed bounds for UniformCube and avoids unnecessary iterations.

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java
**Line:** 376:377
**Comment:**
	*Possible Bug: When switching from cube to uniform cube shape, the `maxh`/`maxv` values computed for the cube shape are still used inside `BlockIterator.register`, causing the iterator to scan a much larger volume than the current `range` requires, which can severely degrade performance by iterating over far more blocks than necessary.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.

@codeant-ai
Copy link

codeant-ai bot commented Jan 5, 2026

CodeAnt AI finished reviewing your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants