Merge pull request #7 from Silent-Client/TEST2

Test2
This commit is contained in:
kirillsaint 2023-07-30 13:16:53 +06:00 committed by GitHub
commit b9e1022a76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 285 additions and 74 deletions

View File

@ -19,7 +19,7 @@ import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.lite.clickgui.ClickGUI;
import net.silentclient.client.gui.modmenu.ModMenu;
import net.silentclient.client.gui.silentmainmenu.SilentMainMenu;
import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.util.BackgroundPanorama;
import net.silentclient.client.keybinds.KeyBindManager;
import net.silentclient.client.mixin.accessors.MinecraftAccessor;
@ -322,7 +322,7 @@ public class Client {
if(globalSettings.lite) {
Minecraft.getMinecraft().displayGuiScreen(new GuiNews());
} else {
Minecraft.getMinecraft().displayGuiScreen(new SilentMainMenu());
Minecraft.getMinecraft().displayGuiScreen(new MainMenuConcept());
}
if(!globalSettings.displayedTutorial) {
@ -650,8 +650,8 @@ public class Client {
public GuiScreen getMainMenu() {
if(Client.getInstance().getGlobalSettings() == null) {
return new SilentMainMenu();
return new MainMenuConcept();
}
return Client.getInstance().getGlobalSettings().isLite() ? new LiteMainMenu() : new SilentMainMenu();
return Client.getInstance().getGlobalSettings().isLite() ? new LiteMainMenu() : new MainMenuConcept();
}
}

View File

@ -9,7 +9,7 @@ import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.silentmainmenu.SilentMainMenu;
import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.FileUtils;
@ -116,7 +116,7 @@ public class UserTutorial extends SilentScreen {
}
Client.getInstance().getGlobalSettings().setDisplayedTutorial(true);
Client.getInstance().getGlobalSettings().save();
mc.displayGuiScreen(Client.getInstance().getGlobalSettings().lite ? new GuiNews() : new SilentMainMenu());
mc.displayGuiScreen(Client.getInstance().getGlobalSettings().lite ? new GuiNews() : new MainMenuConcept());
}
}
}
@ -132,7 +132,7 @@ public class UserTutorial extends SilentScreen {
if(MouseUtils.isInside(mouseX, mouseY, blockX + (350 / 2) - (Client.getInstance().getSilentFontRenderer().getStringWidth("Skip Tutorial", 10, SilentFontRenderer.FontType.TITLE) / 2), blockY + 180 - 12, Client.getInstance().getSilentFontRenderer().getStringWidth("Skip Tutorial", 10, SilentFontRenderer.FontType.TITLE), 10)) {
Client.getInstance().getGlobalSettings().setDisplayedTutorial(true);
Client.getInstance().getGlobalSettings().save();
mc.displayGuiScreen(Client.getInstance().getGlobalSettings().lite ? new GuiNews() : new SilentMainMenu());
mc.displayGuiScreen(Client.getInstance().getGlobalSettings().lite ? new GuiNews() : new MainMenuConcept());
return;
}

View File

@ -1,28 +1,28 @@
package net.silentclient.client.gui.elements;
import java.awt.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.SoundHandler;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.silentclient.client.Client;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.IButtonTheme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.TimerUtils;
import java.awt.*;
public class Button extends GuiButton
{
private int animatedOpcaity = 0;
protected int animatedOpcaity = 0;
private boolean escMenu = false;
private int fontSize;
private TimerUtils animateTimer = new TimerUtils();
protected TimerUtils animateTimer = new TimerUtils();
private IButtonTheme theme;

View File

@ -39,8 +39,7 @@ public class GuiNews extends SilentScreen {
this.firstTime = firstTime;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
public static void loadPanel() {
if(image == null && !loading && news != null) {
loading = true;
(new Thread("NewsThread") {
@ -54,6 +53,11 @@ public class GuiNews extends SilentScreen {
imageLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("image_panel_" + new Random().nextLong(), new DynamicTexture(image));
initPanel = true;
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
loadPanel();
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();

View File

@ -1,21 +1,12 @@
package net.silentclient.client.gui.lite;
import java.io.IOException;
import java.net.URI;
import java.util.Random;
import net.minecraft.client.gui.*;
import net.minecraft.client.settings.GameSettings;
import net.silentclient.client.gui.silentmainmenu.SilentMainMenu;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GLContext;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.realms.RealmsBridge;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
@ -25,11 +16,19 @@ import net.minecraft.world.storage.ISaveFormat;
import net.minecraft.world.storage.WorldInfo;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.gui.CosmeticsGui;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
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.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.util.RenderUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GLContext;
import java.io.IOException;
import java.net.URI;
import java.util.Random;
public class LiteMainMenu extends GuiScreen implements GuiYesNoCallback
{
@ -242,7 +241,7 @@ public class LiteMainMenu extends GuiScreen implements GuiYesNoCallback
if(button.id == 89) {
Client.getInstance().getGlobalSettings().setLite(false);
Client.getInstance().getGlobalSettings().save();
mc.displayGuiScreen(new SilentMainMenu());
mc.displayGuiScreen(new MainMenuConcept());
}
if (button.id == 14 && this.realmsButton.visible)

View File

@ -0,0 +1,178 @@
package net.silentclient.client.gui.silentmainmenu;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.gui.GuiOptions;
import net.minecraft.client.gui.GuiSelectWorld;
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.cosmetics.gui.CosmeticsGui;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.silentmainmenu.components.AccountPicker;
import net.silentclient.client.gui.silentmainmenu.components.MenuOption;
import net.silentclient.client.gui.theme.button.IButtonTheme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.SCTextureManager;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URI;
import java.util.Random;
public class MainMenuConcept extends SilentScreen {
public static ResourceLocation imageLocation = null;
public static BufferedImage image = null;
public static boolean loading = false;
public static boolean initSkin = false;
private AccountPicker accountPicker;
@Override
public void initGui() {
super.initGui();
this.buttonList.clear();
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
this.buttonList.add(new MenuOption(1, 10, this.height / 2 - (14 * 3), 73, 14, "Singleplayer"));
this.buttonList.add(new MenuOption(2, 10, this.height / 2 - (14 * 2), 73, 14, "Multiplayer"));
this.buttonList.add(new MenuOption(3, 10, this.height / 2 - 14, 73, 14, "Options"));
this.buttonList.add(new MenuOption(4, 10, this.height / 2, 73, 14, "Cosmetics"));
this.buttonList.add(new MenuOption(5, 10, this.height / 2 + 14, 73, 14, "Lite Edition"));
this.buttonList.add(new MenuOption(6, 10, this.height / 2 + 28, 73, 14, "Store"));
this.buttonList.add(new IconButton(7, this.width - 25, 3, new ResourceLocation("silentclient/icons/cross.png")));
if(this.buttonList.get(6) instanceof IconButton) {
((IconButton) this.buttonList.get(6)).setTheme(new IButtonTheme() {
@Override
public Color getBorderColor() {
return new Color(214, 213, 210, 0);
}
@Override
public Color getBackgroundColor() {
return new Color(0, 0, 0, 0);
}
@Override
public Color getTextColor() {
return new Color(255, 255, 255);
}
@Override
public Color getHoveredBackgroundColor(int opacity) {
return new Color(255, 255, 255, opacity);
}
});
}
this.accountPicker = new AccountPicker(width - 120 + (62 / 2), height / 2 - 75 + 155);
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
GuiNews.loadPanel();
this.loadSkin();
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
if(imageLocation != null) {
RenderUtil.drawImage(imageLocation, width - 120, height / 2 - (75), 62, 150, false);
}
if(GuiNews.imageLocation != null) {
RenderUtils.drawRect(10, 10, 109, 63, -1);
RenderUtil.drawImage(GuiNews.imageLocation, 12, 12, 105, 59, false);
}
Client.getInstance().getSilentFontRenderer().drawString(3, height - 14, "Silent Client 1.8.9", 12, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
this.accountPicker.draw(mc, mouseX, mouseY);
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
switch (button.id) {
case 1:
mc.displayGuiScreen(new GuiSelectWorld(this));
break;
case 2:
mc.displayGuiScreen(new GuiMultiplayer(this));
break;
case 3:
mc.displayGuiScreen(new GuiOptions(this, mc.gameSettings));
break;
case 4:
mc.displayGuiScreen(new CosmeticsGui());
break;
case 5:
Client.getInstance().getGlobalSettings().setLite(true);
Client.getInstance().getGlobalSettings().save();
mc.displayGuiScreen(new LiteMainMenu());
break;
case 6:
try {
Class<?> oclass = Class.forName("java.awt.Desktop");
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI("https://store.silentclient.net/")});
} catch (Throwable err) {
err.printStackTrace();
}
break;
case 7:
mc.shutdown();
break;
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
if(MouseUtils.isInside(mouseX, mouseY, 10, 10, 109, 63)) {
try {
Class<?> oclass = Class.forName("java.awt.Desktop");
Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {new URI("https://silentclient.net/news/" + GuiNews.news.getItem().id)});
} catch (Throwable err) {
err.printStackTrace();
}
return;
}
this.accountPicker.onClick(mc, mouseX, mouseY);
}
@Override
public void updateScreen() {
super.updateScreen();
Client.backgroundPanorama.tickPanorama();
}
// Functions
private void loadSkin() {
if(image == null && !loading) {
loading = true;
(new Thread("SkinThread") {
public void run() {
MainMenuConcept.image = SCTextureManager.getImage(String.format("https://mc-heads.net/body/%s/left/1000.png", Client.getInstance().getAccount().getUsername()));
MainMenuConcept.loading = false;
}
}).start();
}
if(image != null && !initSkin) {
imageLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("player_skin_" + new Random().nextLong(), new DynamicTexture(image));
initSkin = true;
}
}
}

View File

@ -1,33 +1,23 @@
package net.silentclient.client.gui.silentmainmenu;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
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.cosmetics.gui.CosmeticsGui;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.SCTextureManager;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URI;
import java.util.Random;
public class SilentMainMenu extends SilentScreen {
public static ResourceLocation imageLocation = null;
public static BufferedImage image = null;
public static boolean loading = false;
public static boolean initPanel = false;
@Override
public void initGui() {
super.initGui();
@ -41,7 +31,7 @@ public class SilentMainMenu extends SilentScreen {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.loadPanels();
GuiNews.loadPanel();
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
@ -61,8 +51,8 @@ public class SilentMainMenu extends SilentScreen {
blockY = 70;
}
RenderUtils.drawRect(blockX, blockY, 320, 150, new Color(20, 20, 20).getRGB());
if(imageLocation != null) {
RenderUtil.drawImage(imageLocation, blockX + 78, blockY + 10, 231, 130, false);
if(GuiNews.imageLocation != null) {
RenderUtil.drawImage(GuiNews.imageLocation, blockX + 78, blockY + 10, 231, 130, false);
}
int optionY = blockY + 10;
@ -107,22 +97,6 @@ public class SilentMainMenu extends SilentScreen {
Client.getInstance().getSilentFontRenderer().drawString("Version 1.8.9", this.width - (Client.getInstance().getSilentFontRenderer().getStringWidth("Version 1.8.9", 14, SilentFontRenderer.FontType.TITLE)) - 5, this.height - 17, 14, SilentFontRenderer.FontType.TITLE);
}
private void loadPanels() {
if(image == null && !loading && GuiNews.news != null) {
loading = true;
(new Thread("NewsThread") {
public void run() {
SilentMainMenu.image = SCTextureManager.getImage(GuiNews.news.getItem().getCover());
SilentMainMenu.loading = false;
}
}).start();
}
if(image != null && !initPanel) {
imageLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("image_panel_" + new Random().nextLong(), new DynamicTexture(image));
initPanel = true;
}
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);

View File

@ -0,0 +1,23 @@
package net.silentclient.client.gui.silentmainmenu.components;
import net.minecraft.client.Minecraft;
public class AccountPicker {
private boolean open;
private final int x;
private final int y;
public AccountPicker(int x, int y) {
this.x = x;
this.y = y;
this.open = false;
}
public void draw(Minecraft mc, int mouseX, int mouseY) {
// Client.getInstance().getSilentFontRenderer().drawCenteredString(Client.getInstance().getAccount().original_username, x, y, 14, SilentFontRenderer.FontType.TITLE);
}
public void onClick(Minecraft mc, int mouseX, int mouseY) {
}
}

View File

@ -0,0 +1,37 @@
package net.silentclient.client.gui.silentmainmenu.components;
import net.minecraft.client.Minecraft;
import net.silentclient.client.Client;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.utils.ColorUtils;
import java.awt.*;
public class MenuOption extends Button {
private SimpleAnimation animation;
public MenuOption(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
animation = new SimpleAnimation(0);
}
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
RenderUtils.drawRect(this.xPosition, this.yPosition, animation.getValue(), this.height, new Color(255, 255, 255, 76).getRGB());
if(this.displayString.equalsIgnoreCase("store")) {
ColorUtils.setColor(new Color(255, 230, 0).getRGB());
}
Client.getInstance().getSilentFontRenderer().drawString(this.displayString.toUpperCase(), this.xPosition + 3, this.yPosition + (this.height / 2) - 7, 14, SilentFontRenderer.FontType.TITLE);
animation.setAnimation(this.hovered && this.enabled ? this.width : 0, 9);
} else {
animation.setValue(0);
}
}
}

View File

@ -5,10 +5,6 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.StaticResourceLocation;

View File

@ -20,6 +20,7 @@ import net.silentclient.client.Client;
import net.silentclient.client.event.impl.*;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.silentmainmenu.SilentMainMenu;
import net.silentclient.client.gui.util.BackgroundPanorama;
import net.silentclient.client.hooks.MinecraftHook;
@ -62,7 +63,7 @@ public abstract class MinecraftMixin {
Client.backgroundPanorama = new BackgroundPanorama(Minecraft.getMinecraft());
}
if(Client.getInstance().getGlobalSettings() != null) {
displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new GuiNews() : new SilentMainMenu());
displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new GuiNews() : new MainMenuConcept());
}
}
@ -127,7 +128,7 @@ public abstract class MinecraftMixin {
}
if(guiScreenIn instanceof GuiMainMenu) {
if(Client.getInstance().getGlobalSettings() != null) {
displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new LiteMainMenu() : new SilentMainMenu());
displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new LiteMainMenu() : new MainMenuConcept());
}
return;
}

View File

@ -1,11 +1,5 @@
package net.silentclient.client.mods;
import java.awt.Color;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mixin.accessors.GuiAccessor;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
@ -14,13 +8,18 @@ import net.minecraft.client.renderer.GlStateManager;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.RenderEvent;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.hud.IRenderer;
import net.silentclient.client.gui.hud.ScreenPosition;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mixin.accessors.GuiAccessor;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.ColorUtils;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public abstract class ModDraggable extends Mod implements IRenderer {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB