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

vclip up/down integration with jesus hack #877 #887

Closed
wants to merge 1 commit into from
Closed

vclip up/down integration with jesus hack #877 #887

wants to merge 1 commit into from

Conversation

DottorManu
Copy link

@DottorManu DottorManu commented Oct 12, 2023

Solving Issue: #877

Description

The code now checks if JesusHack is enabled, and if it is, when the .vclip command teleports you into fluids, it relocates you above them.

(Optional) screenshots / videos

PoC.mp4

Summary by CodeRabbit

  • New Feature: Enhanced the "vclip" command in the Wurst Client. When the "jesusHack" feature is enabled, the player's position will now be adjusted to stay above liquid blocks. This improvement provides a smoother and more intuitive user experience when navigating through liquid terrains.

@coderabbitai
Copy link

coderabbitai bot commented Oct 12, 2023

Walkthrough

The proposed change introduces a new feature to the 'vclip' command in the WurstClient. When the 'jesusHack' is enabled, the player's position is adjusted to stay above liquid blocks, adding a new layer of functionality and dependency on the 'WurstClient' class.

Changes

File Summary
.../net/wurstclient/commands/VClipCmd.java The 'vclip' command now checks for the 'jesusHack' feature. If enabled, the player's position is adjusted to stay above liquid blocks. This introduces a dependency on the 'WurstClient' class and modifies the 'vclip' command's logic.

🐇

"In the realm of code, where logic is the track,

A clever rabbit tweaked a hack.

With 'jesusHack' in play, fear no liquid's smack,

Stay afloat, dear player, no looking back!" 🎉


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

@CLAassistant
Copy link

CLAassistant commented Oct 12, 2023

CLA assistant check
All committers have signed the CLA.

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.

Review Status

Actionable comments generated: 1

Commits Files that changed from the base of the PR and between c89f5e3 and 4dcd3c0.
Files selected for processing (1)
  • src/main/java/net/wurstclient/commands/VClipCmd.java (2 hunks)
Additional comments (Suppressed): 2
src/main/java/net/wurstclient/commands/VClipCmd.java (2)
  • 19-19: The import statement for net.wurstclient.WurstClient is new. Ensure that the WurstClient class is available in the classpath and that it provides the necessary methods and properties used in the new code.

  • 109-117: The new code introduces a dependency on the WurstClient class and its jesusHack property. It checks if the jesusHack feature is enabled and if the player is over liquid, it adjusts the player's position to stay above the liquid. This change modifies the behavior of the vclip method and could potentially impact other parts of the code that rely on this method. Ensure that these changes do not introduce undesired side effects.

Comment on lines +112 to +116
if(WurstClient.INSTANCE.getHax().jesusHack.isEnabled())
{
while(WurstClient.INSTANCE.getHax().jesusHack.isOverLiquid())
p.setPosition(p.getX(), p.getY() + 1, p.getZ());
}
Copy link

@coderabbitai coderabbitai bot Oct 12, 2023

Choose a reason for hiding this comment

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

The while loop here could potentially lead to an infinite loop if the isOverLiquid method always returns true. Consider adding a maximum limit to the number of iterations or a timeout to prevent this.

- while(WurstClient.INSTANCE.getHax().jesusHack.isOverLiquid())
+ for(int i = 0; i < MAX_ITERATIONS && WurstClient.INSTANCE.getHax().jesusHack.isOverLiquid(); i++)

Copy link
Member

@Alexander01998 Alexander01998 Oct 12, 2023

Choose a reason for hiding this comment

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

Agreed. Also the vclip() method seems like the wrong place to put a check like this. It would completely ignore existing block collision checks and change the height even if the user requested an exact number (e.g. by typing .vclip 5).

Copy link

Choose a reason for hiding this comment

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

@Alexander01998: You're correct. The current implementation could potentially override the user's input and cause unexpected behavior. A better approach might be to separate the logic for the 'JesusHack' feature from the 'vclip' command. This way, the 'vclip' command can maintain its original functionality, and the 'JesusHack' feature can be applied separately when needed.

Here's a possible solution:

private void vclip(double height)
{
    ClientPlayerEntity p = MC.player;
    p.setPosition(p.getX(), p.getY() + height, p.getZ());

    if(WurstClient.INSTANCE.getHax().jesusHack.isEnabled())
    {
        adjustForJesusHack(p);
    }
}

private void adjustForJesusHack(ClientPlayerEntity p)
{
    for(int i = 0; i < MAX_ITERATIONS && WurstClient.INSTANCE.getHax().jesusHack.isOverLiquid(); i++)
    {
        p.setPosition(p.getX(), p.getY() + 1, p.getZ());
    }
}

In this solution, the 'vclip' command will always teleport the player by the specified height. If the 'JesusHack' feature is enabled, the player's position will be further adjusted to stay above any liquid blocks. This adjustment is done in a separate method to keep the 'vclip' method simple and focused on its main task. The 'adjustForJesusHack' method includes a limit on the number of iterations to prevent potential infinite loops.

Copy link
Member

@Alexander01998 Alexander01998 Oct 12, 2023

Choose a reason for hiding this comment

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

No, not like that. VClipCmd has a separate hasCollisions() method that's made for this purpose. Actually, looking at the code, that method already does basically the same thing as Jesus. I wonder why that wouldn't teleport the player above liquids. @nobotreply

Copy link

Choose a reason for hiding this comment

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

Looks like humans are talking. I'll be quiet for now. If you need me again, just tag @coderabbitai in a new comment.

@Alexander01998 Alexander01998 linked an issue Oct 12, 2023 that may be closed by this pull request
@Alexander01998
Copy link
Member

Alexander01998 commented Oct 12, 2023

Hey @DottorManu! Thanks for your pull request. I just ran a test and found that the current implementation of .vclip already teleports the user above liquids when Jesus is enabled.

vclip.jesus-hb.mp4

Therefore, it seems that issue #877 can actually be closed as it has already been addressed.

@DottorManu DottorManu deleted the vclip-up/down-integration-with-jesus-hack-#877 branch October 12, 2023 17:52
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.

vclip up/down integration with jesus hack
3 participants