diff --git a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java index a2d5485..a3f3268 100644 --- a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java +++ b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java @@ -10,6 +10,7 @@ import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.IconButton; import net.silentclient.client.gui.font.SilentFontRenderer; +import net.silentclient.client.gui.lite.LiteAccountPicker; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.theme.Theme; @@ -55,11 +56,18 @@ public class FriendsListOverlay extends GuiScreen { GlStateManager.pushMatrix(); int width = 150; GlStateManager.translate(this.introAnimation.getValue(), 0, 0); - this.introAnimation.setAnimation(0, 30); + this.introAnimation.setValue(0); RenderUtils.drawRect(0, 0, width, height, Theme.backgroundColor().getRGB()); - RenderUtil.drawImage(Client.getInstance().getAccount().getSelectedIcon() != 0 && !Client.getInstance().getAccount().plusIcon() ? Client.getInstance().getCosmetics().getIconById(Client.getInstance().getAccount().getSelectedIcon()).getLocation() : new ResourceLocation(Client.getInstance().getAccount().plusIcon() ? "silentclient/icons/plus_icon.png" : "silentclient/icons/player_icon.png"), 3, 5, 18, 18, false); + if(!LiteAccountPicker.avatars.containsKey(Client.getInstance().getAccount().original_username)) { + LiteAccountPicker.avatars.put(Client.getInstance().getAccount().original_username, new LiteAccountPicker.MinecraftAvatar(Client.getInstance().getAccount().original_username)); + } + + if(!LiteAccountPicker.avatars.get(Client.getInstance().getAccount().original_username).initSkin) { + LiteAccountPicker.avatars.get(Client.getInstance().getAccount().original_username).loadSkin(); + } + RenderUtil.drawImage(LiteAccountPicker.avatars.get(Client.getInstance().getAccount().original_username).imageLocation, 3, 5, 18, 18, false); ColorUtils.setColor(new Color(9, 165, 51).getRGB()); - font.drawString(Client.getInstance().getAccount().original_username, 23, 5 - 2, 12, SilentFontRenderer.FontType.TITLE); + font.drawString(Client.getInstance().getAccount().original_username, 23, 5 - 1, 12, SilentFontRenderer.FontType.TITLE); ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB()); font.drawString(mc.getCurrentServerData() == null ? "Online" : "Playing on " + mc.getCurrentServerData().serverIP, 23, 5 + 8, 10, SilentFontRenderer.FontType.TITLE, 90); super.drawScreen(mouseX, mouseY, partialTicks); @@ -73,13 +81,20 @@ public class FriendsListOverlay extends GuiScreen { GL11.glScissor(0 * s, translatedY * s, width * s, listHeight * s); if(!showRequests) { for(FriendsResponse.Friend friend : Client.getInstance().getFriends().getFriends()) { - RenderUtil.drawImage(friend.getIcon().getLocation(), 3, friendY, 18, 18, false); + if(!LiteAccountPicker.avatars.containsKey(friend.username)) { + LiteAccountPicker.avatars.put(friend.username, new LiteAccountPicker.MinecraftAvatar(friend.username)); + } + + if(!LiteAccountPicker.avatars.get(friend.username).initSkin) { + LiteAccountPicker.avatars.get(friend.username).loadSkin(); + } + RenderUtil.drawImage(LiteAccountPicker.avatars.get(friend.username).imageLocation, 3, friendY, 18, 18, false); if(friend.isOnline()) { ColorUtils.setColor(new Color(9, 165, 51).getRGB()); } else { ColorUtils.setColor(new Color(255, 255, 255).getRGB()); } - font.drawString(friend.getUsername(), 23, friendY - 2, 12, SilentFontRenderer.FontType.TITLE); + font.drawString(friend.getUsername(), 23, friendY - 1, 12, SilentFontRenderer.FontType.TITLE); ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB()); font.drawString(friend.isOnline() ? friend.getCurrentServer().equals("") ? "Online" : "Playing on " + friend.getCurrentServer() : "Offline", 23, friendY + 8, 10, SilentFontRenderer.FontType.TITLE, 108); RenderUtil.drawImage(new ResourceLocation("silentclient/icons/cross.png"), 135, friendY + 3, 12, 12, false); @@ -87,9 +102,16 @@ public class FriendsListOverlay extends GuiScreen { } } else { for(FriendsResponse.Request request : Client.getInstance().getFriends().getRequests()) { - RenderUtil.drawImage(request.getIcon().getLocation(), 3, friendY, 18, 18, false); + if(!LiteAccountPicker.avatars.containsKey(request.username)) { + LiteAccountPicker.avatars.put(request.username, new LiteAccountPicker.MinecraftAvatar(request.username)); + } + + if(!LiteAccountPicker.avatars.get(request.username).initSkin) { + LiteAccountPicker.avatars.get(request.username).loadSkin(); + } + RenderUtil.drawImage(LiteAccountPicker.avatars.get(request.username).imageLocation, 3, friendY, 18, 18, false); ColorUtils.setColor(new Color(255, 255, 255).getRGB()); - font.drawString(request.getUsername(), 23, friendY - 2, 12, SilentFontRenderer.FontType.TITLE); + font.drawString(request.getUsername(), 23, friendY - 1, 12, SilentFontRenderer.FontType.TITLE); ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB()); font.drawString(request.isIncoming() ? "Incoming Friend Request" : "Outgoing Friend Request", 23, friendY + 8, 10, SilentFontRenderer.FontType.TITLE); if(request.isIncoming()) { diff --git a/src/main/java/net/silentclient/client/gui/lite/LiteAccountPicker.java b/src/main/java/net/silentclient/client/gui/lite/LiteAccountPicker.java index 77887ca..15f7b02 100644 --- a/src/main/java/net/silentclient/client/gui/lite/LiteAccountPicker.java +++ b/src/main/java/net/silentclient/client/gui/lite/LiteAccountPicker.java @@ -118,7 +118,7 @@ public class LiteAccountPicker extends AccountPicker { this.open = false; } - public class MinecraftAvatar { + public static class MinecraftAvatar { public ResourceLocation imageLocation = new ResourceLocation("silentclient/images/steve_head.png"); public BufferedImage image = null; public boolean initSkin = false;