diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-07-26 19:49:12 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-07-26 19:49:12 +0800 |
commit | aadc96313266643cc57e4e1d01112c41df0ac8a7 (patch) | |
tree | 782b0ab137a70d0ccec4069148879054964e00d9 /features/hud/index.js | |
parent | 2aee47bfab2169eaed3b97890c82e684e8a1a1c3 (diff) | |
download | SoopyV2-aadc96313266643cc57e4e1d01112c41df0ac8a7.tar.gz SoopyV2-aadc96313266643cc57e4e1d01112c41df0ac8a7.tar.bz2 SoopyV2-aadc96313266643cc57e4e1d01112c41df0ac8a7.zip |
asd
Diffstat (limited to 'features/hud/index.js')
-rw-r--r-- | features/hud/index.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/features/hud/index.js b/features/hud/index.js index 661509a..bb8d613 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -15,6 +15,9 @@ import { addNotation, numberWithCommas } from "../../utils/numberUtils.js"; const ProcessBuilder = Java.type("java.lang.ProcessBuilder") const Scanner = Java.type("java.util.Scanner") +let OldServerPinger = Java.type("net.minecraft.client.network.OldServerPinger") +let serverPinger = new OldServerPinger() + class Hud extends Feature { constructor() { super() @@ -147,6 +150,15 @@ class Hud extends Feature { this.showLobbyDayOnlyUnder30 = new ToggleSetting("Show Current Lobby Day ONLY WHEN under day 30", "", true, "lobby_day_30", this) this.hudElements.push(this.lobbyDayElement) + this.showPing = new ToggleSetting("Show Current Ping", "(Updates every 30s)", true, "show_ping", this) + this.pingElement = new HudTextElement() + .setText("&6Ping&7> &fLoading...") + .setToggleSetting(this.showPing) + .setLocationSetting(new LocationSetting("Ping Location", "Allows you to edit the location of the ping text", "show_ping_location", this, [10, 100, 1, 1]) + .requires(this.showPing) + .editTempText("&6Ping&7> &c312ms")) + this.hudElements.push(this.pingElement) + let hudStatTypes = { "cata": "Catacombs level + Exp", "totaldeaths": "Total deaths" @@ -258,6 +270,45 @@ class Hud extends Feature { this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.fpsEnabledSetting.getValue() && this.fpsFastSetting.getValue()) this.registerEvent("worldLoad", this.worldLoad) + this.registerStep(false, 30, () => { + if (this.showPing.getValue() && Client.getMinecraft().func_147104_D()) { + let pingNum = Client.getMinecraft().func_147104_D().field_78844_e + + let pingT = "&a" + pingNum + "ms" + if (pingNum > 150) { + pingT = "&e" + pingNum + "ms" + } + if (pingNum > 250) { + pingT = "&c" + pingNum + "ms" + } + + if (pingNum === -1) { + pingT = "Loading..." + } + this.pingElement.setText("&6Ping&7> " + pingT) + + serverPinger[m.ping](Client.getMinecraft().func_147104_D()); + } + }) + this.registerStep(false, 5, () => { + if (this.showPing.getValue() && Client.getMinecraft().func_147104_D()) { + let pingNum = Client.getMinecraft().func_147104_D().field_78844_e + + let pingT = "&a" + pingNum + "ms" + if (pingNum > 150) { + pingT = "&e" + pingNum + "ms" + } + if (pingNum > 250) { + pingT = "&c" + pingNum + "ms" + } + + if (pingNum === -1) { + return; + } + this.pingElement.setText("&6Ping&7> " + pingT) + } + }) + this.petLevels = {} this.petText = "&6Pet&7> &fLoading..." this.petElement.setText(this.petText) @@ -572,6 +623,7 @@ class Hud extends Feature { step_5second() { this.updateHudThingos() + if (!this.soulflowEnabledSetting.getValue()) return if (!Player.getPlayer()) return if (!Player.getInventory()) return |