Skip to content

Commit

Permalink
small improve for fly
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-mc committed Jul 3, 2024
1 parent 1d96802 commit e0be6a8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/keystrokesmod/module/impl/movement/Fly.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class Fly extends Module {
private long balance = 0;
private long startTime = -1;
private Timer.BalanceState balanceState = Timer.BalanceState.NONE;
private long lastReport = -1;

public Fly() {
super("Fly", category.movement);
Expand Down Expand Up @@ -219,11 +220,17 @@ public void onRenderTick(TickEvent.RenderTickEvent e) {

if ((int) mode.getInput() == 5) {
final long curTime = System.currentTimeMillis();

if (System.currentTimeMillis() - lastReport > 1000) {
lastReport = System.currentTimeMillis();
Utils.sendMessage(balance + ".0");
}
switch (balanceState) {
case NONE:
startTime = curTime;
Utils.getTimer().timerSpeed = 0;
balanceState = Timer.BalanceState.SLOW;
lastReport = System.currentTimeMillis();
break;
case SLOW:
balance += curTime - startTime;
Expand Down

0 comments on commit e0be6a8

Please sign in to comment.