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

Fix ArrayList module overlap bug #834

Merged
merged 47 commits into from
Nov 2, 2024
Merged

Fix ArrayList module overlap bug #834

merged 47 commits into from
Nov 2, 2024

Conversation

KgDW
Copy link

@KgDW KgDW commented Nov 1, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced dependency management and project configuration for improved build clarity.
    • Simplified rendering logic in the ArrayList module for better performance and readability.
  • Bug Fixes

    • Corrected rendering conditions to rely directly on module states, ensuring accurate visual representation.
  • Documentation

    • Updated version declaration for clearer project versioning.

xia-mc and others added 30 commits October 1, 2024 21:03
Improve Hypixel mode of Step
Add 'Fix hypixel switch (beta)' to KillAura
Add "Store","Timer" mode to rapid fire of RageBot
Add No spread to RageBot
Add ignoreTeammatesCSGO to RageBot
Fix RageBot select hit pos wrongly
Add Snap mode to AntiAim
Add onlyWhileSneaking to AntiAim
Fix freeze issue of HypixelMotionDisabler
Fix Post issue of RageBot
Fix WatchdogAutoPhase
Fix bad packet send/receive
Fix LegitNoSpread keep switching
Add 'Legit switch' to rapid fire
Fix SnapAntiAim rotate wrongly
Fix StoreRapidFire always store
Add window title
Add 'reflection' to Script API.
Example:
```java
reflection.set(
    modules.getModule("TimerRange"),
    "hasLag", 0
);
```
In this case, we reset the 'hasLag' variable of TimerRange module to 0. reflection allows to change the module itself.
See ```keystrokesmod.utility.Reflection``` to know more about the reflection API.
Stop using deprecation feature (event bus)
Remove SilenceIRC
Fix Scale option of KillAura
Remove KillAuraV2
xia-mc and others added 17 commits October 17, 2024 12:02
Fix HypixelBlinkNoFall
Improve HypixelTower
remove useless image
Add ScaffoldC check to Anticheat
Improve Hypixel mode of Velocity
Fix JumpD sprint mode of Scaffold buggy
Remove Aim checks from Anticheat (reason: useless)
# Conflicts:
#	src/main/java/keystrokesmod/mixins/impl/client/MixinMinecraft.java
#	src/main/java/keystrokesmod/module/ModuleManager.java
#	src/main/java/keystrokesmod/module/impl/combat/KillAura.java
#	src/main/java/keystrokesmod/module/impl/combat/autoclicker/DragClickAutoClicker.java
#	src/main/java/keystrokesmod/module/impl/combat/autoclicker/RecordAutoClicker.java
#	src/main/java/keystrokesmod/module/impl/movement/longjump/HypixelFireballLongJump.java
#	src/main/java/keystrokesmod/module/impl/movement/longjump/hypixelfireball/SameYHypixelFireballLongJump.java
#	src/main/java/keystrokesmod/module/impl/movement/step/HypixelStep.java
#	src/main/java/keystrokesmod/module/impl/other/Anticheat.java
#	src/main/java/keystrokesmod/module/impl/other/RotationHandler.java
#	src/main/java/keystrokesmod/module/impl/other/anticheats/Check.java
#	src/main/java/keystrokesmod/module/impl/render/Watermark.java
#	src/main/java/keystrokesmod/module/impl/world/Tower.java
#	src/main/java/keystrokesmod/module/impl/world/tower/HypixelTower.java
#	src/main/java/keystrokesmod/utility/Commands.java
#	src/main/java/keystrokesmod/utility/Reflection.java
…owdown' to KillAura

Add 'progressbar' to BreakProgress
Improve RavenNewTargetHUD
Fix Simulation watchdog flags issue
# Conflicts:
#	src/main/java/keystrokesmod/mixins/impl/entity/MixinEntityPlayerSP.java
#	src/main/java/keystrokesmod/module/impl/movement/speed/HypixelSpeed.java
#	src/main/java/keystrokesmod/module/impl/other/RotationHandler.java
#	src/main/java/keystrokesmod/module/impl/render/Watermark.java
# Conflicts:
#	src/main/java/keystrokesmod/module/impl/combat/AutoGapple.java
#	src/main/java/keystrokesmod/module/impl/render/ArrayList.java
Copy link

coderabbitai bot commented Nov 1, 2024

📝 Walkthrough

Walkthrough

