Search in sources :

Example 6 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project Hypnotic-Client by Hypnotic-Development.

the class Nametags method getNameString.

public String getNameString(Entity entity) {
    String name = entity.getDisplayName().asString();
    PlayerListEntry playerListEntry = mc.getNetworkHandler().getPlayerListEntry(entity.getUuid());
    String gameModeText = gamemode.isEnabled() ? (playerListEntry != null ? ColorUtils.aqua + playerListEntry.getGameMode().getName().substring(0, 1).toUpperCase() + " " + ColorUtils.reset : "") : "";
    String pingText = ping.isEnabled() ? (playerListEntry != null ? playerListEntry.getLatency() : "0") + "ms " : "";
    String distanceText = distance.isEnabled() ? Math.round(mc.player.distanceTo(entity)) + "m " : " ";
    String devText = (Arrays.asList(Hypnotic.INSTANCE.devUUIDs).contains(entity.getUuidAsString()) ? ColorUtils.purple + " DEV" + ColorUtils.reset : "");
    if (name.trim().isEmpty())
        name = entity.getName().getString();
    if (entity instanceof ItemEntity) {
        ItemEntity itemEntity = (ItemEntity) entity;
        if (itemEntity.getStack().getCount() > 1)
            name += " \247fx" + itemEntity.getStack().getCount();
    }
    String displayName = "";
    if (entity instanceof LivingEntity)
        displayName = gameModeText + ColorUtils.white + name.replaceAll(ColorUtils.colorChar, "&") + devText + " " + pingText + distanceText + getHealthString((LivingEntity) entity) + (entity.getName().asString().equalsIgnoreCase("BadGamesInc") ? ColorUtils.purple + " Swag" : "");
    return displayName;
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) ItemEntity(net.minecraft.entity.ItemEntity) PlayerListEntry(net.minecraft.client.network.PlayerListEntry)

Example 7 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project WildfireFemaleGenderMod by WildfireRomeo.

the class WildfirePlayerList method refreshList.

public void refreshList() {
    this.clearEntries();
    ClientPlayNetworkHandler clientPlayNetworkHandler = this.client.player.networkHandler;
    List<PlayerListEntry> list = ENTRY_ORDERING.sortedCopy(clientPlayNetworkHandler.getPlayerList());
    Iterator var9 = list.iterator();
    int index = 0;
    while (var9.hasNext()) {
        PlayerListEntry playerListEntry = (PlayerListEntry) var9.next();
        PlayerEntity playerentity = MinecraftClient.getInstance().world.getPlayerByUuid(playerListEntry.getProfile().getId());
        if (playerentity != null) {
            addEntry(new WildfirePlayerList.Entry(playerListEntry));
            index++;
        }
    }
}
Also used : Iterator(java.util.Iterator) PlayerListEntry(net.minecraft.client.network.PlayerListEntry) ClientPlayNetworkHandler(net.minecraft.client.network.ClientPlayNetworkHandler) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 8 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project WildfireFemaleGenderMod by WildfireRomeo.

the class WildfirePlayerListScreen method render.

@Override
public void render(MatrixStack m, int f1, int f2, float f3) {
    HOVER_PLAYER = null;
    this.setTooltip(null);
    PLAYER_LIST.refreshList();
    super.renderBackground(m);
    MinecraftClient mc = MinecraftClient.getInstance();
    RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
    if (this.TXTR_BACKGROUND != null) {
        RenderSystem.setShader(GameRenderer::getPositionTexShader);
        RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
        RenderSystem.setShaderTexture(0, this.TXTR_BACKGROUND);
    }
    int i = (this.width - 132) / 2;
    int j = (this.height - 156) / 2 - 20;
    drawTexture(m, i, j, 0, 0, 192, 174);
    int x = (this.width / 2);
    int y = (this.height / 2) - 20;
    super.render(m, f1, f2, f3);
    double scale = mc.getWindow().getScaleFactor();
    int left = x - 59;
    int bottom = y - 32;
    int width = 118;
    int height = 134;
    RenderSystem.enableScissor((int) (left * scale), (int) (bottom * scale), (int) (width * scale), (int) (height * scale));
    PLAYER_LIST.render(m, f1, f2, f3);
    RenderSystem.disableScissor();
    if (HOVER_PLAYER != null) {
        int dialogX = x + 75;
        int dialogY = y - 73;
        PlayerEntity pEntity = mc.world.getPlayerByUuid(HOVER_PLAYER.uuid);
        if (pEntity != null) {
            this.textRenderer.drawWithShadow(m, pEntity.getDisplayName().copy().formatted(Formatting.UNDERLINE), dialogX, dialogY - 2, 0xFFFFFF);
        }
        Gender gender = HOVER_PLAYER.getGender();
        this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.label.gender").append(" ").append(gender.getDisplayName()), dialogX, dialogY + 10, 0xBBBBBB);
        if (gender.canHaveBreasts()) {
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.wardrobe.slider.breast_size", Math.round(HOVER_PLAYER.getBustSize() * 100)), dialogX, dialogY + 20, 0xBBBBBB);
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.char_settings.physics", new TranslatableText(HOVER_PLAYER.hasBreastPhysics() ? "wildfire_gender.label.enabled" : "wildfire_gender.label.disabled")), dialogX, dialogY + 40, 0xBBBBBB);
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.player_list.bounce_multiplier", HOVER_PLAYER.getBounceMultiplier()), dialogX + 6, dialogY + 50, 0xBBBBBB);
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.player_list.breast_momentum", Math.round(HOVER_PLAYER.getFloppiness() * 100)), dialogX + 6, dialogY + 60, 0xBBBBBB);
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.player_list.female_sounds", new TranslatableText(HOVER_PLAYER.hasHurtSounds() ? "wildfire_gender.label.enabled" : "wildfire_gender.label.disabled")), dialogX, dialogY + 80, 0xBBBBBB);
        }
        if (pEntity != null) {
            WardrobeBrowserScreen.drawEntityOnScreen(x - 110, y + 45, 45, (x - 300), (y - 26 - f2), pEntity);
        }
    }
    this.textRenderer.draw(m, new TranslatableText("wildfire_gender.player_list.title"), x - 60, y - 73, 4473924);
    boolean withCreator = false;
    ClientPlayNetworkHandler clientPlayNetworkHandler = this.client.player.networkHandler;
    Collection<PlayerListEntry> list = clientPlayNetworkHandler.getPlayerList();
    for (PlayerListEntry plr : list) {
        if (plr.getProfile().getId().equals(CREATOR_UUID)) {
            withCreator = true;
        }
    }
    if (withCreator) {
        drawCenteredText(m, this.textRenderer, new TranslatableText("wildfire_gender.label.with_creator"), this.width / 2, y + 100, 0xFF00FF);
    }
    /*if(Calendar.getInstance().get(Calendar.MONTH) == 9) {
			fill(m, x - 159, y + 106, x + 159, y + 136, 0x55000000);
			textRenderer.draw(m, Formatting.ITALIC + "Hey, it's Breast Cancer Awareness Month!", this.width / 2 - 155, y + 110, 0xFFFFFF);
			textRenderer.draw(m, "Click here to donate to " + Formatting.LIGHT_PURPLE + "Susan G. Komen Foundation" + Formatting.WHITE + "!", this.width / 2 - 155, y + 124, 0xAAAAAA);
			RenderSystem.setShader(GameRenderer::getPositionTexShader);
		RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
		RenderSystem.setShaderTexture(0, this.TXTR_RIBBON);
			Screen.drawTexture(m, x + 130, y + 109, 26, 26, 0, 0, 20, 20, 20, 20);
		}*/
    if (tooltip != null) {
        this.renderTooltip(m, tooltip, f1, f2);
    }
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) MinecraftClient(net.minecraft.client.MinecraftClient) GameRenderer(net.minecraft.client.render.GameRenderer) PlayerListEntry(net.minecraft.client.network.PlayerListEntry) WildfireGender(com.wildfire.main.WildfireGender) Gender(com.wildfire.main.GenderPlayer.Gender) ClientPlayNetworkHandler(net.minecraft.client.network.ClientPlayNetworkHandler) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 9 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project Client by MatHax.

the class PingCommand method build.

@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
    builder.executes(context -> {
        PlayerListEntry playerListEntry = mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid());
        String ping;
        if (playerListEntry != null)
            ping = Integer.toString(playerListEntry.getLatency());
        else
            ping = "0";
        info("Your ping is (highlight)%s(default).", ping);
        return SINGLE_SUCCESS;
    });
}
Also used : PlayerListEntry(net.minecraft.client.network.PlayerListEntry)

Example 10 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project Client by MatHax.

the class PlayerListEntryArgumentType method parse.

@Override
public PlayerListEntry parse(StringReader reader) throws CommandSyntaxException {
    String argument = reader.readString();
    PlayerListEntry playerListEntry = null;
    for (PlayerListEntry p : MatHax.mc.getNetworkHandler().getPlayerList()) {
        if (p.getProfile().getName().equalsIgnoreCase(argument)) {
            playerListEntry = p;
            break;
        }
    }
    if (playerListEntry == null)
        throw NO_SUCH_PLAYER.create(argument);
    return playerListEntry;
}
Also used : PlayerListEntry(net.minecraft.client.network.PlayerListEntry)

Aggregations

PlayerListEntry (net.minecraft.client.network.PlayerListEntry)18 PlayerEntity (net.minecraft.entity.player.PlayerEntity)5 MinecraftClient (net.minecraft.client.MinecraftClient)3 Entity (net.minecraft.entity.Entity)3 LiteralText (net.minecraft.text.LiteralText)3 Vec3d (net.minecraft.util.math.Vec3d)3 IEPlayerListEntry (com.qouteall.immersive_portals.ducks.IEPlayerListEntry)2 IEWorldRenderer (com.qouteall.immersive_portals.ducks.IEWorldRenderer)2 List (java.util.List)2 ClientPlayNetworkHandler (net.minecraft.client.network.ClientPlayNetworkHandler)2 LivingEntity (net.minecraft.entity.LivingEntity)2 Identifier (net.minecraft.util.Identifier)2 GameMode (net.minecraft.world.GameMode)2 GameProfile (com.mojang.authlib.GameProfile)1 IEChunkRenderList (com.qouteall.immersive_portals.ducks.IEChunkRenderList)1 IEGameRenderer (com.qouteall.immersive_portals.ducks.IEGameRenderer)1 Gender (com.wildfire.main.GenderPlayer.Gender)1 WildfireGender (com.wildfire.main.WildfireGender)1 fzmm.zailer.me.utils (fzmm.zailer.me.utils)1 Color (java.awt.Color)1