use of net.minecraft.client.network.NetworkPlayerInfo in project Wurst-MC-1.12 by Wurst-Imperium.
the class MassTpaMod method onEnable.
@Override
public void onEnable() {
index = 0;
timer = -1;
players.clear();
for (NetworkPlayerInfo info : WMinecraft.getConnection().getPlayerInfoMap()) {
String name = info.getPlayerNameForReal();
name = StringUtils.stripControlCodes(name);
if (name.equals(WMinecraft.getPlayer().getName()))
continue;
players.add(name);
}
Collections.shuffle(players, random);
wurst.events.add(ChatInputListener.class, this);
wurst.events.add(UpdateListener.class, this);
if (players.isEmpty()) {
ChatUtils.error("Couldn't find any players.");
setEnabled(false);
}
}
use of net.minecraft.client.network.NetworkPlayerInfo in project Hyperium by HyperiumClient.
the class LevelheadGui method doTab.
private void doTab(Levelhead instance) {
EntityPlayerSP player = mc.thePlayer;
NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(player.getUniqueID());
LevelheadDisplay tab = instance.getDisplayManager().getTab();
if (tab != null) {
String formattedText = player.getDisplayName().getFormattedText();
int totalTabWidth = 9 + fontRendererObj.getStringWidth(formattedText) + getLevelheadWidth(playerInfo) + 15;
int fakeTabTop = height - 200;
int centerOn = width / 3;
int leftStart = centerOn - totalTabWidth / 2;
drawRect(leftStart, fakeTabTop, centerOn + totalTabWidth / 2, fakeTabTop + 8, Integer.MIN_VALUE);
drawRect(leftStart, fakeTabTop, centerOn + totalTabWidth / 2, fakeTabTop + 8, 553648127);
fontRendererObj.drawString(formattedText, leftStart + 9, fakeTabTop, -1, true);
mc.getTextureManager().bindTexture(player.getLocationSkin());
int l2 = 8;
int i3 = 8;
Gui.drawScaledCustomSizeModalRect(leftStart, fakeTabTop, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F);
if (player.isWearing(EnumPlayerModelParts.HAT)) {
int j3 = 8;
int k3 = 8;
Gui.drawScaledCustomSizeModalRect(leftStart, fakeTabTop, 40.0F, (float) j3, 8, k3, 8, 8, 64.0F, 64.0F);
}
drawPing(leftStart + totalTabWidth, fakeTabTop, playerInfo);
drawPingHook(0, leftStart + totalTabWidth, fakeTabTop, playerInfo);
LevelheadPurchaseStates purchaseStates = instance.getLevelheadPurchaseStates();
if (!purchaseStates.isTab()) {
String text = "Levelhead tab display not purchased!\nPlease purchase to activate and configure.";
int i = 1;
for (String s : text.split("\n")) {
int offset = i * 10;
int stringWidth = fontRendererObj.getStringWidth(s);
int tmpLeft = width / 3 - stringWidth / 2;
fakeTabTop = height - 180;
drawRect(tmpLeft, fakeTabTop + offset, tmpLeft + stringWidth, fakeTabTop + offset + 8, Integer.MIN_VALUE);
fontRendererObj.drawString(s, tmpLeft, fakeTabTop + offset, Color.YELLOW.getRGB(), true);
i++;
}
reg(new GuiButton(++currentID, centerOn - 60, height - 140, 120, 20, YELLOW + "Purchase Tab Display"), button -> attemptPurchase("tab"));
}
}
}
use of net.minecraft.client.network.NetworkPlayerInfo in project Hyperium by HyperiumClient.
the class PingDisplay method draw.
@Override
public void draw(int starX, double startY, boolean isConfig) {
if (Minecraft.getMinecraft().theWorld != null && !Minecraft.getMinecraft().theWorld.isRemote && !isConfig) {
return;
}
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
if (thePlayer != null) {
NetworkPlayerInfo playerInfo = Minecraft.getMinecraft().getNetHandler().getPlayerInfo(Minecraft.getMinecraft().thePlayer.getUniqueID());
String string = "Ping: " + (playerInfo == null ? "error" : playerInfo.getResponseTime());
ElementRenderer.draw(starX, startY, string);
width = Minecraft.getMinecraft().fontRendererObj.getStringWidth(string);
}
}
use of net.minecraft.client.network.NetworkPlayerInfo in project Hyperium by HyperiumClient.
the class NetworkInfo method printPing.
public void printPing(final String name) {
NetworkPlayerInfo info = getPlayerInfo(name);
GeneralChatHandler.instance().sendMessage(info == null || info.getResponseTime() < 0 ? ChatColor.RED + "No info about " + name : ChatColor.WHITE.toString() + ChatColor.BOLD + info.getGameProfile().getName() + ChatColor.WHITE + ": " + info.getResponseTime() + "ms");
}
use of net.minecraft.client.network.NetworkPlayerInfo in project Hyperium by HyperiumClient.
the class MixinRenderGlobal method removeEntity.
@Inject(method = "onEntityRemoved", at = @At("HEAD"))
private void removeEntity(Entity entityIn, CallbackInfo ci) {
if (entityIn instanceof AbstractClientPlayer) {
MemoryHelper.INSTANCE.queueDelete(((AbstractClientPlayer) entityIn).getLocationCape());
MemoryHelper.INSTANCE.queueDelete(((AbstractClientPlayer) entityIn).getLocationSkin());
NetworkPlayerInfo info = ((IMixinAbstractClientPlayer) entityIn).callGetPlayerInfo();
if (info == null)
return;
((IMixinNetworkPlayerInfo) info).setPlayerTexturesLoaded(false);
((IMixinNetworkPlayerInfo) info).setLocationCape(null);
((IMixinNetworkPlayerInfo) info).setLocationSkin(null);
}
}
Aggregations