Merge pull request #19 from Silent-Client/TEST2

Test2
This commit is contained in:
kirillsaint 2023-08-06 20:03:41 +06:00 committed by GitHub
commit a8e81efe1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 484 additions and 522 deletions

View File

@ -61,32 +61,32 @@ public class CosmeticsGui extends SilentScreen {
int height = addY * 2;
int tabId = 1;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Capes", false, selectedCategory == "capes" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Capes", false, selectedCategory == "capes" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Wings", false, selectedCategory == "wings" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Wings", false, selectedCategory == "wings" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Bandanas", false, selectedCategory == "bandanas" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Bandanas", false, selectedCategory == "bandanas" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Hats", false, selectedCategory == "hats" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Hats", false, selectedCategory == "hats" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Shields", false, selectedCategory == "shields" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=20;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Shields", false, selectedCategory == "shields" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
categoryOffsetY +=23;
tabId++;
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Icons", false, selectedCategory == "icons" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 18, "Icons", false, selectedCategory == "icons" ? new SelectedButtonTheme() : new DefaultButtonTheme()));
tabId++;
this.buttonList.add(new Button(tabId, x + 5, (y + height) - 26, 75, 20, "Store"));
this.buttonList.add(new Button(tabId, x + 5, (y + height) - 24, 75, 18, "Store"));
this.buttonList.add(new Button(88, x + 380 - 140, y + 220 - 22, 135, 20, "Outfits"));
this.buttonList.add(new Button(88, x + 380 - 140, (y + height) - 24, 135, 18, "Outfits"));
}
@Override
@ -238,7 +238,11 @@ public class CosmeticsGui extends SilentScreen {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
} else {
MenuBlurUtils.renderBackground(this);
}

View File

