Skip to content
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

ElytraLock, a useful module for tracking fleeing players through the air. #1107

Closed
wants to merge 2 commits into from

Conversation

3zad
Copy link

@3zad 3zad commented Jan 16, 2025

This module will aim towards players while using an elytra, making for a very effective tracker. This module works similarly to BowAimbot, but differs in some notable ways. This module is also effective against phantoms, even without killaura.

Activation:

  • The module only works when the jump key is pressed.
  • The module will lock on the nearest player or selected entity when flying, and after the cooldown period has ended.

Cooldown:

  • A cooldown will allow the player to launch and gain some speed before locking on another player/entity. The cooldown starts when the player starts using the elytra and ends once the player has been in the air for a certain amount of time.
  • The time can be changed in the module's settings. The units of time are arbitrary.

Filters:

  • By default, all entities other than players are filtered out.

Testing:

  • This module does not interfere with ExtraElytra.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link

coderabbitai bot commented Jan 16, 2025

Walkthrough

This pull request introduces a new feature called ElytraLockHack to a game client, expanding the existing HackList functionality. The implementation involves three primary components: adding a new field in the HackList class, creating a new ElytraLockHack class with detailed targeting and rendering logic, and developing an ElytraLockFilterList to manage entity filtering.

The ElytraLockHack provides players with the ability to lock onto entities while gliding with an elytra, offering customizable targeting priorities and visual indicators. The accompanying ElytraLockFilterList enables granular control over which entities can be targeted, including options for filtering players, hostile mobs, neutral mobs, and specific entity types.

The changes are focused on extending the game client's capabilities with a specialized elytra-related targeting mechanism, introducing new classes and methods to support this functionality.

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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. (Beta)
  • @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.

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: 2

🧹 Nitpick comments (2)
src/main/java/net/wurstclient/hacks/ElytraLockHack.java (1)

58-58: Typo in the setting description.

There's a typo in the description for the "Angle" priority. The word "Aimes" should be "Aims".

Apply this diff to fix the typo:

-					+ "\u00a7lAngle\u00a7r - Aimes at the entity that requires the least head movement.\n"
+					+ "\u00a7lAngle\u00a7r - Aims at the entity that requires the least head movement.\n"
src/main/java/net/wurstclient/settings/filterlists/ElytraLockFilterList.java (1)

37-39: Inconsistent description for FilterPassiveWaterSetting.

The description mentions "when auto-placing," which seems out of context for this hack. It should probably say "when locking in" to be consistent with other filter descriptions.

Apply this diff to correct the description:

-            builder.add(new FilterPassiveWaterSetting("Won't target passive water"
-                    + " mobs like fish, squid, dolphins and axolotls when auto-placing", true));
+            builder.add(new FilterPassiveWaterSetting("Won't target passive water"
+                    + " mobs like fish, squid, dolphins and axolotls when locking in.", true));
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 52f7518 and 5aa2c7e.

📒 Files selected for processing (3)
  • src/main/java/net/wurstclient/hack/HackList.java (1 hunks)
  • src/main/java/net/wurstclient/hacks/ElytraLockHack.java (1 hunks)
  • src/main/java/net/wurstclient/settings/filterlists/ElytraLockFilterList.java (1 hunks)
🔇 Additional comments (2)
src/main/java/net/wurstclient/hacks/ElytraLockHack.java (1)

140-144: Verify the calculation of velocity using getItemUseTimeLeft().

In the context of elytra flight, using player.getItemUseTimeLeft() may not provide the intended value for calculating velocity. This method relates to the remaining use time of an item, like drawing a bow or eating food. Please verify that this is the correct method for obtaining velocity during elytra flight.

src/main/java/net/wurstclient/hack/HackList.java (1)

92-92: LGTM! The ElytraLockHack integration follows the established patterns.

The new field is properly declared and positioned alphabetically in the HackList class. It will be automatically initialized and managed by the existing reflection-based system.

Let's verify the claimed compatibility with ExtraElytra module:

✅ Verification successful

