Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void renderPlayerList(ScaledResolution resolution)
- {
- NetHandlerPlayClient clientHandler = this.mc.thePlayer.sendQueue;
- List<GuiPlayerInfo> playerInfoList = clientHandler.playerInfoList;
- int width = 0;
- for (GuiPlayerInfo playerInfo : playerInfoList)
- {
- ScorePlayerTeam team = this.mc.theWorld.getScoreboard().getPlayersTeam(playerInfo.name);
- String displayName = ScorePlayerTeam.formatPlayerName(team, playerInfo.name);
- int nameWidth = this.mc.fontRenderer.getStringWidth(displayName);
- width = Math.max(width, nameWidth);
- }
- playerInfoList = playerInfoList.subList(0, Math.min(playerInfoList.size(), 80));
- int maxPlayers = playerInfoList.size();
- int rows = maxPlayers;
- for (int columns = 1; rows > 20; rows = (maxPlayers + columns - 1) / columns) {
- columns++;
- }
- String[] tops = topText.split(System.getProperty("line.separator"));
- String[] bottoms = bottomText.split(System.getProperty("line.separator"));
- int columnWidth = Math.min(columns * (9 + width + 13), resolution.getScaledWidth() - 50) / columns;
- int left = resolution.getScaledWidth() / 2 - (columnWidth * columns + (columns - 1) * 5) / 2;
- int border = 10 + (!topText.equals("") ? 10 * tops.length : 0);
- int columnCount = columnWidth * columns + (columns - 1) * 5;
- FontRenderer fontRenderer = this.mc.fontRenderer;
- if ((topText.equals("")) && (bottomText.equals("")))
- {
- Gui.drawRect(resolution.getScaledWidth() / 2 - columnCount / 2 - 1, border - 1, resolution.getScaledWidth() / 2 + columnCount / 2 + 1, border + rows * 9, Integer.MIN_VALUE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement