-
-
Notifications
You must be signed in to change notification settings - Fork 420
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
vclip up/down integration with jesus hack #877 #887
Conversation
Solving Issue: #877
WalkthroughThe 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
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this 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
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 theWurstClient
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 itsjesusHack
property. It checks if thejesusHack
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 thevclip
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.
if(WurstClient.INSTANCE.getHax().jesusHack.isEnabled()) | ||
{ | ||
while(WurstClient.INSTANCE.getHax().jesusHack.isOverLiquid()) | ||
p.setPosition(p.getX(), p.getY() + 1, p.getZ()); | ||
} |
There was a problem hiding this comment.
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++)
There was a problem hiding this comment.
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
).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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.mp4Therefore, it seems that issue #877 can actually be closed as it has already been addressed. |
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