@ -17,6 +17,7 @@ import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.NotificationUtils;
import org.lwjgl.input.Keyboard;
import java.awt.*;
import java.io.IOException;
public class NewOutfitModal extends SilentScreen {
@ -27,7 +28,7 @@ public class NewOutfitModal extends SilentScreen {
public NewOutfitModal(GuiScreen parentScreen) {
this.parentScreen = parentScreen;
this.modalWidth = 200;
this.modalHeight = 90;
this.modalHeight = 70;
}
@Override
@ -83,7 +84,11 @@ public class NewOutfitModal extends SilentScreen {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
} else {
MenuBlurUtils.renderBackground(this);
}
@ -93,7 +98,7 @@ public class NewOutfitModal extends SilentScreen {
// Header
RenderUtils.drawRect(x, y, this.modalWidth, this.modalHeight, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString("New Config", x + 3, y + 3, 14, SilentFontRenderer.FontType.TITLE);
Client.getInstance().getSilentFontRenderer().drawString("New Outfit", x + 3, y + 3, 14, SilentFontRenderer.FontType.TITLE);
// Content
this.silentInputs.get(0).render(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);

View File

@ -57,7 +57,11 @@ public class OutfitsGui extends SilentScreen {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
} else {
MenuBlurUtils.renderBackground(this);
}

View File

@ -1,16 +1,15 @@
package net.silentclient.client.gui;
import java.io.IOException;
import net.minecraft.client.gui.Gui;
import net.silentclient.client.gui.elements.Button;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.silentclient.client.Client;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.font.SilentFontRenderer;
import java.awt.*;
import java.io.IOException;
public class GuiError extends GuiScreen {
private final String error;
@ -24,7 +23,11 @@ public class GuiError extends GuiScreen {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

View File

@ -18,7 +18,7 @@ import java.awt.*;
public class Button extends GuiButton
{
protected int animatedOpcaity = 0;
protected int animatedOpacity = 0;
private boolean escMenu = false;
private int fontSize;
@ -67,27 +67,27 @@ public class Button extends GuiButton
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
ColorUtils.setColor(theme.getBackgroundColor().getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, width, height, (float)3, theme.getBackgroundColor().getRGB());
ColorUtils.setColor(theme.getHoveredBackgroundColor(this.enabled ? animatedOpcaity : 0).getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, width, height, (float)3, theme.getHoveredBackgroundColor(this.enabled ? animatedOpcaity : 0).getRGB());
ColorUtils.setColor(theme.getHoveredBackgroundColor(this.enabled ? animatedOpacity : 0).getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, width, height, (float)3, theme.getHoveredBackgroundColor(this.enabled ? animatedOpacity : 0).getRGB());
ColorUtils.setColor(this.enabled ? new Color(214, 213, 210, 255).getRGB() : new Color(255,255,255,50).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, width, height, 3, 1, theme.getBorderColor().getRGB());
this.mouseDragged(mc, mouseX, mouseY);
if (this.hovered && this.enabled) {
if (this.animatedOpcaity < 75 && animateTimer.delay(30)) {
this.animatedOpcaity += 15;
if (this.animatedOpacity < 75 && animateTimer.delay(30)) {
this.animatedOpacity += 15;
animateTimer.reset();
}
} else {
if (this.animatedOpcaity != 0 && animateTimer.delay(30)) {
this.animatedOpcaity -= 15;
if (this.animatedOpacity != 0 && animateTimer.delay(30)) {
this.animatedOpacity -= 15;
animateTimer.reset();
}
}
this.drawButtonContent();
} else {
this.animatedOpcaity = 0;
this.animatedOpacity = 0;
}
}

View File

@ -5,14 +5,10 @@ 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.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer.FontType;
import net.silentclient.client.gui.lite.clickgui.ModSettings;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.mods.CustomFontRenderer;
import net.silentclient.client.mods.CustomFontRenderer.RenderMode;
import net.silentclient.client.mods.Mod;
@ -26,17 +22,12 @@ import net.silentclient.client.utils.Sounds;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.io.IOException;
import java.text.DecimalFormat;
public class HUDConfigScreen extends GuiScreen {
private final GuiScreen screen;
private CustomFontRenderer font;
private boolean tutorial = false;
private Mod mod = null;
@Override
@ -44,11 +35,9 @@ public class HUDConfigScreen extends GuiScreen {
MenuBlurUtils.loadBlur();
super.initGui();
this.tutorial = false;
this.mod = null;
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
this.buttonList.add(new Button(0, scaledresolution.getScaledWidth() / 2 - 50, scaledresolution.getScaledHeight() - 65, 100, 20, "Back"));
this.buttonList.add(new Button(1, scaledresolution.getScaledWidth() / 2 - 50, scaledresolution.getScaledHeight() - 88, 100, 20, "Help"));
this.buttonList.add(new IconButton(0, scaledresolution.getScaledWidth() / 2 - 10, scaledresolution.getScaledHeight() - 80, 30, 30, 22, 22, new ResourceLocation("silentclient/icons/back.png")));
this.font = new CustomFontRenderer();
font.setRenderMode(RenderMode.CUSTOM);
@ -99,6 +88,7 @@ public class HUDConfigScreen extends GuiScreen {
}
if(((ModDraggable) m).isDragging()) {
this.mod = m;
((ModDraggable) m).setPos(new ScreenPosition(mouseX + ((ModDraggable) m).getDraggingX(), mouseY + ((ModDraggable) m).getDraggingY()));
}
@ -117,49 +107,12 @@ public class HUDConfigScreen extends GuiScreen {
}
}
if(mod != null && !((ModDraggable) mod).isDragging()) {
this.mod = null;
}
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
if (this.buttonList != null && this.buttonList.size() != 0)
{
if (this.tutorial)
{
int i = scaledresolution.getScaledWidth() / 2 - 70;
int j = scaledresolution.getScaledHeight() / 2 - 45;
i = i - 4;
int currentY = j + 2;
font.drawString("Gui Editing Explained", i, currentY, 16, SilentFontRenderer.FontType.HEADER, -1, false);
currentY = currentY + 20;
i = i + (font.getStringWidth("Gui Editing Explained", 16, FontType.HEADER) / 2);
font.drawString("Mouse 1 - Hold | drag mod", i - (font.getStringWidth("Mouse 1 - Hold | drag mod", 12, FontType.TITLE) / 2), currentY, 12, SilentFontRenderer.FontType.TITLE, -1, false);
currentY = currentY + 12;
font.drawString("Mouse 2 - Click | scale mod", i - (font.getStringWidth("Mouse 2 - Click | scale mod", 12, FontType.TITLE) / 2), currentY, 12, SilentFontRenderer.FontType.TITLE, -1, false);
}
if(this.mod != null) {
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, "Scale");
int left = scaledresolution.getScaledWidth() / 2 - 60;
font.drawString("Scale of " + mod.getName(), left + 60 - (font.getStringWidth("Scale of " + mod.getName(), 16, FontType.HEADER) / 2), (scaledresolution.getScaledHeight() / 2) - 30, 16, SilentFontRenderer.FontType.HEADER, -1, false);
RenderUtils.drawRect(left, (scaledresolution.getScaledHeight() / 2) - 1, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(left, (scaledresolution.getScaledHeight() / 2) - 1, 90F * (float) (setting.getValFloat() / setting.getMax()), 9, -1);
boolean drag = MouseUtils.isInside(mouseX, mouseY, left, (scaledresolution.getScaledHeight() / 2) - 1, 90, 9) && Mouse.isButtonDown(0);
if (drag) {
double diff = setting.getMax() - setting.getMin();
double mouse = MathHelper.clamp_double((mouseX - left) / 90D, 0, 1);
double newVal = setting.getMin() + mouse * diff;
setting.setValDouble(newVal);
}
int textLeft = left + 100;
Client.getInstance().getSilentFontRenderer().drawString(new DecimalFormat("0.00").format(setting.getValDouble()), textLeft, scaledresolution.getScaledHeight() / 2 - 2, 12, FontType.TITLE);
}
}
else
{
this.initGui();
}
super.drawScreen(mouseX, mouseY, partialTicks);
this.zLevel = zBackup;
GlStateManager.disableAlpha();
@ -171,29 +124,7 @@ public class HUDConfigScreen extends GuiScreen {
super.actionPerformed(button);
switch(button.id) {
case 0:
if(this.tutorial) {
this.tutorial = false;
this.mod = null;
this.buttonList.get(1).displayString = "Help";
this.buttonList.get(1).visible = true;
} else if(this.mod != null) {
this.tutorial = false;
this.mod = null;
this.buttonList.get(1).visible = true;
this.buttonList.get(1).displayString = "Help";
} else {
mc.displayGuiScreen(screen);
}
break;
case 1:
if(this.mod != null) {
mc.displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new ModSettings(mod, this) : new net.silentclient.client.gui.modmenu.ModSettings(mod, this));
} else {
this.tutorial = true;
this.mod = null;
this.buttonList.get(1).visible = false;
this.buttonList.get(1).displayString = "Help";
}
mc.displayGuiScreen(screen);
break;
}
}
@ -241,17 +172,10 @@ public class HUDConfigScreen extends GuiScreen {
}
boolean hovered = ((ModDraggable) m).isHovered(mouseX, mouseY, scaledResolution);
if(hovered) {
if(mouseButton == 1) {
this.tutorial = false;
this.mod = m;
this.buttonList.get(1).visible = true;
this.buttonList.get(1).displayString = "Mod Settings";
} else if(mouseButton == 0) {
((ModDraggable) m).setDragging(true);
((ModDraggable) m).setDraggingX(((ModDraggable) m).getPos().getAbsoluteX() - mouseX);
((ModDraggable) m).setDraggingY(((ModDraggable) m).getPos().getAbsoluteY() - mouseY);
}
if(hovered && mouseButton == 0) {
((ModDraggable) m).setDragging(true);
((ModDraggable) m).setDraggingX(((ModDraggable) m).getPos().getAbsoluteX() - mouseX);
((ModDraggable) m).setDraggingY(((ModDraggable) m).getPos().getAbsoluteY() - mouseY);
break;
}
}

View File

@ -16,6 +16,7 @@ import net.silentclient.client.utils.SCTextureManager;
import net.silentclient.client.utils.TimerUtils;
import net.silentclient.client.utils.types.NewsResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URI;
@ -61,7 +62,11 @@ public class GuiNews extends SilentScreen {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if(imageLocation != null) {

View File

@ -0,0 +1,156 @@
package net.silentclient.client.gui.lite;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.DynamicTexture;
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.MouseUtils;
import net.silentclient.client.gui.silentmainmenu.components.AccountPicker;
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.utils.AccountManager;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.SCTextureManager;
import net.silentclient.client.utils.TimerUtils;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Random;
public class LiteAccountPicker extends AccountPicker {
public static HashMap<String, MinecraftAvatar> avatars = new HashMap<>();
public static boolean loading;
protected int animatedOpacity = 0;
protected TimerUtils animateTimer = new TimerUtils();
public LiteAccountPicker(int x, int y) {
super(x, y);
}
public void draw(Minecraft mc, int mouseX, int mouseY) {
IButtonTheme theme = new DefaultButtonTheme();
ColorUtils.setColor(theme.getBackgroundColor().getRGB());
RenderUtil.drawRoundedRect(x, y, 100, 18, 3, theme.getBackgroundColor().getRGB());
ColorUtils.setColor(theme.getHoveredBackgroundColor(animatedOpacity).getRGB());
RenderUtil.drawRoundedRect(x, y, 100, 18, 3, theme.getHoveredBackgroundColor(animatedOpacity ).getRGB());
ColorUtils.setColor(theme.getBorderColor().getRGB());
RenderUtil.drawRoundedOutline(x, y, 100, 18, 3, 1, theme.getBorderColor().getRGB());
if(!avatars.containsKey(Client.getInstance().getAccount().original_username)) {
avatars.put(Client.getInstance().getAccount().original_username, new MinecraftAvatar(Client.getInstance().getAccount().original_username));
}
if(!avatars.get(Client.getInstance().getAccount().original_username).initSkin) {
avatars.get(Client.getInstance().getAccount().original_username).loadSkin();
}
RenderUtil.drawImage(avatars.get(Client.getInstance().getAccount().original_username).imageLocation, x + 2, y + 2, 14, 14, false);
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/dropdown-icon.png"), x + 100 - 16, y + 2, 14, 14, false);
Client.getInstance().getSilentFontRenderer().drawString(Client.getInstance().getAccount().original_username, x + 18, y + 9 - 6, 12, SilentFontRenderer.FontType.TITLE, 70);
if(MouseUtils.isInside(mouseX, mouseY, x, y, 100, 18)) {
if (this.animatedOpacity < 75 && animateTimer.delay(30)) {
this.animatedOpacity += 15;
animateTimer.reset();
}
} else {
if (this.animatedOpacity != 0 && animateTimer.delay(30)) {
this.animatedOpacity -= 15;
animateTimer.reset();
}
}
if(this.open) {
int accountY = y + 20;
RenderUtil.drawRoundedRect(x, y + 20, 100, (Client.getInstance().getAccountManager().getAccounts().size() - 1) * 18, 3, new Color(20, 20, 20).getRGB());
for(AccountManager.AccountType account : Client.getInstance().getAccountManager().getAccounts()) {
if(Client.getInstance().getAccount().getUsername().equalsIgnoreCase(account.username)) {
continue;
}
if(!avatars.containsKey(account.username)) {
avatars.put(account.username, new MinecraftAvatar(account.username));
}
if(!avatars.get(account.username).initSkin) {
avatars.get(account.username).loadSkin();
}
if(MouseUtils.isInside(mouseX, mouseY, x, accountY, 100, 18)) {
RenderUtil.drawRoundedRect(x, accountY, 100, 18, 3, theme.getHoveredBackgroundColor(75).getRGB());
}
RenderUtil.drawImage(avatars.get(account.username).imageLocation, x + 2, accountY + 2, 14, 14, false);
Client.getInstance().getSilentFontRenderer().drawString(account.username, x + 18, accountY + 9 - 6, 12, SilentFontRenderer.FontType.TITLE, 70);
accountY += 18;
}
}
}
public void onClick(Minecraft mc, int mouseX, int mouseY) {
if(MouseUtils.isInside(mouseX, mouseY, x, y, 100, 18)) {
this.open = !this.open;
(new Thread(() -> {
Client.getInstance().getAccountManager().updateAccounts();
})).start();
return;
}
if(this.open) {
int accountY = y + 20;
int accountIndex = 0;
for(AccountManager.AccountType account : Client.getInstance().getAccountManager().getAccounts()) {
if(Client.getInstance().getAccount().getUsername().equalsIgnoreCase(account.username)) {
accountIndex += 1;
continue;
}
if(MouseUtils.isInside(mouseX, mouseY, x, accountY, 100, 18)) {
Client.getInstance().getAccountManager().setSelected(account, accountIndex, false);
break;
}
accountY += 18;
}
}
this.open = false;
}
public class MinecraftAvatar {
public ResourceLocation imageLocation = new ResourceLocation("silentclient/images/steve_head.png");
public BufferedImage image = null;
public boolean initSkin = false;
private final String username;
public MinecraftAvatar(String username) {
this.username = username;
}
public void loadSkin() {
if(image == null && !LiteAccountPicker.loading && !initSkin) {
LiteAccountPicker.loading = true;
(new Thread("McAvatarThread") {
public void run() {
Client.logger.info(String.format("Downloading avatar %s...", username));
BufferedImage avatar = SCTextureManager.getImage(String.format("https://mc-heads.net/avatar/%s/100.png", username));
if(avatar != null) {
Client.logger.info(String.format("Avatar %s successfully downloaded!", username));
image = avatar;
} else {
Client.logger.info(String.format("Avatar %s downloading failed!", username));
initSkin = true;
}
LiteAccountPicker.loading = false;
}
}).start();
}
if(image != null && !initSkin) {
Client.logger.info(String.format("Crating ResourceLocation of avatar %s...", username));
imageLocation = Minecraft.getMinecraft().getTextureManager().getDynamicTextureLocation("player_avatar_" + new Random().nextLong(), new DynamicTexture(image));
initSkin = true;
}
}
}
}

View File

@ -1,408 +1,155 @@
package net.silentclient.client.gui.lite;
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;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.demo.DemoWorldServer;
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.animation.SimpleAnimation;
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.silentmainmenu.components.AccountPicker;
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 net.silentclient.client.utils.ColorUtils;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.util.Random;
public class LiteMainMenu extends GuiScreen implements GuiYesNoCallback
public class LiteMainMenu extends GuiScreen
{
private static final Logger logger = LogManager.getLogger();
private static final Random RANDOM = new Random();
private SimpleAnimation bannerAnimation;
private AccountPicker accountPicker;
/** Counts the number of screen updates. */
private float updateCounter;
/** The splash message. */
private String splashText;
private GuiButton buttonResetDemo;
/** Timer used to rotate the panorama, increases every tick. */
/**
* Texture allocated for the current viewport of the main menu's panorama background.
*/
/**
* The Object object utilized as a thread lock when performing non thread-safe operations
*/
private final Object threadLock = new Object();
/** OpenGL graphics card warning. */
private String openGLWarning1;
/** OpenGL graphics card warning. */
private String openGLWarning2;
/** Link to the Mojang Support about minimum requirements */
private String openGLWarningLink;
private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("silentclient/logos/menu_logo.png");
/** An array of all the paths to the panorama pictures. */
public static final String field_96138_a = "Please click " + EnumChatFormatting.UNDERLINE + "here" + EnumChatFormatting.RESET + " for more information.";
private int field_92024_r;
private int field_92023_s;
private int field_92022_t;
private int field_92021_u;
private int field_92020_v;
private int field_92019_w;
private GuiButton singlePlayer;
private GuiButton multiPlayer;
private GuiButton options;
private GuiButton cosmetics;
/** Minecraft Realms button. */
private GuiButton realmsButton;
public LiteMainMenu() {
this.openGLWarning2 = field_96138_a;
this.splashText = "";
this.setUpdateCounter(RANDOM.nextFloat());
this.openGLWarning1 = "";
if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported())
{
this.openGLWarning1 = I18n.format("title.oldgl1");
this.openGLWarning2 = I18n.format("title.oldgl2");
this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/325948?ref=game";
}
}
public LiteMainMenu(boolean firstTime)
{
this.openGLWarning2 = field_96138_a;
this.splashText = "";
this.setUpdateCounter(RANDOM.nextFloat());
this.openGLWarning1 = "";
if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported())
{
this.openGLWarning1 = I18n.format("title.oldgl1");
this.openGLWarning2 = I18n.format("title.oldgl2");
this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/325948?ref=game";
}
}
/**
* Called from the main game loop to update the screen.
*/
public void updateScreen()
{
Client.backgroundPanorama.tickPanorama();
}
/**
* Returns true if this GUI should pause the game when it is displayed in single-player
*/
public boolean doesGuiPauseGame()
{
return false;
}
/**
* Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
* KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
*/
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
}
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui()
{
int j = this.height / 4 + 48;
@Override
public void initGui() {
super.initGui();
this.accountPicker = new LiteAccountPicker(this.width - 100 - 4, 5);
this.bannerAnimation = new SimpleAnimation(0);
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
this.buttonList.add(new IconButton(88, 4, 5, new ResourceLocation("silentclient/icons/news.png")));
this.buttonList.add(cosmetics = new IconButton(87, 26, 5, new ResourceLocation("silentclient/icons/settings/cosmetics.png")));
this.buttonList.add(new IconButton(991, 48, 5, new ResourceLocation("silentclient/icons/store_icon.png")));
this.buttonList.add(new IconButton(992, 70, 5, new ResourceLocation("silentclient/icons/language.png")));
this.buttonList.add(new IconButton(89, 92, 5, new ResourceLocation("silentclient/icons/back.png")));
if (this.mc.isDemo())
{
this.addDemoButtons(j, 24);
}
else
{
this.addSingleplayerMultiplayerButtons(j, 24);
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")));
int buttonY = this.height / 2 - 18;
if(buttonY - 90 > 50) {
buttonY = 120;
}
this.buttonList.add(options = new Button(0, this.width / 2 - 100, j + 52, 98, 20, "Options"));
this.buttonList.add(new Button(4, this.width / 2 + 2, j + 52, 98, 20, "Quit Game"));
this.buttonList.add(new Button(6, this.width / 2 - 90, buttonY, 180, 18, "Singleplayer"));
this.buttonList.add(new Button(7, this.width / 2 - 90, buttonY + 18 + 5, 180, 18, "Multiplayer"));
synchronized (this.threadLock)
{
this.field_92023_s = this.fontRendererObj.getStringWidth(this.openGLWarning1);
this.field_92024_r = this.fontRendererObj.getStringWidth(this.openGLWarning2);
int k = Math.max(this.field_92023_s, this.field_92024_r);
this.field_92022_t = (this.width - k) / 2;
this.field_92021_u = ((GuiButton)this.buttonList.get(0)).yPosition - 24;
this.field_92020_v = this.field_92022_t + k;
this.field_92019_w = this.field_92021_u + 24;
}
this.mc.setConnectedToRealms(false);
this.buttonList.add(new Button(8, this.width / 2 - 90, buttonY + 18 + 5 + 18 + 5, 87, 18, "Options"));
this.buttonList.add(new Button(9, this.width / 2 + 2, buttonY + 18 + 5 + 18 + 5, 88, 18, "Quit Game"));
}
/**
* Adds Singleplayer and Multiplayer buttons on Main Menu for players who have bought the game.
*/
private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_)
{
this.buttonList.add(singlePlayer = new Button(1, this.width / 2 - 100, p_73969_1_, "Singleplayer"));
this.buttonList.add(multiPlayer = new Button(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, "Multiplayer"));
}
/**
* Adds Demo buttons on Main Menu for players who are playing Demo.
*/
private void addDemoButtons(int p_73972_1_, int p_73972_2_)
{
this.buttonList.add(new Button(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0])));
this.buttonList.add(this.buttonResetDemo = new Button(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0])));
ISaveFormat isaveformat = this.mc.getSaveLoader();
WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
if (worldinfo == null)
{
this.buttonResetDemo.enabled = false;
}
}
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button) throws IOException
{
if(button.id == 991) {
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();
}
return;
}
if(button.id == 992) {
mc.displayGuiScreen(new GuiLanguage(this, new GameSettings(), mc.getLanguageManager()));
return;
}
if (button.id == 0)
{
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
}
if (button.id == 5)
{
this.mc.displayGuiScreen(new GuiLanguage(this, this.mc.gameSettings, this.mc.getLanguageManager()));
}
if (button.id == 1)
{
this.mc.displayGuiScreen(new GuiSelectWorld(this));
}
if (button.id == 2)
{
this.mc.displayGuiScreen(new GuiMultiplayer(this));
}
if(button.id == 89) {
Client.getInstance().getGlobalSettings().setLite(false);
Client.getInstance().getGlobalSettings().save();
mc.displayGuiScreen(new MainMenuConcept());
}
if (button.id == 14 && this.realmsButton.visible)
{
this.switchToRealms();
}
if (button.id == 4)
{
this.mc.shutdown();
}
if (button.id == 11)
{
this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
}
if (button.id == 12)
{
ISaveFormat isaveformat = this.mc.getSaveLoader();
WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
if (worldinfo != null)
{
GuiYesNo guiyesno = GuiSelectWorld.makeDeleteWorldYesNo(this, worldinfo.getWorldName(), 12);
this.mc.displayGuiScreen(guiyesno);
}
}
if(button.id == 87) {
this.mc.displayGuiScreen(new CosmeticsGui());
}
if(button.id == 88) {
this.mc.displayGuiScreen(new GuiNews());
}
}
private void switchToRealms()
{
RealmsBridge realmsbridge = new RealmsBridge();
realmsbridge.switchToRealms(this);
}
public void confirmClicked(boolean result, int id)
{
if (result && id == 12)
{
ISaveFormat isaveformat = this.mc.getSaveLoader();
isaveformat.flushCache();
isaveformat.deleteWorldDirectory("Demo_World");
this.mc.displayGuiScreen(this);
}
else if (id == 13)
{
if (result)
{
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(this.openGLWarningLink)});
}
catch (Throwable throwable)
{
logger.error("Couldn\'t open link", throwable);
}
}
this.mc.displayGuiScreen(this);
}
}
/**
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
*/
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
Tessellator tessellator = Tessellator.getInstance();
tessellator.getWorldRenderer();
int i = 274;
int j = this.width / 2 - i / 2;
int k = 30;
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
GuiNews.loadPanel();
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
singlePlayer.visible = true;
multiPlayer.visible = true;
options.visible = true;
cosmetics.visible = true;
RenderUtil.drawImage(minecraftTitleTextures, j + 30, k - 25, 220, 95);
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/menu_logo.png"), this.width / 2 - 80, 20, 160, 70);
ColorUtils.setColor(new Color(115, 117, 119).getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString("The most complete all-in-one mod library for Minecraft", this.width / 2, 87, 10, SilentFontRenderer.FontType.TITLE);
GlStateManager.pushMatrix();
GlStateManager.translate((float)(this.width / 2 + 90), 70.0F, 0.0F);
GlStateManager.rotate(-20.0F, 0.0F, 0.0F, 1.0F);
float f = 1.8F - MathHelper.abs(MathHelper.sin((float)(Minecraft.getSystemTime() % 1000L) / 1000.0F * (float)Math.PI * 2.0F) * 0.1F);
f = f * 100.0F / (float)(this.fontRendererObj.getStringWidth(this.splashText) + 32);
GlStateManager.scale(f, f, f);
GlStateManager.popMatrix();
String s = "SC Lite 1.8.9";
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(3, height - 14, "SLC Lite 1.8.9", 12, SilentFontRenderer.FontType.TITLE);
if (this.mc.isDemo())
{
s = s + " Demo";
if(GuiNews.imageLocation != null) {
if(MouseUtils.isInside(mouseX, mouseY, this.width - 74, this.height - 42, 71, 40)) {
this.bannerAnimation.setAnimation(4, 20);
} else {
this.bannerAnimation.setAnimation(0, 30);
}
RenderUtil.drawImage(GuiNews.imageLocation, this.width - 74 + (-this.bannerAnimation.getValue()), this.height - 42 + (-this.bannerAnimation.getValue()), 71, 40, false);
}
Client.getInstance().getSilentFontRenderer().drawString(s, 2, this.height - 14, 14, SilentFontRenderer.FontType.TITLE);
if(GuiNews.imageLocation != null) {
RenderUtil.drawImage(new ResourceLocation(Client.getInstance().getAccount().discord_id != null ? GuiNews.imageLocation.getResourcePath() : "silentclient/images/discord.png"), this.width - 73, this.height - 42, 71, 40, false);
}
if (this.openGLWarning1 != null && this.openGLWarning1.length() > 0)
{
drawRect(this.field_92022_t - 2, this.field_92021_u - 2, this.field_92020_v + 2, this.field_92019_w - 1, 1428160512);
this.drawString(this.fontRendererObj, this.openGLWarning1, this.field_92022_t, this.field_92021_u, -1);
this.drawString(this.fontRendererObj, this.openGLWarning2, (this.width - this.field_92024_r) / 2, ((GuiButton)this.buttonList.get(0)).yPosition - 12, -1);
}
accountPicker.draw(mc, mouseX, mouseY);
super.drawScreen(mouseX, mouseY, partialTicks);
}
/**
* Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
*/
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
{
super.mouseClicked(mouseX, mouseY, mouseButton);
if(MouseUtils.isInside(mouseX, mouseY, this.width - 73, this.height - 42, 71, 40) && GuiNews.news != null) {
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(Client.getInstance().getAccount().discord_id != null ? "https://silentclient.net/news/" + + GuiNews.news.getItem().id : "https://silentclient.net/news/4")});
} catch (Throwable err) {
err.printStackTrace();
}
}
synchronized (this.threadLock)
{
if (this.openGLWarning1.length() > 0 && mouseX >= this.field_92022_t && mouseX <= this.field_92020_v && mouseY >= this.field_92021_u && mouseY <= this.field_92019_w)
{
GuiConfirmOpenLink guiconfirmopenlink = new GuiConfirmOpenLink(this, this.openGLWarningLink, 13, true);
guiconfirmopenlink.disableSecurityWarning();
this.mc.displayGuiScreen(guiconfirmopenlink);
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
switch (button.id) {
case 1:
mc.displayGuiScreen(new GuiNews());
break;
case 2:
mc.displayGuiScreen(new CosmeticsGui());
break;
case 3:
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 4:
mc.displayGuiScreen(new GuiLanguage(this, mc.gameSettings, mc.getLanguageManager()));
break;
case 5:
Client.getInstance().getGlobalSettings().setLite(false);
Client.getInstance().getGlobalSettings().save();
mc.displayGuiScreen(new MainMenuConcept());
break;
case 6:
mc.displayGuiScreen(new GuiSelectWorld(this));
break;
case 7:
mc.displayGuiScreen(new GuiMultiplayer(this));
break;
case 8:
mc.displayGuiScreen(new GuiOptions( this, mc.gameSettings));
break;
case 9:
mc.shutdown();
break;
}
}
public float getUpdateCounter() {
return updateCounter;
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
if(MouseUtils.isInside(mouseX, mouseY, this.width - 74, this.height - 42, 71, 40)) {
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();
}
}
public void setUpdateCounter(float updateCounter) {
this.updateCounter = updateCounter;
}
accountPicker.onClick(mc, mouseX, mouseY);
}
@Override
public void updateScreen() {
super.updateScreen();
Client.backgroundPanorama.tickPanorama();
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}

View File

@ -124,7 +124,7 @@ public class ClickGUI extends SilentScreen {
if(selectedCategory != ModCategory.PLUS && selectedCategory != ModCategory.CONFIGS) {
for(Mod m : getMods()) {
if(mouseInContent(x, (int) (modOffsetY - scrollAnimation.getValue()), y + 25, height - 25) || mouseInContent(x, (int) (modOffsetY - scrollAnimation.getValue() + 70), y + 25, height - 25)) {
if(mouseInContent(x, (int) (y + modOffsetY - scrollAnimation.getValue()), y + 25, height - 25) || mouseInContent(x, (int) (y + modOffsetY - scrollAnimation.getValue() + 70), y + 25, height - 25)) {
float switchX = modOffsetX + ((65 / 2) - (15 / 2));
float switchY = y + modOffsetY - scrollAnimation.getValue() + 55;
boolean switchHovered = selectedCategory.equals(ModCategory.MODS) && Switch.isHovered(mouseX, mouseY, switchX, switchY) && !headerHovered;

View File

@ -1,6 +1,5 @@
package net.silentclient.client.gui.minecraft;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.achievement.GuiAchievements;
import net.minecraft.client.gui.achievement.GuiStats;
@ -21,7 +20,6 @@ import net.silentclient.client.gui.hud.Watermark;
import net.silentclient.client.gui.lite.clickgui.ClickGUI;
import net.silentclient.client.gui.modmenu.ModMenu;
import net.silentclient.client.mods.ModCategory;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.MenuBlurUtils;
import java.io.IOException;
@ -34,7 +32,7 @@ public class GuiIngameMenu extends GuiScreen
*/
public void initGui()
{
MenuBlurUtils.loadBlur();
// MenuBlurUtils.loadBlur();
this.buttonList.clear();
int i = -16;
this.buttonList.add(new Button(1, this.width / 2 - 100, this.height / 4 + 120 + i, "Save and Quit to Title", true));
@ -167,9 +165,9 @@ public class GuiIngameMenu extends GuiScreen
@Override
public void onGuiClosed() {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean()) {
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
}
// if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean()) {
// Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
// }
super.onGuiClosed();
}
}

View File

@ -117,7 +117,7 @@ public class ModSettings extends SilentScreen {
if(RegularSlider.isDrag(mouseX, mouseY, 3, settingY, 144) && (System.currentTimeMillis() - initTime) > 500) {
double diff = setting.getMax() - setting.getMin();
double mouse = MathHelper.clamp_double((mouseX - 3) / 90D, 0, 1);
double mouse = MathHelper.clamp_double((mouseX - 3) / 144D, 0, 1);
double newVal = setting.getMin() + mouse * diff;
if(newVal != setting.getValDouble()) {
setting.setValDouble(newVal);

View File

@ -3,7 +3,6 @@ package net.silentclient.client.gui.modmenu;
import net.silentclient.client.Client;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.util.RenderUtil;
import org.lwjgl.input.Mouse;
@ -14,16 +13,16 @@ public class RegularSlider {
public static void render(float x, float y, int width, String name, double max, double value) {
Client.getInstance().getSilentFontRenderer().drawString(name, x, y, 12, SilentFontRenderer.FontType.TITLE);
RenderUtil.drawRoundedRect(x, y + 15, 100, 9, 3, Color.black.getRGB());
RenderUtil.drawRoundedRect(x, y + 15, 144, 9, 3, Color.black.getRGB());
if(value != 0) {
RenderUtil.drawRoundedRect(x, y + 15, 100F * (float) (value / max), 9, 3, -1);
RenderUtil.drawRoundedRect(x, y + 15, 144F * (float) (value / max), 9, 3, -1);
}
float textLeft = x + width - Client.getInstance().getSilentFontRenderer().getStringWidth(new DecimalFormat("0.00").format(value), 12, SilentFontRenderer.FontType.TITLE);
Client.getInstance().getSilentFontRenderer().drawString(new DecimalFormat("0.00").format(value), textLeft, y + 14, 12, SilentFontRenderer.FontType.TITLE);
Client.getInstance().getSilentFontRenderer().drawString(new DecimalFormat("0.00").format(value), textLeft, y, 12, SilentFontRenderer.FontType.TITLE);
}
public static boolean isDrag(int mouseX, int mouseY, float x, float y, int width) {
return MouseUtils.isInside(mouseX, mouseY, x, y + 15, 100, 9) && Mouse.isButtonDown(0);
return MouseUtils.isInside(mouseX, mouseY, x, y + 15, 144, 9) && Mouse.isButtonDown(0);
}
}

View File

@ -82,7 +82,7 @@ public class MainMenuConcept extends SilentScreen {
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());
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
if(imageLocation != null) {
RenderUtil.drawImage(imageLocation, width - 120, height / 2 - (75), 62, 150, false);
@ -163,11 +163,16 @@ public class MainMenuConcept extends SilentScreen {
// Functions
private void loadSkin() {
if(image == null && !loading) {
if(image == null && !loading && !initSkin) {
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()));
BufferedImage skin = SCTextureManager.getImage(String.format("https://mc-heads.net/body/%s/left/1000.png", Client.getInstance().getAccount().getUsername()));
if(skin != null) {
MainMenuConcept.image = skin;
} else {
MainMenuConcept.initSkin = true;
}
MainMenuConcept.loading = false;
}
}).start();

View File

@ -10,9 +10,9 @@ import net.silentclient.client.utils.ColorUtils;
import java.awt.*;
public class AccountPicker {
private boolean open;
private final int x;
private final int y;
protected boolean open;
protected final int x;
protected final int y;
public AccountPicker(int x, int y) {
this.x = x;

View File

@ -0,0 +1,89 @@
package net.silentclient.client.gui.util;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.client.shader.ShaderGroup;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Timer;
import net.silentclient.client.Client;
import net.silentclient.client.mixin.SilentClientTweaker;
import net.silentclient.client.mixin.ducks.MinecraftExt;
import net.silentclient.client.mods.util.IMixinShaderGroup;
import org.lwjgl.opengl.GL11;
public class BlurUtil {
private static int lastScale;
private static int lastScaleWidth;
private static int lastScaleHeight;
private static Framebuffer buffer;
private static ShaderGroup blurShader;
private static final ResourceLocation shader = new ResourceLocation("shaders/post/menu_blur.json");
public static void initFboAndShader() {
Minecraft mc = Minecraft.getMinecraft();
try {
blurShader = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(), shader);
blurShader.createBindFramebuffers(mc.displayWidth, mc.displayHeight);
buffer = (Framebuffer) ((IMixinShaderGroup) blurShader).getMainFramebuffer();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void crop(float x, float y, float x2, float y2) {
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution scaledResolution = new ScaledResolution(mc);
int factor = scaledResolution.getScaleFactor();
GL11.glScissor((int)(x * factor), (int)((scaledResolution.getScaledHeight() - y2) * factor), (int)((x2 - x) * factor), (int)((y2 - y) * factor));
}
public static void blur(float x, float y, float x2, float y2, ScaledResolution sr){
try {
if(SilentClientTweaker.hasOptifine && GameSettings.class.getDeclaredField("ofFastRender").getBoolean("ofFastRender")) {
return;
}
} catch (Exception err) {
Client.logger.catching(err);
}
Minecraft mc = Minecraft.getMinecraft();
int factor = sr.getScaleFactor();
int factor2 = sr.getScaledWidth();
int factor3 = sr.getScaledHeight();
if (lastScale != factor || lastScaleWidth != factor2 || lastScaleHeight != factor3 || buffer == null || blurShader == null)
initFboAndShader();
lastScale = factor;
lastScaleWidth = factor2;
lastScaleHeight = factor3;
GL11.glEnable(3089);
crop(x, y, x2, y2);
buffer.framebufferHeight = mc.displayHeight;
buffer.framebufferWidth = mc.displayWidth;
GlStateManager.resetColor();
blurShader.loadShaderGroup(((Timer) ((MinecraftExt) mc).getTimer()).renderPartialTicks);
buffer.bindFramebuffer(true);
mc.getFramebuffer().bindFramebuffer(true);
GL11.glDisable(3089);
}
public static void blur(float x, float y, float x2, float y2) {
Minecraft mc = Minecraft.getMinecraft();
GlStateManager.disableAlpha();
blur(x, y, x2, y2, new ScaledResolution(mc));
GlStateManager.enableAlpha();
}
public static void blur2(float x, float y, float x2, float y2, float h, float w) {
Minecraft mc = Minecraft.getMinecraft();
GlStateManager.disableAlpha();
blur(x, y, x2 + w, y2 + h, new ScaledResolution(mc));
GlStateManager.enableAlpha();
}
}

View File

@ -2,4 +2,5 @@ package net.silentclient.client.mixin.ducks;
public interface MinecraftExt {
void setSession(Object session);
Object getTimer();
}

View File

@ -16,6 +16,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Session;
import net.minecraft.util.Timer;
import net.minecraft.world.WorldSettings;
import net.silentclient.client.Client;
import net.silentclient.client.event.impl.*;
@ -128,6 +129,8 @@ public abstract class MinecraftMixin implements MinecraftExt {
@Mutable
@Shadow @Final private Session session;
@Shadow private Timer timer;
@Inject(method = "displayGuiScreen", at = @At("RETURN"), cancellable = true)
public void displayGuiScreenInject(GuiScreen guiScreenIn, CallbackInfo ci) {
if(Client.backgroundPanorama == null) {
@ -317,4 +320,9 @@ public abstract class MinecraftMixin implements MinecraftExt {
return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate;
}
@Override
public Object getTimer() {
return this.timer;
}
}

View File

@ -1,16 +1,25 @@
package net.silentclient.client.mixin.mixins;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.client.shader.Shader;
import net.minecraft.client.shader.ShaderGroup;
import net.silentclient.client.mods.util.IMixinShaderGroup;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.List;
@Mixin(ShaderGroup.class)
public abstract class ShaderGroupMixin implements IMixinShaderGroup {
@Shadow private Framebuffer mainFramebuffer;
@Override
@Accessor
public abstract List<Shader> getListShaders();
@Override
public Object getMainFramebuffer() {
return this.mainFramebuffer;
}
}

View File

@ -1,9 +1,10 @@
package net.silentclient.client.mods.util;
import java.util.List;
import net.minecraft.client.shader.Shader;
import java.util.List;
public interface IMixinShaderGroup {
List<Shader> getListShaders();
Object getMainFramebuffer();
}

View File

@ -14,6 +14,7 @@ import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.types.PremiumCosmeticsResponse;
import java.awt.*;
import java.io.IOException;
import java.time.LocalDate;
@ -35,7 +36,11 @@ public class PremiumCosmeticsGui extends GuiScreen {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
if(Client.getInstance().getGlobalSettings().isLite()) {
this.drawGradientRect(0, 0, this.width, this.height, new Color(0, 0, 0, 127).getRGB(), new Color(0, 0, 0, 200).getRGB());
} else {
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
}
ScaledResolution scaledResolution = new ScaledResolution(mc);
super.drawScreen(mouseX, mouseY, partialTicks);
String month = "";

View File

@ -1,11 +1,9 @@
package net.silentclient.client.utils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.StaticResourceLocation;
import net.silentclient.client.gui.util.BlurUtil;
import net.silentclient.client.mixin.accessors.GuiAccessor;
import net.silentclient.client.mixin.ducks.EntityRendererExt;
import net.silentclient.client.mods.settings.GeneralMod;
import java.awt.*;
@ -16,13 +14,14 @@ public class MenuBlurUtils {
}
public static void loadBlur(boolean force) {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean() || force) {
((EntityRendererExt) Minecraft.getMinecraft().entityRenderer).silent$loadShader(new StaticResourceLocation("shaders/post/menu_blur.json"));
}
// if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean() || force) {
// ((EntityRendererExt) Minecraft.getMinecraft().entityRenderer).silent$loadShader(new StaticResourceLocation("shaders/post/menu_blur.json"));
// }
}
public static void renderBackground(GuiScreen instance) {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean() && !Client.getInstance().getGlobalSettings().isLite()) {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean()) {
BlurUtil.blur2(0, 0, 1920, 1080, 0, 0);
((GuiAccessor) instance).silent$drawGradientRect(0, 0, instance.width, instance.height, new Color(0, 0, 0, 0).getRGB(), new Color(0, 0, 0, 0).getRGB());
} else {
instance.drawDefaultBackground();
@ -34,8 +33,8 @@ public class MenuBlurUtils {
}
public static void unloadBlur(boolean force) {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean() || force) {
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
}
// if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean() || force) {
// Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
// }
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 972 B