File tree Expand file tree Collapse file tree
java/com/zergatul/cheatutils
resources/web/components/automation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,15 +6,19 @@ public class AutoAttackConfig extends ModuleConfig implements ValidatableConfig
66
77 public boolean limitRange ;
88 public double maxRange ;
9- public double extraTicks ;
9+ public int extraTicksMin ;
10+ public int extraTicksMax ;
1011
1112 public AutoAttackConfig () {
1213 maxRange = 2.5 ;
14+ extraTicksMin = 0 ;
15+ extraTicksMax = 0 ;
1316 }
1417
1518 @ Override
1619 public void validate () {
1720 maxRange = MathUtils .clamp (maxRange , 0 , 10 );
18- extraTicks = MathUtils .clamp (extraTicks , -10 , 10 );
21+ extraTicksMin = MathUtils .clamp (extraTicksMin , -10 , 10 );
22+ extraTicksMax = MathUtils .clamp (extraTicksMax , extraTicksMin , 10 );
1923 }
2024}
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ public class AutoAttack implements Module {
1616 public static final AutoAttack instance = new AutoAttack ();
1717
1818 private final Minecraft mc = Minecraft .getInstance ();
19+ private int nextExtraTicks = Integer .MIN_VALUE ;
1920
2021 private AutoAttack () {
2122 Events .ClientTickEnd .add (this ::onClientTickEnd );
@@ -43,18 +44,28 @@ private void onClientTickEnd() {
4344 return ;
4445 }
4546
46- if (mc .player .getAttackStrengthScale ((float ) -config .extraTicks ) != 1 ) {
47+ calculateNextExtraTicksIfRequired (config );
48+
49+ if (mc .player .getAttackStrengthScale (-nextExtraTicks ) != 1 ) {
4750 return ;
4851 }
4952
5053 if (config .limitRange && mc .hitResult .getLocation ().distanceToSqr (mc .player .getEyePosition ()) > config .maxRange * config .maxRange ) {
5154 return ;
5255 }
5356
57+ nextExtraTicks = Integer .MIN_VALUE ;
58+
5459 Entity entity = ((EntityHitResult ) mc .hitResult ).getEntity ();
5560 if (AttackRange .canHit (entity )) {
5661 mc .gameMode .attack (mc .player , entity );
5762 mc .player .swing (InteractionHand .MAIN_HAND );
5863 }
5964 }
65+
66+ private void calculateNextExtraTicksIfRequired (AutoAttackConfig config ) {
67+ if (nextExtraTicks == Integer .MIN_VALUE ) {
68+ nextExtraTicks = config .extraTicksMin + (int ) Math .floor (Math .random () * (config .extraTicksMax - config .extraTicksMin + 1 ));
69+ }
70+ }
6071}
Original file line number Diff line number Diff line change 2222 </ div >
2323 </ fieldset >
2424
25- < div class ="flex-row ">
26- < span class ="field-description "> Extra Ticks:</ span >
27- < input type ="text " class ="w3 " v-model ="config.extraTicks " @change ="update() ">
28- < div class ="section-description ">
29- Wait additional ticks once cooldown passed. Can be negative, in this case module will attack before cooldown.
25+ < fieldset >
26+ < legend >
27+ Extra Delay
28+ </ legend >
29+ < table >
30+ < tr >
31+ < td >
32+ < span class ="field-description "> Extra Ticks Min:</ span >
33+ </ td >
34+ < td >
35+ < input type ="number " class ="w3 " v-model ="config.extraTicksMin " @change ="update() ">
36+ </ td >
37+ </ tr >
38+ < tr >
39+ < td >
40+ < span class ="field-description "> Extra Ticks Max:</ span >
41+ </ td >
42+ < td >
43+ < input type ="number " class ="w3 " v-model ="config.extraTicksMax " @change ="update() ">
44+ </ td >
45+ </ tr >
46+ </ table >
47+ < div class ="section-description margin-vertical ">
48+ Wait additional random ticks amount in [min..max] range once cooldown passed.
49+ Values can be negative, in this case module will attack before cooldown.
3050 </ div >
31- </ div >
51+ </ fieldset >
3252 </ div >
3353</ div >
You can’t perform that action at this time.
0 commit comments