Verified: ElytraLockHack is compatible with ExtraElytra

The implementation uses standard Minecraft APIs for elytra state detection and only handles player rotation, without modifying elytra mechanics. This ensures it works safely alongside other elytra-related modules.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential conflicts between ElytraLock and ExtraElytra

# Search for any shared resource access or conflicting operations
ast-grep --pattern 'class ElytraLockHack {
  $$$
  onElytra$_() {
    $$$
  }
  $$$
}'

# Look for any direct interactions between the modules
rg -l "ElytraLock.*ExtraElytra|ExtraElytra.*ElytraLock"

Length of output: 146


Script:

#!/bin/bash
# First, find the ElytraLockHack implementation
fd -e java ElytraLock

# Then look for any mentions of ExtraElytra in these files
rg -A 5 -B 5 "ExtraElytra" $(fd -e java ElytraLock)

# Also search for any elytra-related method calls that might show interaction
ast-grep --pattern 'class ElytraLockHack {
  $$$
  public void on$_() {
    $$$
  }
  $$$
}'

Length of output: 436


Script:

#!/bin/bash
# Examine ElytraLockHack implementation
cat src/main/java/net/wurstclient/hacks/ElytraLockHack.java

# Look for any elytra-related event handlers or state checks
rg -A 5 "isWearingElytra|elytra\.is|elytra\." src/main/java/net/wurstclient/hacks/ElytraLockHack.java

Length of output: 10052

Comment on lines +148 to +154
double posX = target.getX() + (target.getX() - target.lastRenderX) * d
- player.getX();
double posY = target.getY() + (target.getY() - target.lastRenderY) * d
+ target.getHeight() * 0.5 - player.getY()
- player.getEyeHeight(player.getPose());
double posZ = target.getZ() + (target.getZ() - target.lastRenderZ) * d
- player.getZ();
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Reference to non-existent fields lastRenderX, lastRenderY, lastRenderZ.

The fields lastRenderX, lastRenderY, and lastRenderZ do not exist in the Entity class. Accessing these fields will cause a compilation error. You may need to use prevX, prevY, and prevZ, or appropriate methods to get the previous position of the entity.

Apply this diff to fix the issue:

-    		double posX = target.getX() + (target.getX() - target.lastRenderX) * d
+    		double posX = target.getX() + (target.getX() - target.prevX) * d
-    		double posY = target.getY() + (target.getY() - target.lastRenderY) * d
+    		double posY = target.getY() + (target.getY() - target.prevY) * d
-    		double posZ = target.getZ() + (target.getZ() - target.lastRenderZ) * d
+    		double posZ = target.getZ() + (target.getZ() - target.prevZ) * d
📝 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
double posX = target.getX() + (target.getX() - target.lastRenderX) * d
- player.getX();
double posY = target.getY() + (target.getY() - target.lastRenderY) * d
+ target.getHeight() * 0.5 - player.getY()
- player.getEyeHeight(player.getPose());
double posZ = target.getZ() + (target.getZ() - target.lastRenderZ) * d
- player.getZ();
double posX = target.getX() + (target.getX() - target.prevX) * d
- player.getX();
double posY = target.getY() + (target.getY() - target.prevY) * d
+ target.getHeight() * 0.5 - player.getY()
- player.getEyeHeight(player.getPose());
double posZ = target.getZ() + (target.getZ() - target.prevZ) * d
- player.getZ();

Comment on lines +212 to +214
float v = 1 / velocity;
matrixStack.scale(v, v, v);

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential division by zero in scaling operation.

In the calculation float v = 1 / velocity;, if velocity equals zero, this will result in a division by zero error. Ensure that velocity is never zero before performing this operation.

Apply this diff to handle the potential division by zero:

+    		if (velocity == 0)
+    		    velocity = 0.0001F; // Set to a small positive value to avoid division by zero
    		float v = 1 / velocity;

Committable suggestion skipped: line range outside the PR's diff.

@3zad 3zad closed this Jan 16, 2025
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.

2 participants