Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pan4ur committed Aug 1, 2024
1 parent d1adc46 commit 8b59fc4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
22 changes: 12 additions & 10 deletions src/main/java/thunder/hack/gui/hud/impl/AutoCrystalInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ public AutoCrystalInfo() {

private final ArrayDeque<Integer> speeds = new ArrayDeque<>(20);
private int max, min;
private long time;

public void onRender2D(DrawContext context) {
super.onRender2D(context);

Render2DEngine.drawHudBase(context.getMatrices(), getPosX(), getPosY(), 175, 80, HudEditor.hudRound.getValue());
Render2DEngine.drawHudBase(context.getMatrices(), getPosX(), getPosY(), getWidth(), getHeight(), HudEditor.hudRound.getValue());

Color c1 = HudEditor.getColor(0).darker().darker().darker();
Color c2 = HudEditor.getColor(0);
Expand Down Expand Up @@ -86,9 +87,7 @@ public void onRender2D(DrawContext context) {

Render2DEngine.drawRect(context.getMatrices(), getPosX() + 110.5f, getPosY() + 12, 0.5f, 65, new Color(0x44FFFFFF, true));


setBounds(getPosX(), getPosY(), 150, 150);

setBounds(getPosX(), getPosY(), getWidth(), getHeight());
}

public Formatting getCalcColor(float val) {
Expand All @@ -103,12 +102,15 @@ public Formatting getEfficiencyColor(float val) {
return Formatting.YELLOW;
}

public void addSpeed(int ammount) {
if (speeds.size() > 20)
speeds.poll();
public void onSpawn() {
if (time != 0L) {
if (speeds.size() > 20)
speeds.poll();

speeds.add(ammount);
max = Collections.max(speeds);
min = Collections.min(speeds);
speeds.add((int) (1000f / (float) (System.currentTimeMillis() - time)));
max = Collections.max(speeds);
min = Collections.min(speeds);
}
time = System.currentTimeMillis();
}
}
4 changes: 2 additions & 2 deletions src/main/java/thunder/hack/modules/combat/AutoCrystal.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void onCrystalSpawn(@NotNull EventEntitySpawnPost e) {
for (BlockPos bp : cache.keySet())
if (cr.squaredDistanceTo(bp.toCenterPos()) < 0.3) {
confirmTime = System.currentTimeMillis() - cache.get(bp);
ModuleManager.autoCrystalInfo.addSpeed((int) (1000f / (float) confirmTime));
ModuleManager.autoCrystalInfo.onSpawn();
placedCrystals.remove(bp);
if (breakTimer.passedTicks(facePlacing ? lowBreakDelay.getValue() : breakDelay.getValue()))
handleSpawn(cr);
Expand All @@ -348,7 +348,7 @@ public void onPacketReceive(PacketEvent.Receive e) {
for (BlockPos bp : cache.keySet())
if (cr.squaredDistanceTo(bp.toCenterPos()) < 0.3) {
confirmTime = System.currentTimeMillis() - cache.get(bp);
ModuleManager.autoCrystalInfo.addSpeed((int) (1000f / (float) confirmTime));
ModuleManager.autoCrystalInfo.onSpawn();
placedCrystals.remove(bp);
if (breakTimer.passedTicks(facePlacing ? lowBreakDelay.getValue() : breakDelay.getValue()))
handleSpawn(cr);
Expand Down

0 comments on commit 8b59fc4

Please sign in to comment.