fix: don't fire twice per tick

This commit is contained in:
əlemi 2023-02-27 23:25:48 +01:00
parent acf78a429a
commit dd5bb2205b
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -18,6 +18,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.TickEvent.Phase;
import net.minecraftforge.eventbus.api.SubscribeEvent;
public class InfoDisplay extends HudModule implements ICommons {
@ -75,6 +76,7 @@ public class InfoDisplay extends HudModule implements ICommons {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {
if (!this.speed.get()) return;
if (event.phase == Phase.END) return;
if (MC.player != null) {
this.instant_speed =
this.last_position.distanceTo(MC.player.position());