-
Notifications
You must be signed in to change notification settings - Fork 52
Improved AimAssist #100
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
Improved AimAssist #100
Conversation
0x3C50
left a comment
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.
code style and a few descriptions, otherwise great
| .description("Where to aim") | ||
| .get()); | ||
| final DoubleSetting aimHeight = this.config.create(new DoubleSetting.Builder(1).name("Aim Height") | ||
| .description("Where to aim (in %)") |
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.
should probably elaborate on what that % affects
| .description("Whether or not to aim instantly instead of smoothly") | ||
| .get()); | ||
| final BooleanSetting aimRandom = this.config.create(new BooleanSetting.Builder(false).name("Aim random") | ||
| .description("Whether or not the laziness should have randomness") |
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.
"Randomize speed when aiming"
| .get()); | ||
| RangeSetting.Range defaultValue = new RangeSetting.Range(1, 100); | ||
| final RangeSetting aimRandomness = this.config.create(new RangeSetting.Builder(defaultValue).name("Randomness") | ||
| .description("The amount of randomness the lazyness should have") |
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.
"How strongly to affect speed when randomizing"
| if (!aimInstant.getValue()) { | ||
| if(aimMode.getValue() == AimMode.Top) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 1.3d), 0), (float) (modifiedLaziness)); |
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.
should this look at the head of an entity? in which case getEyePos()
| } else { | ||
| if(aimMode.getValue() == AimMode.Top) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 1.3d), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Middle) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 2d), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Bottom) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 4d), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Custom) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 100) * aimHeight.getValue(), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| } |
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.
surely this can be simplified down to avoid duplicate code
| else if (!aimRandom.getValue()) | ||
| { | ||
| if (!aimInstant.getValue()) { | ||
| if(aimMode.getValue() == AimMode.Top) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 1.3d), 0), (float) (laziness.getValue() + 0)); | ||
| } | ||
| if(aimMode.getValue() == AimMode.Middle) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 2d), 0), (float) (laziness.getValue() + 0)); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Bottom) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 4d), 0), (float) (laziness.getValue() + 0)); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Bottom) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 100) * aimHeight.getValue(), 0), (float) (laziness.getValue() + 0)); | ||
| } | ||
| } else { | ||
| if(aimMode.getValue() == AimMode.Top) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 1.3d), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Middle) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, le.getHeight() / 2d, 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Bottom) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, le.getHeight() / 4d, 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Custom) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 100) * aimHeight.getValue(), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| } | ||
| } |
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.
same code but with a different variable, you can just use the modifiedLaziness and only change it when randomness is enabled
|
Ok fixed stuff now |
|
By the way the createrelease.sh doesn't work, at least on mac |
0x3C50
left a comment
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.
took a proper look, didn't notice these things at first when going over the pr on mobile.
if you have a lot of duplicate code with only one variable or argument changing, it's best to remove the duplicate code and only actually change that one part. both of the if chains have a lot of duplicate code where you could just modify the position to look at. everything else is the same
| if(aimMode.getValue() == AimMode.Top) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 1.3d), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Middle) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 2d), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Bottom) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 4d), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Custom) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getPos().add(0, (le.getHeight() / 100) * aimHeight.getValue(), 0)); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } | ||
| else if (aimMode.getValue() == AimMode.Eyes) | ||
| { | ||
| Rotation py = Rotations.getPitchYaw(le.getEyePos()); | ||
| Objects.requireNonNull(CoffeeMain.client.player).setPitch(py.getPitch()); | ||
| CoffeeMain.client.player.setYaw(py.getYaw()); | ||
| } |
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.
still code duplicates, you can use an enhanced switch here:
Rotation py = switch (aimMode.getValue()) {
case AimMode.Top -> ...;
case AimMode.Middle -> ...;
...
}
// use py| if(aimMode.getValue() == AimMode.Top) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 1.3d), 0), (float) (modifiedLaziness)); | ||
| } | ||
| if(aimMode.getValue() == AimMode.Middle) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 2d), 0), (float) (modifiedLaziness)); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Bottom) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 4d), 0), (float) (modifiedLaziness)); | ||
| } | ||
| else if(aimMode.getValue() == AimMode.Custom) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getPos().add(0, (le.getHeight() / 100) * aimHeight.getValue(), 0), (float) (modifiedLaziness)); | ||
| } | ||
| else if (aimMode.getValue() == AimMode.Eyes) | ||
| { | ||
| Rotations.lookAtPositionSmooth(le.getEyePos(), (float) (modifiedLaziness)); | ||
| } |
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.
enhanced switch might be best here too
|
|
||
| void aimAtTarget() { | ||
|
|
||
| double modifiedLaziness = laziness.getValue() + 0; |
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.
this is a double, but any usages are casted to floats. probably better to make this a float and use Random#nextFloat for the offset
|
all right imma look into this tomorrow |
|
ok i really haven't had time to do this so I will do it after my exams (i will work on it next thursday) |
Added more smoothness, randomness and an option to change where to aim.
Feedback is appreciated