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;
}
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;
}
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;
}
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;
}
}
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);
}
Aggregations