add Server HUD module
Shows the address of the server the player is on (mc.getCurrentServer), or Singleplayer when hosting a local world.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package cc.fros.features.modules.hud;
|
||||
|
||||
import cc.fros.event.impl.render.Render2DEvent;
|
||||
import cc.fros.features.modules.client.HudModule;
|
||||
import cc.fros.util.render.FrosFont;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
|
||||
public class ServerHudModule extends HudModule {
|
||||
|
||||
public ServerHudModule() {
|
||||
super("Server", "Display the server you are on", 150, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void render(Render2DEvent e) {
|
||||
super.render(e);
|
||||
|
||||
String serverStr;
|
||||
if (mc.hasSingleplayerServer()) {
|
||||
serverStr = "Server: Singleplayer";
|
||||
} else {
|
||||
ServerData data = mc.getCurrentServer();
|
||||
serverStr = "Server: " + (data != null ? data.ip : "-");
|
||||
}
|
||||
|
||||
FrosFont.draw(e.getContext(), serverStr, (int) getX(), (int) getY(), -1);
|
||||
|
||||
setWidth(FrosFont.width(serverStr));
|
||||
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.ServerHudModule;
|
||||
import cc.fros.features.modules.hud.TpsHudModule;
|
||||
import cc.fros.features.modules.hud.CoordinatesHudModule;
|
||||
import cc.fros.features.modules.hud.FpsHudModule;
|
||||
@@ -61,6 +62,7 @@ public class ModuleManager implements Jsonable, Util {
|
||||
register(new TimeHudModule());
|
||||
register(new ArmorHudModule());
|
||||
register(new TpsHudModule());
|
||||
register(new ServerHudModule());
|
||||
register(new HudEditorModule());
|
||||
register(new ClickGuiModule());
|
||||
register(new NotificationsModule());
|
||||
|
||||
Reference in New Issue
Block a user