add TPS HUD module
Shows the server's tps from ServerManager, which already measures it from the vanilla time-sync packet (20 ticks per packet).
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package cc.fros.features.modules.hud;
|
||||
|
||||
import cc.fros.Fros;
|
||||
import cc.fros.event.impl.render.Render2DEvent;
|
||||
import cc.fros.features.modules.client.HudModule;
|
||||
import cc.fros.util.render.FrosFont;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class TpsHudModule extends HudModule {
|
||||
|
||||
public TpsHudModule() {
|
||||
super("TPS", "Display the server's tps", 100, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void render(Render2DEvent e) {
|
||||
super.render(e);
|
||||
|
||||
String tpsStr = String.format(Locale.ROOT, "TPS: %.1f", Fros.serverManager.getTps());
|
||||
|
||||
FrosFont.draw(e.getContext(), tpsStr, (int) getX(), (int) getY(), -1);
|
||||
|
||||
setWidth(FrosFont.width(tpsStr));
|
||||
setHeight(FrosFont.lineHeight());
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import cc.fros.features.modules.combat.CriticalsModule;
|
||||
import cc.fros.features.modules.combat.KeyPearlModule;
|
||||
import cc.fros.features.modules.hud.ArrayListHudModule;
|
||||
import cc.fros.features.modules.hud.ArmorHudModule;
|
||||
import cc.fros.features.modules.hud.TpsHudModule;
|
||||
import cc.fros.features.modules.hud.CoordinatesHudModule;
|
||||
import cc.fros.features.modules.hud.FpsHudModule;
|
||||
import cc.fros.features.modules.hud.PingHudModule;
|
||||
@@ -59,6 +60,7 @@ public class ModuleManager implements Jsonable, Util {
|
||||
register(new WelcomerHudModule());
|
||||
register(new TimeHudModule());
|
||||
register(new ArmorHudModule());
|
||||
register(new TpsHudModule());
|
||||
register(new HudEditorModule());
|
||||
register(new ClickGuiModule());
|
||||
register(new NotificationsModule());
|
||||
|
||||
Reference in New Issue
Block a user