diff --git a/src/main/java/net/silentclient/client/gui/elements/TooltipIconButton.java b/src/main/java/net/silentclient/client/gui/elements/TooltipIconButton.java new file mode 100644 index 0000000..8648e0a --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/elements/TooltipIconButton.java @@ -0,0 +1,31 @@ +package net.silentclient.client.gui.elements; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.ResourceLocation; +import net.silentclient.client.Client; +import net.silentclient.client.gui.font.SilentFontRenderer; +import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; +import net.silentclient.client.gui.theme.Theme; + +public class TooltipIconButton extends IconButton { + private final String tooltipText; + + public TooltipIconButton(int buttonId, int x, int y, int widthIn, int heightIn, int iconWidth, int iconHeight, ResourceLocation icon, String tooltipText) { + super(buttonId, x, y, widthIn, heightIn, iconWidth, iconHeight, icon); + this.tooltipText = tooltipText; + } + + @Override + public void drawButton(Minecraft mc, int mouseX, int mouseY) { + super.drawButton(mc, mouseX, mouseY); + if(this.hovered) { + float tooltipWidth = Client.getInstance().getSilentFontRenderer().getStringWidth(this.tooltipText, 10, SilentFontRenderer.FontType.TITLE) + 4; + float tooltipX = this.xPosition + ((this.width / 2) - (tooltipWidth / 2)); + if(tooltipX < 2) { + tooltipX = 2; + } + RenderUtils.drawRect(tooltipX, this.yPosition + this.height + 2, tooltipWidth, 14, Theme.backgroundColor().getRGB()); + Client.getInstance().getSilentFontRenderer().drawString(this.tooltipText, tooltipX + 2, this.yPosition + this.height + 2 + 2, 10, SilentFontRenderer.FontType.TITLE); + } + } +} 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 db6bde4..c854195 100644 --- a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java +++ b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java @@ -9,6 +9,7 @@ import net.silentclient.client.gui.SilentScreen; 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.elements.TooltipIconButton; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.lite.LiteAccountPicker; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; @@ -47,7 +48,7 @@ public class FriendsListOverlay extends SilentScreen { this.buttonList.add(new Button(2, 3, 26, 70, 15, "Friends", 12, false, !showRequests ? new SelectedButtonTheme() : new DefaultButtonTheme())); this.buttonList.add(new Button(3, 76, 26, 70, 15, "Requests", 12, false, showRequests ? new SelectedButtonTheme() : new DefaultButtonTheme())); - this.buttonList.add(new IconButton(4, 116, 6, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/friends-add.png"))); + this.buttonList.add(new TooltipIconButton(4, 116, 6, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/friends-add.png"), "Add friend")); } @Override diff --git a/src/main/java/net/silentclient/client/gui/lite/LiteMainMenu.java b/src/main/java/net/silentclient/client/gui/lite/LiteMainMenu.java index dddc823..1f8b1bf 100644 --- a/src/main/java/net/silentclient/client/gui/lite/LiteMainMenu.java +++ b/src/main/java/net/silentclient/client/gui/lite/LiteMainMenu.java @@ -8,7 +8,7 @@ import net.silentclient.client.cosmetics.gui.CosmeticsGui; import net.silentclient.client.gui.SilentScreen; 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.elements.TooltipIconButton; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.silentmainmenu.MainMenuConcept; @@ -35,11 +35,11 @@ public class LiteMainMenu extends SilentScreen Client.backgroundPanorama.updateWidthHeight(this.width, this.height); this.buttonList.clear(); - this.buttonList.add(new IconButton(1, 4, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/news.png"))); - this.buttonList.add(new IconButton(2, 24, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/settings/cosmetics.png"))); - this.buttonList.add(new IconButton(3, 44, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/store_icon.png"))); - this.buttonList.add(new IconButton(4, 64, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/language.png"))); - this.buttonList.add(new IconButton(5, 84, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/back.png"))); + this.buttonList.add(new TooltipIconButton(1, 4, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/news.png"), "News")); + this.buttonList.add(new TooltipIconButton(2, 24, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/settings/cosmetics.png"), "Cosmetics")); + this.buttonList.add(new TooltipIconButton(3, 44, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/store_icon.png"), "Store")); + this.buttonList.add(new TooltipIconButton(4, 64, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/language.png"), "Language")); + this.buttonList.add(new TooltipIconButton(5, 84, 5, 18, 18, 10, 10, new ResourceLocation("silentclient/icons/back.png"), "Switch to SLC")); int buttonY = this.height / 2 - 18; diff --git a/src/main/java/net/silentclient/client/gui/minecraft/GuiIngameMenu.java b/src/main/java/net/silentclient/client/gui/minecraft/GuiIngameMenu.java index 2dd31e1..c73d563 100644 --- a/src/main/java/net/silentclient/client/gui/minecraft/GuiIngameMenu.java +++ b/src/main/java/net/silentclient/client/gui/minecraft/GuiIngameMenu.java @@ -15,7 +15,7 @@ import net.silentclient.client.event.impl.ServerLeaveEvent; import net.silentclient.client.gui.GuiMultiplayerInGame; import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.gui.elements.IconButton; +import net.silentclient.client.gui.elements.TooltipIconButton; import net.silentclient.client.gui.friends.FriendsListOverlay; import net.silentclient.client.gui.hud.Watermark; import net.silentclient.client.gui.lite.clickgui.ClickGUI; @@ -52,18 +52,18 @@ public class GuiIngameMenu extends SilentScreen this.buttonList.add(new Button(9, 2, this.height - 10 + i, 95, 20, "Reload Resources", true)); int iconX = 4; - this.buttonList.add(new IconButton(5, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/trophy.png"))); + this.buttonList.add(new TooltipIconButton(5, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/trophy.png"), "Achievements")); iconX += 18; - this.buttonList.add(new IconButton(6, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/graph.png"))); + this.buttonList.add(new TooltipIconButton(6, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/graph.png"), "Statistics")); iconX += 18; if(mc.isSingleplayer() && !mc.getIntegratedServer().getPublic()) { - this.buttonList.add(new IconButton(12, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/lan.png"))); + this.buttonList.add(new TooltipIconButton(12, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/lan.png"), "Open to LAN")); iconX += 18; } - this.buttonList.add(new IconButton(13, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/friends.png"))); + this.buttonList.add(new TooltipIconButton(13, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/friends.png"), "Friends")); iconX += 18; if(Client.getInstance().getAccount().isStaff()) { - this.buttonList.add(new IconButton(14, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/store_icon.png"))); + this.buttonList.add(new TooltipIconButton(14, iconX, 5, 15, 15, 7, 7, new ResourceLocation("silentclient/icons/store_icon.png"), "Admin Render")); } } diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java b/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java index f0b384f..ec78052 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java @@ -79,8 +79,6 @@ public class ColorPicker extends SilentScreen { ModMenu.drawOverlayListBase(height, "Choose a color"); - super.drawScreen(mouseX, mouseY, partialTicks); - ModMenu.trimContentStart(width, height); float colorY = 66; int colorX = 3; @@ -121,6 +119,8 @@ public class ColorPicker extends SilentScreen { cursorType = MouseCursorHandler.CursorType.POINTER; } + super.drawScreen(mouseX, mouseY, partialTicks); + Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); ModMenu.trimContentEnd(); diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java b/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java index 95a379a..d1c8596 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java @@ -91,7 +91,7 @@ public class ModMenu extends SilentScreen { public static void initBaseButtons(List buttonList) { buttonList.add(new IconButton(91, 132, 5, 15, 15, 9, 9, new ResourceLocation("silentclient/icons/exit.png"))); - buttonList.add(new IconButton(92, 132, 46, 15, 15, 9, 9, new ResourceLocation("silentclient/icons/pencil.png"))); + buttonList.add(new TooltipIconButton(92, 132, 46, 15, 15, 9, 9, new ResourceLocation("silentclient/icons/pencil.png"), "Edit HUD")); } public static void clickBaseButtons(GuiButton button, GuiScreen screen) { @@ -125,8 +125,6 @@ public class ModMenu extends SilentScreen { MenuBlurUtils.renderBackground(this); ModMenu.drawOverlayListBase(height, modCategory == ModCategory.PLUS ? "Premium" : null); - super.drawScreen(mouseX, mouseY, partialTicks); - if(modCategory != ModCategory.CONFIGS && modCategory != ModCategory.PLUS) { this.silentInputs.get(0).render(mouseX, mouseY, 3, 46, 127, true); this.buttonList.get(6).visible = false; @@ -241,10 +239,12 @@ public class ModMenu extends SilentScreen { this.scrollHeight = 66 + premiumY + scrollAnimation.getValue(); } - Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); - trimContentEnd(); + super.drawScreen(mouseX, mouseY, partialTicks); + + Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); + scrollAnimation.setAnimation(scrollY, 12); } diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java b/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java index 727c40c..724b0ef 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java @@ -80,8 +80,6 @@ public class ModSettings extends SilentScreen { MenuBlurUtils.renderBackground(this); ModMenu.drawOverlayListBase(height, mod.getName()); - super.drawScreen(mouseX, mouseY, partialTicks); - MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList); ModMenu.trimContentStart(width, height); @@ -161,12 +159,14 @@ public class ModSettings extends SilentScreen { settingY += settingHeight; } - Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); - this.scrollHeight = 66 + settingY + scrollAnimation.getValue(); ModMenu.trimContentEnd(); + super.drawScreen(mouseX, mouseY, partialTicks); + + Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); + scrollAnimation.setAnimation((float) scrollY, 12); } diff --git a/src/main/java/net/silentclient/client/gui/modmenu/PremiumColorPicker.java b/src/main/java/net/silentclient/client/gui/modmenu/PremiumColorPicker.java index 1413c52..7b7016a 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/PremiumColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/PremiumColorPicker.java @@ -63,8 +63,6 @@ public class PremiumColorPicker extends SilentScreen { ModMenu.drawOverlayListBase(height, "Choose a color"); - super.drawScreen(mouseX, mouseY, partialTicks); - ModMenu.trimContentStart(width, height); float colorY = 66; int colorX = 3; @@ -94,6 +92,8 @@ public class PremiumColorPicker extends SilentScreen { cursorType = MouseCursorHandler.CursorType.POINTER; } + super.drawScreen(mouseX, mouseY, partialTicks); + Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); ModMenu.trimContentEnd();