fix: don't fire twice per tick
This commit is contained in:
parent
acf78a429a
commit
dd5bb2205b
1 changed files with 2 additions and 0 deletions
|
@ -18,6 +18,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||||
import net.minecraftforge.common.ForgeConfigSpec;
|
import net.minecraftforge.common.ForgeConfigSpec;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
|
import net.minecraftforge.event.TickEvent.Phase;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
public class InfoDisplay extends HudModule implements ICommons {
|
public class InfoDisplay extends HudModule implements ICommons {
|
||||||
|
@ -75,6 +76,7 @@ public class InfoDisplay extends HudModule implements ICommons {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTick(TickEvent.ClientTickEvent event) {
|
public void onTick(TickEvent.ClientTickEvent event) {
|
||||||
if (!this.speed.get()) return;
|
if (!this.speed.get()) return;
|
||||||
|
if (event.phase == Phase.END) return;
|
||||||
if (MC.player != null) {
|
if (MC.player != null) {
|
||||||
this.instant_speed =
|
this.instant_speed =
|
||||||
this.last_position.distanceTo(MC.player.position());
|
this.last_position.distanceTo(MC.player.position());
|
||||||
|
|
Loading…
Reference in a new issue