Better Friend List Overlay

This commit is contained in:
kirillsaint 2023-08-18 18:22:01 +06:00
parent 92ba5843d5
commit cd608af890
2 changed files with 30 additions and 8 deletions

View File

@ -10,6 +10,7 @@ import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.IconButton; import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer; 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.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.theme.Theme;
@ -55,11 +56,18 @@ public class FriendsListOverlay extends GuiScreen {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
int width = 150; int width = 150;
GlStateManager.translate(this.introAnimation.getValue(), 0, 0); 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()); 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()); 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()); 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); font.drawString(mc.getCurrentServerData() == null ? "Online" : "Playing on " + mc.getCurrentServerData().serverIP, 23, 5 + 8, 10, SilentFontRenderer.FontType.TITLE, 90);
super.drawScreen(mouseX, mouseY, partialTicks); super.drawScreen(mouseX, mouseY, partialTicks);
@ -73,13 +81,20 @@ public class FriendsListOverlay extends GuiScreen {
GL11.glScissor(0 * s, translatedY * s, width * s, listHeight * s); GL11.glScissor(0 * s, translatedY * s, width * s, listHeight * s);
if(!showRequests) { if(!showRequests) {
for(FriendsResponse.Friend friend : Client.getInstance().getFriends().getFriends()) { 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()) { if(friend.isOnline()) {
ColorUtils.setColor(new Color(9, 165, 51).getRGB()); ColorUtils.setColor(new Color(9, 165, 51).getRGB());
} else { } else {
ColorUtils.setColor(new Color(255, 255, 255).getRGB()); 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()); 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); 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); RenderUtil.drawImage(new ResourceLocation("silentclient/icons/cross.png"), 135, friendY + 3, 12, 12, false);
@ -87,9 +102,16 @@ public class FriendsListOverlay extends GuiScreen {
} }
} else { } else {
for(FriendsResponse.Request request : Client.getInstance().getFriends().getRequests()) { 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()); 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()); 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); font.drawString(request.isIncoming() ? "Incoming Friend Request" : "Outgoing Friend Request", 23, friendY + 8, 10, SilentFontRenderer.FontType.TITLE);
if(request.isIncoming()) { if(request.isIncoming()) {

View File

@ -118,7 +118,7 @@ public class LiteAccountPicker extends AccountPicker {
this.open = false; this.open = false;
} }
public class MinecraftAvatar { public static class MinecraftAvatar {
public ResourceLocation imageLocation = new ResourceLocation("silentclient/images/steve_head.png"); public ResourceLocation imageLocation = new ResourceLocation("silentclient/images/steve_head.png");
public BufferedImage image = null; public BufferedImage image = null;
public boolean initSkin = false; public boolean initSkin = false;