Skip to content

Add auto-select mode to nuker #1

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
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

arvi18
Copy link

@arvi18 arvi18 commented Apr 16, 2025

Type of change

  • Bug fix
  • New feature

Description

Added a new whitelist mode 'AutoSelect'. It can just select the block you are looking at when active.
This is convenient when using keybind to mine specific blocks and also can be switched through activation.

Related issues

Mention any issues that this pr relates to.

How Has This Been Tested?

It works on my local test.

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 "AutoSelect" mode to the Nuker module, allowing automatic targeting of the block type currently under the player's crosshair.
  • Improvements
    • Enhanced block selection logic for more flexible block breaking based on the selected mode.

@gandalf-repo
Copy link

@coderabbitai full review

Copy link

coderabbitai bot commented Apr 16, 2025

✅ Actions performed

Full review triggered.

Copy link

coderabbitai bot commented Apr 16, 2025

Walkthrough

The Nuker module was updated to introduce a new ListMode option called AutoSelect. This mode enables the module to automatically target and break only the block type currently under the player's crosshair when the module is activated. The implementation includes a new private field to store the selected block type, logic to set and clear this field on activation and deactivation, and updated block filtering to utilize this new mode. Additionally, a public getter for the selected block was added, and the ListMode enum was extended to include AutoSelect.

Changes

File(s) Change Summary
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java Added AutoSelect to ListMode, introduced autoSelectBlock field, updated activation/deactivation logic, modified block filtering, added getAutoSelectBlock() method, and made minor formatting changes.

Sequence Diagram(s)

sequenceDiagram
    participant Player
    participant NukerModule

    Player->>NukerModule: Activate (with ListMode = AutoSelect)
    NukerModule->>Player: Get block under crosshair
    NukerModule->>NukerModule: Set autoSelectBlock
    loop OnTickPre event
        NukerModule->>NukerModule: Check block matches autoSelectBlock
        alt Match
            NukerModule->>NukerModule: Break block
        end
    end
    Player->>NukerModule: Deactivate
    NukerModule->>NukerModule: Clear autoSelectBlock
Loading

Poem

In the world of blocks, a new trick to detect,
Nuker now learns to AutoSelect!
With a glance of your eye, it knows what you seek,
Breaking just that, week after week.
A bunny hops by, with a wink and a cheer—
“Precise destruction is finally here!”
🐰✨

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a548ee7 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 (8)
src/main/java/meteordevelopment/meteorclient/systems/modules/world/Nuker.java (8)

26-27: Appropriate imports added for the new feature.

The imports for BlockHitResult and HitResult are needed to implement the AutoSelect mode functionality for capturing the block under the player's crosshair.


187-187: Good implementation of storage for AutoSelect mode.

The private field to store the selected block is properly initialized to null and includes a helpful comment explaining its purpose.


273-282: Well-implemented crosshair block detection with good error handling.

The implementation correctly retrieves the block the player is looking at when AutoSelect mode is active. The code includes appropriate null checks and type verification, and provides a warning message if no block is targeted.


285-289: Proper cleanup on module deactivation.

The code correctly clears the selected block when the module is deactivated, which is good practice for maintaining clean state management.


408-422: Clean implementation of the list mode filtering with switch structure.

The code reorganized the list mode filtering using a switch statement, which improves readability and maintainability compared to if-else chains. The AutoSelect case correctly checks if a block is selected and matches the current block being processed.


497-499: Appropriate getter method for GUI access.

The addition of a public getter method for the autoSelectBlock field follows good encapsulation practices and provides clear access for GUI components or other modules that need to display the currently selected block.


501-505: Correctly extended enum with new mode option.

The ListMode enum has been properly extended to include the new AutoSelect option, maintaining the existing Whitelist and Blacklist options.


376-426:

❓ Verification inconclusive

Verify the updated block iterator logic.

The code for BlockIterator registration and filtering looks good, but it would be worth testing edge cases where no block is targeted or when quickly switching target blocks.

Consider testing the following scenarios:

  1. Activating the module while not looking at any block
  2. Switching between different blocks while the module is active
  3. Performance with large range values in areas with many blocks

🏁 Script executed:

#!/bin/bash
# Check for any other references to listMode in the codebase that might need updates
rg "listMode\.get\(\)" --type java

Length of output: 2347


Action: Confirm Edge Case Handling for Block Iterator Filtering Logic

The updated block iterator registration in Nuker.java appears consistent with similar usages across the codebase (e.g., in AutoTool, Slippy, and LiquidFiller). While the filtering logic itself looks correct, please ensure to manually verify the following edge cases to confirm that the dynamic block-target scenarios behave as expected:

  • Activating the module when no block is targeted.
  • Quickly switching between target blocks while the module remains active.
  • Performance impact in densely populated block areas with large range values.
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants