Search in sources :

Example 1 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project meteor-client by MeteorDevelopment.

the class LogoutSpots method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    if (mc.getNetworkHandler().getPlayerList().size() != lastPlayerList.size()) {
        for (PlayerListEntry entry : lastPlayerList) {
            if (mc.getNetworkHandler().getPlayerList().stream().anyMatch(playerListEntry -> playerListEntry.getProfile().equals(entry.getProfile())))
                continue;
            for (PlayerEntity player : lastPlayers) {
                if (player.getUuid().equals(entry.getProfile().getId())) {
                    add(new Entry(player));
                }
            }
        }
        lastPlayerList.clear();
        lastPlayerList.addAll(mc.getNetworkHandler().getPlayerList());
        updateLastPlayers();
    }
    if (timer <= 0) {
        updateLastPlayers();
        timer = 10;
    } else {
        timer--;
    }
    Dimension dimension = PlayerUtils.getDimension();
    if (dimension != lastDimension)
        players.clear();
    lastDimension = dimension;
}
Also used : PlayerListEntry(net.minecraft.client.network.PlayerListEntry) PlayerListEntry(net.minecraft.client.network.PlayerListEntry) Dimension(meteordevelopment.meteorclient.utils.world.Dimension) PlayerEntity(net.minecraft.entity.player.PlayerEntity) EventHandler(meteordevelopment.orbit.EventHandler)

Example 2 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project meteor-client by MeteorDevelopment.

the class PlayerListEntryArgumentType method parse.

@Override
public PlayerListEntry parse(StringReader reader) throws CommandSyntaxException {
    String argument = reader.readString();
    PlayerListEntry playerListEntry = null;
    for (PlayerListEntry p : 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)

Example 3 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project meteor-client by MeteorDevelopment.

the class FakeClientPlayer method getPlayerListEntry.

public static PlayerListEntry getPlayerListEntry() {
    if (playerListEntry == null || needsNewEntry) {
        playerListEntry = new PlayerListEntry(PlayerListEntryFactory.create(mc.getSession().getProfile(), 0, GameMode.SURVIVAL, new LiteralText(mc.getSession().getProfile().getName())));
        needsNewEntry = false;
    }
    return playerListEntry;
}
Also used : PlayerListEntry(net.minecraft.client.network.PlayerListEntry) LiteralText(net.minecraft.text.LiteralText)

Example 4 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project KiwiClient by TangyKiwi.

the class HUD method drawSetting.

public void drawSetting(GlyphPageFontRenderer textRenderer, MatrixStack m, int i, int offset) {
    switch(i) {
        case 0:
            this.fps = (mc.fpsDebugString.equals("")) ? 0 : Integer.parseInt(mc.fpsDebugString.replaceAll("[^\\d]", " ").trim().replaceAll(" +", " ").split(" ")[0]);
            textRenderer.drawString(m, String.format("FPS: %d", fps), 0.3, mc.getWindow().getScaledHeight() - offset, ColorUtil.getColorString(fps, 80, 60, 30, 15, 10, false));
            break;
        case 1:
            PlayerListEntry playerEntry = mc.player.networkHandler.getPlayerListEntry(mc.player.getGameProfile().getId());
            this.ping = playerEntry == null ? 0 : playerEntry.getLatency();
            textRenderer.drawString(m, String.format("Ping: %d", ping), 0.3, mc.getWindow().getScaledHeight() - offset, ColorUtil.getColorString(ping, 10, 20, 50, 75, 100, true));
            break;
        case 2:
            this.tps = TickRate.getTickRate();
            textRenderer.drawString(m, "TPS: " + String.format("%.1f", tps), 0.3, mc.getWindow().getScaledHeight() - offset, 0xFFAA00);
            break;
        case 3:
            this.ip = "IP: Singleplayer";
            if (mc.getCurrentServerEntry() != null) {
                if (mc.isConnectedToRealms()) {
                    this.ip = "IP: " + mc.getCurrentServerEntry().name;
                } else
                    this.ip = "IP: " + mc.getCurrentServerEntry().address;
            }
            textRenderer.drawString(m, ip, 0.3, mc.getWindow().getScaledHeight() - offset, 0xFFAA00);
            break;
        case 4:
            String biome = "";
            Identifier id = mc.world.getRegistryManager().get(Registry.BIOME_KEY).getId(mc.world.getBiome(new BlockPos.Mutable().set(mc.player.getX(), mc.player.getY(), mc.player.getZ())).value());
            if (id == null)
                biome = "Unknown";
            else
                biome = Arrays.stream(id.getPath().split("_")).map(StringUtils::capitalize).collect(Collectors.joining(" "));
            textRenderer.drawString(m, "Biome: " + biome, 0.3, mc.getWindow().getScaledHeight() - offset, 0xFFAA00);
            break;
        case 5:
            double tX = Math.abs(mc.player.getX() - mc.player.prevX);
            double tZ = Math.abs(mc.player.getZ() - mc.player.prevZ);
            double length = Math.sqrt(tX * tX + tZ * tZ);
            this.bps = length * 20;
            textRenderer.drawString(m, String.format("Speed: %.1f b/s", bps), 0.3, mc.getWindow().getScaledHeight() - offset, 0xFFAA00);
            break;
        case 6:
            Vec3d vec = mc.player.getPos();
            float yaw = MathHelper.wrapDegrees(mc.getCameraEntity().getYaw());
            String dir = "";
            if (yaw > 157.5)
                dir = "N -Z";
            else if (yaw >= 112.5)
                dir = "NW -X, -Z";
            else if (yaw > 67.5)
                dir = "W -X";
            else if (yaw >= 22.5)
                dir = "SW -X, +Z";
            else if (yaw > -22.5)
                dir = "S +Z";
            else if (yaw >= -67.5)
                dir = "SE +X, +Z";
            else if (yaw > -112.5)
                dir = "E +X";
            else if (yaw >= -157.5)
                dir = "NE +X, -Z";
            else
                dir = "N -Z";
            textRenderer.drawString(m, String.format("X: %.1f Y: %.1f Z: %.1f " + dir, vec.x, vec.y, vec.z), 0.3, mc.getWindow().getScaledHeight() - offset, 0xFFAA00);
            break;
        case 7:
            Boolean nether = mc.world.getRegistryKey().getValue().getPath().contains("nether");
            Vec3d vec2 = mc.player.getPos();
            double altx = vec2.x / 8;
            double altz = vec2.z / 8;
            if (nether) {
                altx = vec2.x * 8;
                altz = vec2.z * 8;
            }
            if (nether)
                textRenderer.drawString(m, String.format("(Overworld) X: %.1f Y: %.1f Z: %.1f", altx, vec2.y, altz), 0.3, mc.getWindow().getScaledHeight() - offset, 0xFFAA00);
            else
                textRenderer.drawString(m, String.format("(Nether) X: %.1f Y: %.1f Z: %.1f", altx, vec2.y, altz), 0.3, mc.getWindow().getScaledHeight() - offset, 0xFFAA00);
            break;
    }
}
Also used : Identifier(net.minecraft.util.Identifier) PlayerListEntry(net.minecraft.client.network.PlayerListEntry) Vec3d(net.minecraft.util.math.Vec3d)

Example 5 with PlayerListEntry

use of net.minecraft.client.network.PlayerListEntry in project ImmersivePortalsMod by qouteall.

the class MyGameRenderer method renderPlayerItself.

private void renderPlayerItself(Vec3d playerPos, Vec3d playerLastTickPos, float patialTicks) {
    EntityRenderDispatcher entityRenderDispatcher = ((IEWorldRenderer) mc.worldRenderer).getEntityRenderDispatcher();
    PlayerListEntry playerListEntry = CHelper.getClientPlayerListEntry();
    GameMode originalGameMode = MyRenderHelper.originalGameMode;
    Entity player = mc.cameraEntity;
    assert player != null;
    Vec3d oldPos = player.getPos();
    Vec3d oldLastTickPos = McHelper.lastTickPosOf(player);
    GameMode oldGameMode = playerListEntry.getGameMode();
    Helper.setPosAndLastTickPos(player, playerPos, playerLastTickPos);
    ((IEPlayerListEntry) playerListEntry).setGameMode(originalGameMode);
    entityRenderDispatcher.render(player, patialTicks, false);
    Helper.setPosAndLastTickPos(player, oldPos, oldLastTickPos);
    ((IEPlayerListEntry) playerListEntry).setGameMode(oldGameMode);
}
Also used : GameMode(net.minecraft.world.GameMode) Entity(net.minecraft.entity.Entity) IEWorldRenderer(com.qouteall.immersive_portals.ducks.IEWorldRenderer) IEPlayerListEntry(com.qouteall.immersive_portals.ducks.IEPlayerListEntry) PlayerListEntry(net.minecraft.client.network.PlayerListEntry) IEPlayerListEntry(com.qouteall.immersive_portals.ducks.IEPlayerListEntry) Vec3d(net.minecraft.util.math.Vec3d) EntityRenderDispatcher(net.minecraft.client.render.entity.EntityRenderDispatcher) BlockEntityRenderDispatcher(net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher)

Aggregations

PlayerListEntry (net.minecraft.client.network.PlayerListEntry)16 Entity (net.minecraft.entity.Entity)3 PlayerEntity (net.minecraft.entity.player.PlayerEntity)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 MinecraftClient (net.minecraft.client.MinecraftClient)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 fzmm.zailer.me.utils (fzmm.zailer.me.utils)1 Color (java.awt.Color)1 DecimalFormat (java.text.DecimalFormat)1 EventHandler (mathax.client.eventbus.EventHandler)1 Dimension (mathax.client.utils.world.Dimension)1