The changes in this pull request involve updates to the build.gradle file and modifications to the ArrayList and ArrayListModule classes. The build.gradle file has been revised for dependency management, including a new project version declaration and adjustments to the repositories and dependencies sections. The ArrayList class has simplified its updateArrayList method and refined rendering logic, while the ArrayListModule class has modified the shouldRender method to check the module's enabled state directly.

Changes

File Path Change Summary
build.gradle - Version declaration changed from commented to active (//version = "Dev"version = "Dev").
- Updated repositories to include "forge".
- Refined dependencies with specific exclusions for mixin and added org.jetbrains:annotations:24.1.0.
- Modified processResources task to include version properties.
- Adjusted jar task to include mixin configurations and FML core plugin metadata.
src/main/java/keystrokesmod/module/impl/render/ArrayList.java - Updated updateArrayList method to remove IFont parameter and simplified logic with a single stream operation.
- Changed shadowExtra calculation in render method to use 0.5 * size.getInput().
- Streamlined canRender method to return boolean based on the experimental category state.
src/main/java/keystrokesmod/module/impl/render/arraylist/ArrayListModule.java - Modified shouldRender method to return module.isEnabled() instead of animeX.getValue() != 0.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ArrayList
    participant ArrayListModule

    User->>ArrayList: Request to render modules
    ArrayList->>ArrayList: Call updateArrayList()
    ArrayList->>ArrayList: Process organizedModules
    ArrayList->>ArrayListModule: Check if module is enabled
    ArrayListModule->>ArrayListModule: Return module.isEnabled()
    ArrayList->>User: Render modules based on enabled state
Loading

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 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 or auto anywhere in the PR title to generate the title automatically.

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

🧹 Outside diff range comments (2)
build.gradle (1)

Line range hint 67-69: Consider using Maven/Gradle dependencies instead of local jars.

Using local jar files (libraries/fastutil-core-8.5.14-javadoc.jar, libraries/json-20220924.jar, libraries/discord-rpc.jar) makes the build less reproducible and harder to maintain. Consider publishing these dependencies to a Maven repository or using existing Maven artifacts:

  • For JSON: org.json:json:20220924
  • For FastUtil: it.unimi.dsi:fastutil:8.5.14

Also applies to: 71-73

src/main/java/keystrokesmod/module/impl/render/ArrayList.java (1)

Line range hint 89-194: Comprehensive fix for module overlap.

The overlap bug has been addressed through multiple complementary changes:

  1. Reduced shadow size prevents visual overlap
  2. Improved module state management ensures accurate rendering
  3. Proper cleanup of disabled modules prevents stale entries

These changes work together to provide a robust solution to the overlap issue.

Consider adding unit tests to verify these fixes:

  • Test module cleanup on disable
  • Test shadow size calculations
  • Test module state transitions
    Would you like me to help create these tests?
🧰 Tools
🪛 ast-grep

[warning] 186-186: Detected a cookie where the Secure flag is either missing or disabled. The Secure cookie flag instructs the browser to forbid sending the cookie over an insecure HTTP request. Set the Secure flag to true so the cookie will only be sent over HTTPS.
Context: (module, new ArrayListModule(module))
Note: [CWE-614]: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute [OWASP A05:2021]: Security Misconfiguration [REFERENCES]
- https://owasp.org/Top10/A05_2021-Security_Misconfiguration


[warning] 186-186: Detected a cookie where the HttpOnly flag is either missing or disabled. The HttpOnly cookie flag instructs the browser to forbid client-side JavaScript to read the cookie. If JavaScript interaction is required, you can ignore this finding. However, set the HttpOnly flag to true` in all other cases.
Context: (module, new ArrayListModule(module))
Note: [CWE-1004]: Sensitive Cookie Without 'HttpOnly' Flag [OWASP A05:2021]: Security Misconfiguration [REFERENCES]
- https://owasp.org/Top10/A05_2021-Security_Misconfiguration

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE

📥 Commits

Reviewing files that changed from the base of the PR and between d2a6e9e and f0e19e3.

📒 Files selected for processing (3)
  • build.gradle (1 hunks)
  • src/main/java/keystrokesmod/module/impl/render/ArrayList.java (4 hunks)
  • src/main/java/keystrokesmod/module/impl/render/arraylist/ArrayListModule.java (1 hunks)
🧰 Additional context used
🪛 ast-grep
src/main/java/keystrokesmod/module/impl/render/ArrayList.java

[warning] 186-186: Detected a cookie where the Secure flag is either missing or disabled. The Secure cookie flag instructs the browser to forbid sending the cookie over an insecure HTTP request. Set the Secure flag to true so the cookie will only be sent over HTTPS.
Context: (module, new ArrayListModule(module))
Note: [CWE-614]: Sensitive Cookie in HTTPS Session Without 'Secure' Attribute [OWASP A05:2021]: Security Misconfiguration [REFERENCES]
- https://owasp.org/Top10/A05_2021-Security_Misconfiguration


[warning] 186-186: Detected a cookie where the HttpOnly flag is either missing or disabled. The HttpOnly cookie flag instructs the browser to forbid client-side JavaScript to read the cookie. If JavaScript interaction is required, you can ignore this finding. However, set the HttpOnly flag to true` in all other cases.
Context: (module, new ArrayListModule(module))
Note: [CWE-1004]: Sensitive Cookie Without 'HttpOnly' Flag [OWASP A05:2021]: Security Misconfiguration [REFERENCES]
- https://owasp.org/Top10/A05_2021-Security_Misconfiguration

🔇 Additional comments (6)
src/main/java/keystrokesmod/module/impl/render/arraylist/ArrayListModule.java (1)

29-29: Verify the visual transition behavior.

While this change fixes the overlap bug by ensuring modules are only rendered when enabled, it might cause abrupt visual transitions since modules now appear/disappear instantly instead of fading with the animation.

✅ Verification successful

Let me gather more information about the animation code to verify the impact on visual transitions.


Let me gather more information about the animation implementation to fully understand how the transitions work.


I now have enough information to provide a response about the visual transitions.

The change maintains smooth transitions despite the visibility change.

While the visibility check now uses module.isEnabled() directly, the animations are still properly handled:

  1. The module uses separate animations for both X and Y coordinates via animeX and animeY with EASE_OUT_EXPO easing
  2. The animations continue to run in onUpdate() with smooth transitions:
    • When enabled: animeX.run(1)
    • When disabled: animeX.run(0)
  3. The actual rendering position is calculated using the animation values in getPosX() and getPosY()

The change only affects when modules are rendered, not how smoothly they transition. The animations still provide smooth movement while modules are being enabled/disabled.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any related visual transition or rendering code
rg -A 5 "render|transition|fade" --type java

Length of output: 316647


Script:

#!/bin/bash
# Search for animation related code in the ArrayList module
ast-grep --pattern $'class ArrayListModule {
  $$$
  shouldRender() {
    $$$
  }
  $$$
}'

