Posted August 16, 201510 yr What I am trying to do is in my hud I am trying to display some information. I have tried: private String getPingInformation() { NetHandlerPlayClient handler = this.mc.thePlayer.sendQueue; List list = new ArrayList(handler.func_175106_d()); Iterator iterator = list.iterator(); while (iterator.hasNext()) { NetworkPlayerInfo networkplayerinfo = (NetworkPlayerInfo) iterator.next(); EnumChatFormatting enumchatformatting; if (networkplayerinfo.getResponseTime() <= 0) enumchatformatting = EnumChatFormatting.RED; else if (networkplayerinfo.getResponseTime() < 150) enumchatformatting = EnumChatFormatting.GREEN; else if (networkplayerinfo.getResponseTime() < 300) enumchatformatting = EnumChatFormatting.YELLOW; else if (networkplayerinfo.getResponseTime() < 600) enumchatformatting = EnumChatFormatting.GOLD; else if (networkplayerinfo.getResponseTime() < 1000) enumchatformatting = EnumChatFormatting.RED; else enumchatformatting = EnumChatFormatting.DARK_RED; return "Ping: " + enumchatformatting + (networkplayerinfo.getResponseTime() <= 0 ? "Unavailable" : networkplayerinfo.getResponseTime()); } return "Ping: Unavailable"; } and it sometimes works, but most of the time it returns 0.
August 17, 201510 yr Author Maybe, but I would also expect the ping to update every so often, but it seems the stay at the same number for long periods of time. EDIT: What happens it when I join a server the ping will be a single number for about 5-10 seconds, then goto 0, then a random time later will be another number, and continuously do that.
August 17, 201510 yr Author The only reason I wanted the players ping was for my HUD to tell the player what their ping was, since I already have it displaying the server IP.
August 17, 201510 yr Author I do know that there is a way to do it without calculating it myself because the pixelmon mod does it with their custom tab list with the vanilla methods.
August 17, 201510 yr Author I know that and they get the response time based on the iteration through the list of players.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.