Search in sources :

Example 11 with NetworkPlayerInfo

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);
    }
}
Also used : NetworkPlayerInfo(net.minecraft.client.network.NetworkPlayerInfo)

Example 12 with NetworkPlayerInfo

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"));
        }
    }
}
Also used : NetworkPlayerInfo(net.minecraft.client.network.NetworkPlayerInfo) LevelheadPurchaseStates(cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Example 13 with NetworkPlayerInfo

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);
    }
}
Also used : NetworkPlayerInfo(net.minecraft.client.network.NetworkPlayerInfo) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Example 14 with NetworkPlayerInfo

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");
}
Also used : NetworkPlayerInfo(net.minecraft.client.network.NetworkPlayerInfo)

Example 15 with NetworkPlayerInfo

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);
    }
}
Also used : IMixinAbstractClientPlayer(cc.hyperium.mixins.client.entity.IMixinAbstractClientPlayer) AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) IMixinAbstractClientPlayer(cc.hyperium.mixins.client.entity.IMixinAbstractClientPlayer) NetworkPlayerInfo(net.minecraft.client.network.NetworkPlayerInfo) IMixinNetworkPlayerInfo(cc.hyperium.mixins.client.network.IMixinNetworkPlayerInfo) IMixinNetworkPlayerInfo(cc.hyperium.mixins.client.network.IMixinNetworkPlayerInfo) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

NetworkPlayerInfo (net.minecraft.client.network.NetworkPlayerInfo)19 NetHandlerPlayClient (net.minecraft.client.network.NetHandlerPlayClient)5 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 ResourceLocation (net.minecraft.util.ResourceLocation)4 UUID (java.util.UUID)3 ArrayList (java.util.ArrayList)2 EntitySpaceshipBase (micdoodle8.mods.galacticraft.api.prefab.entity.EntitySpaceshipBase)2 Minecraft (net.minecraft.client.Minecraft)2 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)2 World (net.minecraft.world.World)2 Text (org.spongepowered.api.text.Text)2 GuiBigTextField (betterquesting.api.client.gui.controls.GuiBigTextField)1 GuiButtonThemed (betterquesting.api.client.gui.controls.GuiButtonThemed)1 IMixinAbstractClientPlayer (cc.hyperium.mixins.client.entity.IMixinAbstractClientPlayer)1 IMixinGuiPlayerTabOverlay (cc.hyperium.mixins.client.gui.IMixinGuiPlayerTabOverlay)1 IMixinNetworkPlayerInfo (cc.hyperium.mixins.client.network.IMixinNetworkPlayerInfo)1 LevelheadPurchaseStates (cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates)1 StaffUtils (cc.hyperium.utils.StaffUtils)1 GameProfile (com.mojang.authlib.GameProfile)1