# Search for animation value usage
rg -A 5 "animeX" --type java

Length of output: 2214


Script:

#!/bin/bash
# Check the Animation class implementation
rg -A 10 "class Animation" --type java

# Look for animation value usage in rendering
ast-grep --pattern 'render($$$) {
  $$$
  getValue()
  $$$
}'

Length of output: 3946

build.gradle (2)

Line range hint 45-54: LGTM! Well-structured dependency management.

The dependency configuration is well organized:

  • Proper exclusions for mixin to avoid conflicts
  • Clear separation between implementation and embed configurations
  • Essential dependencies for Minecraft modding included

Also applies to: 56-63


Line range hint 75-102: LGTM! Correct resource processing and jar packaging.

The resource processing and jar packaging configuration is properly set up:

  • Correct handling of mcmod.info version expansion
  • Appropriate exclusions in jar packaging
  • Required FML and Mixin manifest attributes
src/main/java/keystrokesmod/module/impl/render/ArrayList.java (3)

179-181: LGTM: Simplified method signature.

Removing the unused IFont parameter improves the method's interface.


216-216: LGTM: Simplified conditional logic.

The ternary operator makes the code more concise while maintaining the same behavior.


99-99: LGTM: Shadow size reduction helps prevent overlap.

The reduction of shadowExtra from 1.0 to 0.5 times the size input should help prevent module overlap by reducing the shadow footprint.

Let's verify the visual impact:

✅ Verification successful

Verified: Shadow size reduction is consistently applied throughout the rendering logic

The change to shadowExtra calculation (0.5 multiplier) is correctly propagated through all its usages in the ArrayList module:

  • Used consistently in background rendering calculations
  • Applied uniformly for both left and right alignments
  • Affects blur and background rendering equally through the lineInterval calculation
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other shadow-related calculations that might need similar adjustment
rg -g '*.java' 'shadowExtra|shadow.*size' --type java

Length of output: 2278

@xia-mc xia-mc merged commit 9678fd0 into xia-mc:dev Nov 2, 2024
1 check failed
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