-
-
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
Check Line of sight in Aim Assist #886
Conversation
WalkthroughThe changes primarily focus on enhancing the functionality of the 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: 0
Files selected for processing (1)
- src/main/java/net/wurstclient/hacks/AimAssistHack.java (5 hunks)
Additional comments (Suppressed): 5
src/main/java/net/wurstclient/hacks/AimAssistHack.java (5)
13-21: New import statements have been added to support the line of sight checking feature. Ensure these classes are available in the project dependencies.
49-53: A new checkbox setting
checkLOS
has been added to enable or disable line of sight checking. This is a good addition for user flexibility.85-85: The new
checkLOS
setting is added to the settings list. This is necessary for the setting to be visible and adjustable in the user interface.98-103: The
triggerBotHack
has been removed from the list of hacks that are disabled whenAimAssistHack
is enabled. Verify if this is intentional and won't cause any conflicts or undesired behavior.136-150: The line of sight checking logic has been added. If the
checkLOS
setting is enabled, it performs a raycast from the player's eyes to the target. If the raycast hits anything (i.e., there's an obstruction), it sets the target to null and returns. This is a good addition for preventing attacks through obstructions.
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/hacks/AutoSwordHack.java (4 hunks)
Additional comments (Suppressed): 3
src/main/java/net/wurstclient/hacks/AutoSwordHack.java (3)
10-14: The import of
java.util.stream.Stream
is new and is used in the new methodisCorrectEntity(Entity entity)
. Ensure that this import doesn't conflict with any otherStream
imports in the project.29-29: The import of
net.wurstclient.util.EntityUtils
is new and is used in the new methodisCorrectEntity(Entity entity)
. Ensure that this import doesn't conflict with any otherEntityUtils
imports in the project.82-83: The new
isCorrectEntity(Entity entity)
method is used to check if the targeted entity is attackable. This is a good addition as it prevents the sword from being pulled out when the entity is a friend.
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.
Hi @TejasLamba2006, thanks for your contributions! However, could you please split these changes into separate pull requests? That way it's much easier to label, review and potentially merge each change. A combined pull request with unrelated changes can be hard to keep track of, as GitHub isn't really designed to work this way. Appreciate your understanding here!
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/hacks/AutoSwordHack.java (4 hunks)
Additional comments (Suppressed): 2
src/main/java/net/wurstclient/hacks/AutoSwordHack.java (2)
26-32: The import statement for
net.wurstclient.util.EntityUtils
has been added. This utility class is likely used for the newisCorrectEntity()
method.78-87: The
onUpdate()
method now includes a check usingisCorrectEntity()
before callingsetSlot()
. This change prevents the sword from being pulled out if the entity is identified as a non-attackable entity.
✔️The build successfully compiles and works, checked personally |
@Alexander01998, is the pull okay now? |
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: 0
Files selected for processing (1)
- src/main/java/net/wurstclient/hacks/AimAssistHack.java (5 hunks)
Additional comments (Suppressed): 5
src/main/java/net/wurstclient/hacks/AimAssistHack.java (5)
13-28: The new imports
net.minecraft.util.hit.HitResult
,net.minecraft.util.math.Vec3d
,net.minecraft.world.RaycastContext
, andnet.wurstclient.settings.CheckboxSetting
are introduced to support the new line of sight checking feature and the checkbox setting.46-54: A new checkbox setting
checkLOS
is introduced. When enabled, the hack will not aim at entities that are obstructed by blocks. This is a good addition for user control and flexibility.79-85: The new checkbox setting
checkLOS
is added to the settings of theAimAssistHack
class. This ensures that the setting is visible and adjustable in the user interface.95-100: The
triggerBotHack
is no longer being disabled in theonEnable
method. If this is intentional and thetriggerBotHack
is compatible with theAimAssistHack
, then this change is fine. If not, this could lead to conflicts between the hacks.- WURST.getHax().triggerBotHack.setEnabled(false);
- 133-149: The
onUpdate
method now includes a check for line of sight when thecheckLOS
setting is enabled. This is done using raycasting from the player's eyes to the target entity. If the raycast hits a block, the target entity is set to null and the method returns. This is a good implementation of the line of sight feature, but it might have performance implications due to the raycasting operation. Consider optimizing this if it becomes a performance issue.
Thanks @coderabbitai, I missed that one. Fix commit coming up. |
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: 0
Files selected for processing (1)
- src/main/java/net/wurstclient/hacks/AimAssistHack.java (4 hunks)
Additional comments (Suppressed): 3
src/main/java/net/wurstclient/hacks/AimAssistHack.java (3)
46-50: The new
CheckboxSetting
checkLOS
is introduced to allow users to enable or disable the line of sight check. This is a good addition for user flexibility.79-82: The
checkLOS
setting is added to the settings list. This is necessary for the setting to be visible and adjustable in the user interface.134-147: The
onUpdate()
method is updated to include a line of sight check when thecheckLOS
setting is enabled. This is done by raycasting from the player's eyes to the target entity. If the raycast hits a block (i.e., the hit result type is notMISS
), the target is set to null, preventing aim assist. This is a good implementation of the line of sight check.However, there's a potential performance issue. Raycasting can be an expensive operation, especially if it's done every update. Consider adding a condition to perform the raycast less frequently, for example, every few ticks instead of every tick.
Here's a possible way to implement this:
private int tickCounter = 0; ... if(tickCounter++ % 5 == 0 && checkLOS.isChecked() && MC.world .raycast(new RaycastContext(eyesPos, hitVec, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.NONE, MC.player)) .getType() != HitResult.Type.MISS) { target = null; return; }This code will perform the raycast every 5 ticks instead of every tick, reducing the performance impact.
@TejasLamba2006 It's good now. I've adjusted the "Check line of sight" description, since AimAssist can't actually make you reach through blocks, and changed the setting to be enabled by default. Just so you know, I'm going to merge this pull request into the v7.38 branch, so GitHub won't mark it as merged until Wurst 7.38 is released. |
Cool ! Looking forward to contribute more, If you have a discord I would love to talk |
Added
New Features:
AimAssistHack
: Added a new option to enable line of sight checking. When enabled, the target will be set to null if there's an obstruction between the player and the target.Summary by CodeRabbit