This commit is contained in:
kirillsaint 2023-07-04 15:37:30 +06:00
parent a61dd5587a
commit f58590e137

View File

@ -1,25 +1,31 @@
package net.silentclient.client.gui; package net.silentclient.client.gui;
import java.io.IOException;
import java.net.URI;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui; 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.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils; 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.minecraft.GuiMainMenu;
import net.silentclient.client.gui.util.RenderUtil; 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 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 TimerUtils logoTimer = new TimerUtils();
private int logoY = 0; private int logoY = 0;
private final boolean firstTime; private final boolean firstTime;
@ -34,13 +40,28 @@ public class GuiNews extends GuiScreen {
@Override @Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) { 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(); GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks); Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE); this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 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); super.drawScreen(mouseX, mouseY, partialTicks);