diff --git a/src/main/java/net/silentclient/client/gui/GuiNews.java b/src/main/java/net/silentclient/client/gui/GuiNews.java index f218977..6bc7414 100644 --- a/src/main/java/net/silentclient/client/gui/GuiNews.java +++ b/src/main/java/net/silentclient/client/gui/GuiNews.java @@ -1,25 +1,31 @@ package net.silentclient.client.gui; -import java.io.IOException; -import java.net.URI; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.silentclient.client.Client; -import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.utils.TimerUtils; - import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.util.ResourceLocation; +import net.silentclient.client.Client; import net.silentclient.client.gui.clickgui.utils.MouseUtils; +import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.minecraft.GuiMainMenu; import net.silentclient.client.gui.util.RenderUtil; +import net.silentclient.client.utils.SCTextureManager; +import net.silentclient.client.utils.TimerUtils; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.net.URI; +import java.util.Random; public class GuiNews extends GuiScreen { - + public static ResourceLocation imageLocation = null; + public static BufferedImage image = null; + public static boolean loading = false; + public static boolean initPanel = false; private TimerUtils logoTimer = new TimerUtils(); private int logoY = 0; private final boolean firstTime; @@ -34,13 +40,28 @@ public class GuiNews extends GuiScreen { @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { + if(image == null && !loading) { + loading = true; + (new Thread("NewsThread") { + public void run() { + GuiNews.image = SCTextureManager.getImage("https://i.imgur.com/jdEAKN6.png"); + GuiNews.loading = false; + } + }).start(); + } + if(image != null && !initPanel) { + imageLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("image_panel_" + new Random().nextLong(), new DynamicTexture(image)); + initPanel = true; + } GlStateManager.disableAlpha(); Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks); GlStateManager.enableAlpha(); this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - RenderUtil.drawImage(new ResourceLocation("silentclient/promo/latest.png"), (this.width / 2) - (300 / 2), (this.height / 2) - (168 / 2) - 10, 300, 168); + if(imageLocation != null) { + RenderUtil.drawImage(imageLocation, (this.width / 2) - (300 / 2), (this.height / 2) - (168 / 2) - 10, 300, 168); + } super.drawScreen(mouseX, mouseY, partialTicks);