porting 0.0.1

This commit is contained in:
kirillsaint 2023-06-28 06:55:24 +06:00
parent 2834f0f846
commit ba5459892d
711 changed files with 64225 additions and 84 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ build/
!**/src/main/**/build/
!**/src/test/**/build/
run/
build/
### IntelliJ IDEA ###
.idea/modules.xml

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="MixinSuperClass" enabled="false" level="ERROR" enabled_by_default="false" />
</profile>
</component>

BIN
libs/OcclusionCulling.jar Normal file

Binary file not shown.

BIN
libs/annotations-13.0.jar Normal file

Binary file not shown.

BIN
libs/caffeine-2.9.3.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
libs/discord-rpc.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
libs/hypixel.jar Normal file

Binary file not shown.

BIN
libs/json.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
libs/okhttp-3.12.12.jar Normal file

Binary file not shown.

BIN
libs/okio-1.15.0.jar Normal file

Binary file not shown.

BIN
libs/procbridge-1.1.1.jar Normal file

Binary file not shown.

BIN
libs/slick.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
libs/vecmath-1.2-1.14.jar Normal file

Binary file not shown.

View File

@ -1 +1 @@
Mixin Implementation Report generated on 2023-06-27 21:53:29
Mixin Implementation Report generated on 2023-06-28 06:37:29

View File

@ -38,7 +38,7 @@ chatHeightFocused:1.0
chatHeightUnfocused:0.44366196
chatScale:1.0
chatWidth:1.0
showInventoryAchievementHint:true
showInventoryAchievementHint:false
mipmapLevels:4
streamBytesPerPixel:0.5
streamMicVolume:1.0

Binary file not shown.

View File

@ -1 +1 @@
[{"name":"Player819","uuid":"00bb7f76-47ca-3891-96fe-03177d2fac78","expiresOn":"2023-07-27 21:22:54 +0600"}]
[{"name":"Silent_Client","uuid":"84978c12-5af5-3c73-850c-f5f3b6be3bc0","expiresOn":"2023-07-28 06:37:39 +0600"},{"name":"Player819","uuid":"00bb7f76-47ca-3891-96fe-03177d2fac78","expiresOn":"2023-07-27 21:22:54 +0600"},{"name":"Player908","uuid":"e829ed1f-99f6-33f2-bcae-9d57265884eb","expiresOn":"2023-07-27 22:00:14 +0600"}]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -3,19 +3,35 @@ package net.silentclient.client;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.config.ConfigManager;
import net.silentclient.client.cosmetics.Cosmetics;
import net.silentclient.client.event.EventManager;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.ClientTickEvent;
import net.silentclient.client.types.BuildData;
import net.silentclient.client.gui.GuiError;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.BackgroundPanorama;
import net.silentclient.client.mods.ModInstances;
import net.silentclient.client.mods.SettingsManager;
import net.silentclient.client.mods.util.PingSource;
import net.silentclient.client.premium.PremiumCosmeticsGui;
import net.silentclient.client.premium.PremiumUtils;
import net.silentclient.client.utils.*;
import net.silentclient.client.utils.culling.EntityCulling;
import net.silentclient.client.utils.types.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GLContext;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.lang.management.GarbageCollectorMXBean;
import java.lang.management.ManagementFactory;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
public class Client {
@ -27,9 +43,31 @@ public class Client {
return INSTANCE;
}
public File dir;
private BuildData buildData = new BuildData();
private UserData userData = new UserData();
public File dir;
private SettingsManager settingsManager;
public ConfigManager configManager;
private ModInstances modInstances;
private Gson gson;
private ScreenshotManager screenshotManager;
private Cosmetics cosmetics = new Cosmetics();
private PlayerResponse.Account account;
private SCTextureManager textureManager;
private SilentFontRenderer silentFontRenderer;
private long lastMemoryDebug = System.currentTimeMillis();
public int ping;
private static final int PING_INTERVAL = 600;
private int nextPing;
private PingSource source = PingSource.AUTO;
private boolean banerror = false;
private ResourceLocation bindingTexture = new ResourceLocation("silentclient/binding.png");
private ArrayList<ServerDataFeature> featuredServers = new ArrayList<ServerDataFeature>();
private FriendsResponse friends;
public int playersCount = 0;
private CPSTracker cpsTracker;
private SilentSocket silentSocket;
public static BackgroundPanorama backgroundPanorama;
public static void memoryDebug(String paramString) {
LogManager.getLogger().info("-- Start Memory Debug -- " + paramString);
@ -59,6 +97,22 @@ public class Client {
} catch (Exception e1) {
Client.logger.catching(e1);
}
try {
InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "silent_account.json"));
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuffer content = new StringBuffer();
String inputLine;
while ((inputLine = reader.readLine()) != null) {
content.append(inputLine);
}
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
userData = gson.fromJson(content.toString(), UserData.class);
in.close();
} catch (Exception err) {
Client.logger.catching(err);
}
logger.info("---------[ Silent Client Initialising ]---------");
logger.info("MC Version: 1.8.9");
logger.info("SC Version: " + getVersion());
@ -73,6 +127,9 @@ public class Client {
}
logger.info("-------------------------------------------------");
memoryDebug("CLIENT_PRE_INIT");
logger.info("INITIALISING > gson-builder");
this.gson = (new GsonBuilder()).registerTypeAdapterFactory(new EnumAdapterFactory()).setPrettyPrinting()
.enableComplexMapKeySerialization().create();
logger.info("INITIALISING > silent-directory");
dir = new File(Minecraft.getMinecraft().mcDataDir, "SilentClient");
if (!dir.exists()) {
@ -80,12 +137,107 @@ public class Client {
}
logger.info("INITIALISING > event-manager");
EventManager.register(this);
logger.info("INITIALISING > silent-socket");
try {
silentSocket = new SilentSocket("https://socket.silentclient.net");
} catch (URISyntaxException e) {
Client.logger.catching(e);
}
silentSocket.Connect(Client.getInstance().getUserData().getAccessToken());
memoryDebug("CLIENT_POST_INIT");
}
public void start() throws Throwable {
memoryDebug("CLIENT_PRE_START");
logger.info("---------[ Silent Client Starting ]--------------");
try {
logger.info("STARTING > sc-account");
PlayerResponse acc = updateAccount();
if(acc != null) {
Client.getInstance().setAccount(acc.getAccount());
}
if(OSUtil.isWindows()) {
logger.info("STARTING > raw-mouse-input");
Minecraft.getMinecraft().mouseHelper = new RawMouseHelper();
RawInputHandler.init();
}
logger.info("STARTING > settings-manager");
settingsManager = new SettingsManager();
logger.info("STARTING > mod-instances");
modInstances = new ModInstances();
logger.info("STARTING > config-manager");
configManager = new ConfigManager();
logger.info("STARTING > texture-manager");
this.textureManager = new SCTextureManager(Minecraft.getMinecraft().getResourceManager());
logger.info("STARTING > font-renderer");
this.silentFontRenderer = new SilentFontRenderer();
logger.info("STARTING > cps-tracker");
this.cpsTracker = new CPSTracker();
EventManager.register(cpsTracker);
logger.info("STARTING > cosmetics");
cosmetics.init();
logger.info("STARTING > entity-culling");
EventManager.register(new EntityCulling());
EntityCulling.SUPPORT_NEW_GL = GLContext.getCapabilities().OpenGL33;
EntityCulling.renderManager = Minecraft.getMinecraft().getRenderManager();
logger.info("STARTING > screenshot-manager");
EventManager.register(this.screenshotManager = new ScreenshotManager());
logger.info("STARTING > binding-textures");
Minecraft.getMinecraft().getTextureManager().bindTexture(this.getBindingTexture());
modInstances.getMods().forEach((mod) -> {
if(mod.getIcon() != null) {
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(mod.getIcon()));
}
});
logger.info("STARTING > friends");
FeaturedServersResponse servers = FeaturedServers.get();
featuredServers.clear();
if(servers != null && servers.getServers() != null) {
servers.getServers().forEach(server -> {
featuredServers.add(new ServerDataFeature(server.getName(), server.getIp()));
});
}
this.updateFriendsList();
if(Client.getInstance().getAccount() == null) {
logger.info("STARTING > ERROR: " + "Authorization Error. Try restarting the game.");
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Authorization Error. Try restarting the game"));
return;
}
if(!Client.getInstance().getAccount().getUsername().equals(Minecraft.getMinecraft().getSession().getUsername().toLowerCase())) {
logger.info("STARTING > ERROR: " + "Usernames SC and MC account do not match");
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Usernames SC and MC account do not match"));
return;
}
if(Client.getInstance().getAccount().isBanned()) {
logger.info("STARTING > ERROR: " + "Account is banned");
Minecraft.getMinecraft().displayGuiScreen(new GuiError("Your account is banned"));
return;
}
Client.logger.info("STARTING > mod-instances-post-init");
modInstances.postInit();
Client.logger.info("STARTING > fixing-mods");
modInstances.getMods().forEach((mod) -> {
mod.setEnabled(!mod.isEnabled());
mod.setEnabled(!mod.isEnabled());
});
if(!Client.getInstance().getAccount().getClaimedPremiumCosmetics()) {
Client.logger.info("STARTING > premium-cosmetics");
PremiumCosmeticsResponse premiumCosmetics = PremiumUtils.getPremiumCosmetics();
if(premiumCosmetics != null) {
Minecraft.getMinecraft().displayGuiScreen(new PremiumCosmeticsGui(premiumCosmetics));
}
}
} catch(Exception err) {
logger.info("STARTING > ERROR: " + err.getMessage());
throw err;
}
logger.info("-------------------------------------------------");
memoryDebug("CLIENT_POST_INIT");
}
@ -95,6 +247,82 @@ public class Client {
logger.info("-------------------------------------------------");
}
// utils
public void updateUserInformation() {
silentSocket.getSocket().emit("refresh", Minecraft.getMinecraft().getSession().getUsername().toLowerCase());
}
public void updateFriendsList() {
if(Client.getInstance().getAccount() != null) {
(new Thread("updateFriendsList") {
public void run() {
FriendsResponse friends = getFriendsAPI();
if(friends != null) {
Client.getInstance().setFriends(friends);
}
}
}).start();
}
}
private FriendsResponse getFriendsAPI() {
try {
URL url = new URL("https://api.silentclient.net/friends");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", "SilentClient");
con.setRequestProperty("Authorization", "Bearer " + Client.getInstance().getUserData().getAccessToken());
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
Client.logger.info("Loaded friends: " + content.toString());
in.close();
con.disconnect();
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
FriendsResponse response = gson.fromJson(content.toString(), FriendsResponse.class);
return response;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
private PlayerResponse updateAccount() {
try {
URL url = new URL("https://api.silentclient.net/account");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", "SilentClient");
con.setRequestProperty("Authorization", "Bearer " + Client.getInstance().getUserData().getAccessToken());
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
Client.logger.info("Loaded user information: " + content.toString());
in.close();
con.disconnect();
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
PlayerResponse response = gson.fromJson(content.toString(), PlayerResponse.class);
return response;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
// Events
@EventTarget
public void onTick(ClientTickEvent event) {
@ -103,6 +331,19 @@ public class Client {
// Instances
public FriendsResponse getFriends() {
return friends;
}
public void setFriends(FriendsResponse friends) {
this.friends = friends;
}
public UserData getUserData() {
return userData;
}
public BuildData getBuildData() {
return buildData;
}
@ -110,4 +351,80 @@ public class Client {
public String getVersion() {
return "v" + version + "-" + getBuildData().getCommit() + "-" + getBuildData().getBranch();
}
public SilentSocket getSilentSocket() {
return silentSocket;
}
public Cosmetics getCosmetics() {
return cosmetics;
}
public PlayerResponse.Account getAccount() {
return account;
}
public void setAccount(PlayerResponse.Account account) {
this.account = account;
}
public ResourceLocation getBindingTexture() {
return bindingTexture;
}
public Gson getGson() {
return gson;
}
public SCTextureManager getTextureManager() {
return textureManager;
}
public SilentFontRenderer getSilentFontRenderer() {
return silentFontRenderer;
}
public SettingsManager getSettingsManager() {
return settingsManager;
}
public ModInstances getModInstances() {
return modInstances;
}
public ConfigManager getConfigManager() {
return configManager;
}
public CPSTracker getCPSTracker() {
return cpsTracker;
}
public int getPing() {
return ping;
}
public ArrayList<ServerDataFeature> getFeaturedServers() {
return featuredServers;
}
public int getPlayersCount() {
return playersCount;
}
public ScreenshotManager getScreenshotManager() {
return screenshotManager;
}
public boolean isTest() {
return getBuildData().getBranch().equals("test");
}
public boolean isDebug() {
return getBuildData().getBranch().equals("debug");
}
public int getScaleFactor() {
return (new ScaledResolution(Minecraft.getMinecraft())).getScaleFactor();
}
}

View File

@ -0,0 +1,11 @@
package net.silentclient.client;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.util.ResourceLocation;
public class ServerDataFeature extends ServerData {
public static final ResourceLocation STAR_ICON = new ResourceLocation("silentclient/icons/star.png");
public ServerDataFeature(String serverName, String serverIp) {
super(serverName, serverIp, false);
}
}

View File

@ -0,0 +1,450 @@
package net.silentclient.client.admin;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.text.DecimalFormat;
import net.silentclient.client.utils.CustomAbstractClientPlayer;
import org.lwjgl.Sys;
import org.lwjgl.input.Mouse;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.AnimatedResourceLocation;
import net.silentclient.client.cosmetics.ShieldData;
import net.silentclient.client.cosmetics.gui.CosmeticsGui;
import net.silentclient.client.gui.clickgui.utils.GlUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.StaticButton;
import net.silentclient.client.mods.CustomFontRenderer;
import net.silentclient.client.mods.CustomFontRenderer.RenderMode;
import net.silentclient.client.utils.FileUtils;
import net.silentclient.client.utils.Players;
public class AdminRender extends GuiScreen {
public static File adminRenderPath = new File(Client.getInstance().dir, "admin-render");
// Settings
private boolean showSettings = false;
private static boolean savingPreview = false;
private float scale = 1.0F;
private int rotate = 0;
private int redBackground = 0;
private int greenBackground = 0;
private int blueBackground = 0;
// Information
private int frames = 1;
private int currentFrame = 0;
public AdminRender() {
if(Client.getInstance().getAccount().isStaff()) {
if(!adminRenderPath.exists()) {
adminRenderPath.mkdirs();
}
}
}
@Override
public void initGui() {
super.initGui();
this.showSettings = false;
AdminRender.savingPreview = false;
this.scale = 1.0F;
this.redBackground = 0;
this.greenBackground = 0;
this.blueBackground = 0;
this.rotate = 0;
loadTextureCosmetic("none");
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawScreen(mouseX, mouseY, partialTicks);
super.drawDefaultBackground();
CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).setCapeShoulders(true);
CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).setCapeType("Rectangle");
if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getLocationSilentCape() != null) {
CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getLocationSilentCape().setCurrentFrame(this.currentFrame);
}
if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getBandana() != null) {
CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getBandana().setCurrentFrame(this.currentFrame);
}
if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getShield() != null && CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getShield().getTexture() != null) {
CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getShield().getTexture().setCurrentFrame(this.currentFrame);
}
CustomFontRenderer font = new CustomFontRenderer();
font.setRenderMode(RenderMode.CUSTOM);
ScaledResolution sr = new ScaledResolution(mc);
RenderUtils.drawRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(), new Color(redBackground, greenBackground, blueBackground).getRGB());
if(!AdminRender.savingPreview) {
StaticButton.render(2, 2, 50, 12, this.showSettings ? "Close" : "Settings");
if(this.showSettings) {
int settingY = 20;
int sliderLeft = 50;
// Scale
font.drawString("Scale:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (scale / 5.0D), 9, -1);
boolean scaleDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (scaleDrag) {
double diff = 5.0D - 1.0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 1.0F + mouse * diff;
this.scale = (float) newVal;
}
font.drawString(new DecimalFormat("0.00").format(scale), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Rotate
font.drawString("Rotate:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (rotate / 360.0D), 9, -1);
boolean rotateDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (rotateDrag) {
double diff = 360D - 0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
this.rotate = (int) newVal;
}
font.drawString(new DecimalFormat("0.00").format(rotate), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Background Red
font.drawString("BG Red:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (redBackground / 255.0D), 9, -1);
boolean bgRedDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (bgRedDrag) {
double diff = 255D - 0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
this.redBackground = (int) newVal;
}
font.drawString(new DecimalFormat("0.00").format(redBackground), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Background Green
font.drawString("BG Green:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (greenBackground / 255.0D), 9, -1);
boolean bgGreenDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (bgGreenDrag) {
double diff = 255D - 0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
this.greenBackground = (int) newVal;
}
font.drawString(new DecimalFormat("0.00").format(greenBackground), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Background Blue
font.drawString("BG Blue:", 2, settingY, -1, true);
RenderUtils.drawRect(sliderLeft, settingY, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(sliderLeft, settingY, 90F * (float) (blueBackground / 255.0D), 9, -1);
boolean bgBlueDrag = MouseUtils.isInside(mouseX, mouseY, sliderLeft, settingY - 1, 90, 9) && Mouse.isButtonDown(0);
if (bgBlueDrag) {
double diff = 255D - 0F;
double mouse = MathHelper.clamp_double((mouseX - sliderLeft) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
this.blueBackground = (int) newVal;
}
font.drawString(new DecimalFormat("0.00").format(blueBackground), sliderLeft + 95, settingY, -1, true);
settingY += 15;
// Presets
boolean twoColumn = false;
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Store Preset");
settingY += 15;
// Loads
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Load Cape");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Load Wings");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Load Bandana");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Load Shield");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 65 : 0), settingY, 60, 12, "Load Round Shield");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 65 : 0), settingY, 60, 12, "Load Hexagon Shield");
twoColumn = false;
if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getLocationOfWings() == null) {
settingY += 20;
font.drawString("Frames: " + this.frames, 2, settingY, -1, true);
settingY += 10;
font.drawString("Current Frame: " + (this.currentFrame + 1), 2, settingY, -1, true);
settingY += 15;
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Prev Frame");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
StaticButton.render(2 + (twoColumn ? 63 : 0), settingY, 60, 12, "Next Frame");
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
}
}
StaticButton.render(2, sr.getScaledHeight() - 14, 50, 12, "Open Textures Folder");
StaticButton.render(sr.getScaledWidth() - 52, 2, 50, 12, "Hide UI");
}
GlUtils.startScale(sr.getScaledWidth() / 2, sr.getScaledHeight() / 2 + ((int) (50 * scale)), scale);
CosmeticsGui.drawEntityOnScreen(sr.getScaledWidth() / 2, sr.getScaledHeight() / 2 + ((int) (50 * scale)), 45, 1, 1, mc.thePlayer, rotate);
GlUtils.stopScale();
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
ScaledResolution sr = new ScaledResolution(mc);
if(!AdminRender.savingPreview) {
if(StaticButton.isHovered(mouseX, mouseY, 2, 2, 50, 12)) {
this.showSettings = !this.showSettings;
}
if(StaticButton.isHovered(mouseX, mouseY, sr.getScaledWidth() - 52, 2, 50, 12)) {
AdminRender.savingPreview = true;
}
if(StaticButton.isHovered(mouseX, mouseY, 2, sr.getScaledHeight() - 14, 50, 12)) {
File file1 = adminRenderPath;
String s = file1.getAbsolutePath();
if (Util.getOSType() == Util.EnumOS.OSX)
{
try
{
Client.logger.info(s);
Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
return;
}
catch (IOException ioexception1)
{
Client.logger.error((String)"Couldn\'t open file", (Throwable)ioexception1);
}
}
else if (Util.getOSType() == Util.EnumOS.WINDOWS)
{
String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});
try
{
Runtime.getRuntime().exec(s1);
return;
}
catch (IOException ioexception)
{
Client.logger.error((String)"Couldn\'t open file", (Throwable)ioexception);
}
}
boolean flag = false;
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[] {file1.toURI()});
}
catch (Throwable throwable)
{
Client.logger.error("Couldn\'t open link", throwable);
flag = true;
}
if (flag)
{
Client.logger.info("Opening via system class!");
Sys.openURL("file://" + s);
}
}
if(this.showSettings) {
int settingY = 95;
boolean twoColumn = false;
if(StaticButton.isHovered(mouseX, mouseY, 2, settingY, 60, 12)) {
this.scale = 3.20F;
this.rotate = 4;
this.redBackground = 19;
this.blueBackground = 19;
this.greenBackground = 19;
}
settingY += 15;
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("cape");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("wings");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("bandana");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("shield", "shield");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("shield", "roundshield");
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
loadTextureCosmetic("shield", "hexagon_shield");
}
twoColumn = false;
if(CustomAbstractClientPlayer.players.get(CustomAbstractClientPlayer.players.get(mc.thePlayer)).getLocationOfWings() == null) {
settingY += 45;
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
this.currentFrame = (this.currentFrame - 1 >= 0 ? this.currentFrame - 1 : this.frames - 1);
}
if(twoColumn) {
twoColumn = !twoColumn;
settingY += 15;
} else {
twoColumn = !twoColumn;
}
if(StaticButton.isHovered(mouseX, mouseY, 2 + (twoColumn ? 63 : 0), settingY, 60, 12)) {
this.currentFrame = (this.currentFrame + 1 <= (this.frames - 1) ? this.currentFrame + 1 : 0);
}
}
}
} else {
AdminRender.savingPreview = false;
}
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
Players.reload();
}
private void loadTextureCosmetic(String type) {
this.loadTextureCosmetic(type, "");
}
private void loadTextureCosmetic(String type, String model) {
CustomAbstractClientPlayer.players.get(mc.thePlayer).setLocationSilentCape(null);
CustomAbstractClientPlayer.players.get(mc.thePlayer).setShoulders(null);
CustomAbstractClientPlayer.players.get(mc.thePlayer).setBandana(null);
CustomAbstractClientPlayer.players.get(mc.thePlayer).setHat(null);
CustomAbstractClientPlayer.players.get(mc.thePlayer).setShield(null);
CustomAbstractClientPlayer.players.get(mc.thePlayer).setLocationOfWings(null);
this.frames = 0;
this.currentFrame = 0;
switch(type) {
case "cape":
CustomAbstractClientPlayer.players.get(mc.thePlayer).setLocationSilentCape(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150));
CustomAbstractClientPlayer.players.get(mc.thePlayer).setShoulders(FileUtils.fileToResourceLocation(new File(adminRenderPath, "0.png")));
this.frames = CustomAbstractClientPlayer.players.get(mc.thePlayer).getLocationSilentCape().getFrames();
this.currentFrame = 0;
break;
case "wings":
CustomAbstractClientPlayer.players.get(mc.thePlayer).setLocationOfWings(FileUtils.fileToResourceLocation(new File(adminRenderPath, "0.png")));
this.frames = 1;
this.currentFrame = 0;
break;
case "bandana":
CustomAbstractClientPlayer.players.get(mc.thePlayer).setBandana(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150));
this.frames = CustomAbstractClientPlayer.players.get(mc.thePlayer).getBandana().getFrames();
this.currentFrame = 0;
break;
case "shield":
CustomAbstractClientPlayer.players.get(mc.thePlayer).setShield(new ShieldData(new TestAnimatedResourceLocation(adminRenderPath.listFiles().length - 1, 150), model));
this.frames = CustomAbstractClientPlayer.players.get(mc.thePlayer).getShield().getTexture().getFrames();
this.currentFrame = 0;
break;
}
}
private class TestAnimatedResourceLocation extends AnimatedResourceLocation {
public TestAnimatedResourceLocation(int frames, int fpt) {
super("", frames, fpt, true);
textures = new ResourceLocation[frames];
for(int i = 0; i < frames; i++) {
textures[i] = FileUtils.fileToResourceLocation(new File(adminRenderPath, i + ".png"));
}
}
@Override
public void update(float deltaTick) {
// Nothing =)
}
}
}

View File

@ -0,0 +1,278 @@
package net.silentclient.client.blc;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
public class BlcGlStateManager {
public static void a() {
// GlStateManager.get
}
public static void b() {
GlStateManager.disableAlpha();
}
public static void a(final int n, final float n2) {
GlStateManager.enableAlpha();
}
public static void c() {
GlStateManager.enableLighting();
}
public static void d() {
GlStateManager.disableLighting();
}
public static void e() {
GlStateManager.disableDepth();
}
public static void f() {
GlStateManager.enableDepth();
}
public static void a(final int n) {
GlStateManager.depthFunc(n);
}
public static void a(final boolean b) {
GlStateManager.depthMask(b);
}
public static void g() {
GlStateManager.enableBlend();
}
public static void h() {
GlStateManager.disableBlend();
}
public static void a(final int n, final int n2) {
GlStateManager.blendFunc(n, n2);
}
public static void a(final int n, final int n2, final int n3, final int n4) {
GlStateManager.tryBlendFuncSeparate(n, n2, n3, n4);
}
public static void i() {
GlStateManager.enableFog();
}
public static void j() {
GlStateManager.disableFog();
}
public static void b(final int n) {
GlStateManager.setFog(n);
}
public static void a(final float n) {
GlStateManager.setFogDensity(n);
}
public static void b(final float n) {
GlStateManager.setFogStart(n);
}
public static void c(final float n) {
GlStateManager.setFogEnd(n);
}
public static void k() {
GlStateManager.enableCull();
}
public static void l() {
GlStateManager.disableCull();
}
public static void c(final int n) {
GlStateManager.cullFace(n);
}
public static void m() {
GlStateManager.enablePolygonOffset();
}
public static void n() {
GlStateManager.disablePolygonOffset();
}
public static void a(final float n, final float n2) {
GlStateManager.doPolygonOffset(n, n2);
}
public static void o() {
GlStateManager.enableColorLogic();
}
public static void p() {
GlStateManager.disableColorLogic();
}
public static void d(final int n) {
GlStateManager.colorLogicOp(n);
}
public static void e(final int n) {
GlStateManager.setActiveTexture(n);
}
public static void q() {
GlStateManager.enableTexture2D();
}
public static void r() {
GlStateManager.disableTexture2D();
}
public static void a(final float n, final float n2, final float n3, final float n4) {
GlStateManager.color(n, n2, n3, n4);
}
public static void a(final float n, final float n2, final float n3) {
GlStateManager.color(n, n2, n3);
}
public static void s() {
GlStateManager.resetColor();
}
public static void f(final int n) {
GlStateManager.callList(n);
}
public static void t() {
GlStateManager.pushMatrix();
}
public static void u() {
GlStateManager.popMatrix();
}
public static void b(final float n, final float n2, final float n3, final float n4) {
GlStateManager.rotate(n, n2, n3, n4);
}
public static void b(final float n, final float n2, final float n3) {
GlStateManager.scale(n, n2, n3);
}
public static void a(final double n, final double n2, final double n3) {
GlStateManager.scale(n, n2, n3);
}
public static void c(final float n, final float n2, final float n3) {
GlStateManager.translate(n, n2, n3);
}
public static void b(final double n, final double n2, final double n3) {
GlStateManager.translate(n, n2, n3);
}
public static void b(final int n, final int n2, final int n3, final int n4) {
OpenGlHelper.glBlendFunc(n, n2, n3, n4);
}
public static boolean v() {
return OpenGlHelper.areShadersSupported();
}
public static void w() {
RenderHelper.enableStandardItemLighting();
}
public static void x() {
RenderHelper.disableStandardItemLighting();
}
public static void y() {
RenderHelper.enableGUIStandardItemLighting();
}
public static void g(final int n) {
GlStateManager.shadeModel(n);
}
public static boolean z() {
return GLContext.getCapabilities().OpenGL15;
}
public static boolean A() {
return GLContext.getCapabilities().OpenGL21;
}
public static void a(final int n, final IntBuffer intBuffer) {
GL11.glGetInteger(n, intBuffer);
}
public static void a(final int n, final FloatBuffer floatBuffer) {
GL11.glGetFloat(n, floatBuffer);
}
public static void h(final int n) {
GlStateManager.clear(n);
}
}

View File

@ -0,0 +1,116 @@
package net.silentclient.client.config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
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.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.NotificationUtils;
import org.lwjgl.input.Keyboard;
import java.io.IOException;
public class AddConfigModal extends SilentScreen {
private final GuiScreen parentScreen;
private int modalWidth;
private int modalHeight;
private boolean cloneConfig;
public AddConfigModal(GuiScreen parentScreen) {
this.parentScreen = parentScreen;
this.modalWidth = 200;
this.modalHeight = 90;
}
@Override
public void initGui() {
MenuBlurUtils.loadBlur();
this.cloneConfig = false;
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.buttonList.add(new IconButton(1, x + this.modalWidth - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
this.buttonList.add(new Button(2, x + 3, y + this.modalHeight - 23, this.modalWidth - 6, 20, "Done"));
this.silentInputs.add(new Input("Config Name"));
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
switch (button.id) {
case 1:
mc.displayGuiScreen(parentScreen);
break;
case 2:
if(this.silentInputs.get(0).getValue().length() != 0) {
String result = Client.getInstance().configManager.newConfig(this.silentInputs.get(0).getValue() + ".txt", cloneConfig);
if(!result.equals("success")) {
NotificationUtils.showNotification("Error", result);
} else {
mc.displayGuiScreen(parentScreen);
}
} else {
NotificationUtils.showNotification("Error", "Please enter a Config Name");
}
break;
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
GlStateManager.pushMatrix();
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
// 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);
// Content
this.silentInputs.get(0).render(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);
Checkbox.render(mouseX, mouseY, x + 3, y + 50, "Clone Current Config", cloneConfig);
super.drawScreen(mouseX, mouseY, partialTicks);
GlStateManager.popMatrix();
NotificationManager.render();
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.silentInputs.get(0).onClick(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);
if(Checkbox.isHovered(mouseX, mouseY, x + 3, y + 50)) {
this.cloneConfig = !this.cloneConfig;
}
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_ESCAPE) {
mc.displayGuiScreen(parentScreen);
return;
};
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
}
}

View File

@ -0,0 +1,306 @@
package net.silentclient.client.config;
import java.awt.Color;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.hud.ScreenPosition;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModDraggable;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.mods.player.AutoTextMod.AutoTextCommand;
import net.silentclient.client.utils.MenuBlurUtils;
public final class ConfigManager {
public File configFile;
private final File settingsFile;
private Set<String> configs;
public ConfigManager() {
updateConfigs();
settingsFile = new File(Minecraft.getMinecraft().mcDataDir, "silent_settings.txt");
if(!settingsFile.exists()) {
try {
settingsFile.createNewFile();
try(PrintWriter writer = new PrintWriter(this.settingsFile)) {
writer.println("config:config.txt");
} catch (Exception err) {
err.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
String config = "config.txt";
try (BufferedReader reader = new BufferedReader(new FileReader(this.settingsFile))) {
String s;
while ((s = reader.readLine()) != null) {
String[] args = s.split(":");
if(s.toLowerCase().startsWith("config:")) {
try {
if(!args[1].equals(settingsFile.getName())) {
config = args[1];
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
} catch (Exception err) {
err.printStackTrace();
}
configFile = new File(Client.getInstance().dir, config);
if(!configFile.exists()) {
try {
configFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
this.load();
}
public Set<String> getConfigFiles() {
return this.configs;
}
public void updateConfigs() {
this.configs = Stream.of(Client.getInstance().dir.listFiles())
.filter(file -> !file.isDirectory())
.map(File::getName)
.collect(Collectors.toSet());
}
public void deleteConfig(String name) {
try {
new File(Client.getInstance().dir, name).delete();
} catch (Exception err) {
err.printStackTrace();
}
updateConfigs();
}
public void loadConfig(String name) {
try(PrintWriter writer = new PrintWriter(this.settingsFile)) {
writer.println("config:" + name);
} catch (Exception err) {
err.printStackTrace();
}
configFile = new File(Client.getInstance().dir, name);
if(!configFile.exists()) {
try {
configFile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
this.load();
this.save();
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m.isEnabled()) {
m.toggle();
m.toggle();
}
}
NotificationManager.clear();
}
public String newConfig(String name, boolean clone) {
File testConfig = new File(Client.getInstance().dir, name);
if(testConfig.exists()) {
return "Config already exists.";
} else {
try {
testConfig.createNewFile();
} catch (IOException e) {
e.printStackTrace();
return "Error: " + e.getMessage();
}
}
try(PrintWriter writer = new PrintWriter(this.settingsFile)) {
writer.println("config:" + name);
} catch (Exception err) {
err.printStackTrace();
return "Error: " + err.getMessage();
}
configFile = testConfig;
if(!clone) {
Client.getInstance().getModInstances().getMods().forEach(mod -> mod.reset(true));
}
this.save();
this.load();
if(clone) {
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m.isEnabled()) {
m.toggle();
m.toggle();
}
}
}
updateConfigs();
return "success";
}
public void load() {
try (BufferedReader reader = new BufferedReader(new FileReader(this.configFile))) {
String s;
Client.getInstance().getModInstances().getAutoText().commands.clear();
while((s = reader.readLine()) != null) {
String[] args = s.split(":");
if (s.toLowerCase().startsWith("mod:")) {
try {
Mod m = Client.getInstance().getModInstances().getModByName(args[1]);
if (m != null) {
m.setEnabled(Boolean.parseBoolean(args[2]));
m.setToggled(Boolean.parseBoolean(args[2]));
}
} catch (Exception err) {
err.printStackTrace();
}
}
if (s.toLowerCase().startsWith("pos:")) {
try {
Mod m = Client.getInstance().getModInstances().getModByName(args[1]);
if (m != null && m instanceof ModDraggable) {
ModDraggable md = (ModDraggable) m;
md.setPos(ScreenPosition.fromRelativePosition(Double.parseDouble(args[2]), Double.parseDouble(args[3])));
md.getPos().setRelative(Double.parseDouble(args[2]), Double.parseDouble(args[3]));
}
} catch (Exception err) {
err.printStackTrace();
}
}
if (s.toLowerCase().startsWith("set:")) {
Mod m = Client.getInstance().getModInstances().getModByName(args[2]);
if (m != null) {
Setting set = Client.getInstance().getSettingsManager().getSettingByName(m, args[1]);
if (set != null) {
if (set.isCheck()) {
try {
set.setValBoolean(Boolean.parseBoolean(args[3]));
if(set.getName() == "Menu Background Blur") {
if(Minecraft.getMinecraft().currentScreen != null) {
if(!set.getValBoolean()) {
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
} else {
MenuBlurUtils.loadBlur();
}
}
}
} catch (Exception err) {
}
}
if (set.isCombo()) {
try {
if(set.getOptions().contains(args[3])) {
set.setValString(args[3]);
}
} catch (Exception err) {
}
}
if (set.isSlider()) {
try {
if(Double.parseDouble(args[3]) >= set.getMin() && Double.parseDouble(args[3]) <= set.getMax()) {
set.setValDouble(Double.parseDouble(args[3]));
}
} catch (Exception err) {
}
}
if(set.isInput()) {
try {
set.setValString(args[3]);
} catch (Exception err) {
}
}
if (set.isColor()) {
try {
set.setValColor(new Color(Integer.parseInt(args[3])));
} catch (Exception err) {
}
try {
set.setChroma(Boolean.parseBoolean(args[4]));
} catch (Exception err) {
}
try {
set.setOpacity(Integer.parseInt(args[5]));
} catch (Exception err) {
}
}
}
}
}
if (s.toLowerCase().startsWith("atc:")) {
try {
Client.getInstance().getModInstances().getAutoText().addCommand(args[1], Integer.parseInt(args[2]));
} catch (Exception err) {
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
public void save() {
try(PrintWriter writer = new PrintWriter(this.configFile)) {
for(Mod m : Client.getInstance().getModInstances().getMods()) {
writer.println("MOD:" + m.getName() + ":" + m.isToggled());
if(m instanceof ModDraggable) {
ModDraggable md = (ModDraggable) m;
writer.println("POS:" + m.getName() + ":" + md.getPos().getRelitiveX() + ":" + md.getPos().getRelitiveY());
}
}
for(Setting set : Client.getInstance().getSettingsManager().getSettings()) {
if (set.isCheck()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getValBoolean());
}
if (set.isCombo()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getValString());
}
if (set.isSlider()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getValDouble());
}
if (set.isColor()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getClearColor().getRGB() + ":" + set.isChroma() + ":" + set.getOpacity());
}
if(set.isInput()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getValString());
}
}
for(AutoTextCommand command : Client.getInstance().getModInstances().getAutoText().getCommands()) {
writer.println("ATC:"+command.getCommand()+":"+command.getKey());
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,103 @@
package net.silentclient.client.cosmetics;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.silentclient.client.Client;
import net.silentclient.client.blc.BlcGlStateManager;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.utils.CustomAbstractClientPlayer;
public class AbstractShieldRenderer extends ModelBase implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
public AbstractShieldRenderer(RenderPlayer playerRendererIn)
{
this.playerRenderer = playerRendererIn;
}
@Override
public void doRenderLayer(AbstractClientPlayer entity, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if(CustomAbstractClientPlayer.players.get(entity).getShield() == null || !Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Shields").getValBoolean() || entity.isInvisible() || !Client.getInstance().getCosmetics().shieldModels.containsKey(CustomAbstractClientPlayer.players.get(entity).getShield().getModel()) || !Client.getInstance().getCosmetics().shieldModels.get(CustomAbstractClientPlayer.players.get(entity).getShield().getModel()).loadModel()) {
return;
}
BlcGlStateManager.t();
BlcGlStateManager.s();
BlcGlStateManager.a(1.0F, 1.0F, 1.0F, 1.0F);
BlcGlStateManager.g();
BlcGlStateManager.a(770, 771);
BlcGlStateManager.q();
BlcGlStateManager.d();
BlcGlStateManager.t();
if (playerRenderer.getMainModel().bipedLeftArm.rotateAngleZ != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedLeftArm.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
if (playerRenderer.getMainModel().bipedLeftArm.rotateAngleY != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedLeftArm.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (playerRenderer.getMainModel().bipedLeftArm.rotateAngleX != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedLeftArm.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
applyArmTransformations(CustomAbstractClientPlayer.players.get(entity).getShield().getModel(), entity.isSneaking(), entity.getSkinType().equals("slim"));
double d = getShieldScale(CustomAbstractClientPlayer.players.get(entity).getShield().getModel());
BlcGlStateManager.a(d, d, d);
BlcGlStateManager.k();
CustomAbstractClientPlayer.players.get(entity).getShield().getTexture().bindTexture();
Client.getInstance().getCosmetics().shieldModels.get(CustomAbstractClientPlayer.players.get(entity).getShield().getModel()).renderModel();
BlcGlStateManager.c();
BlcGlStateManager.u();
BlcGlStateManager.c(1029);
BlcGlStateManager.l();
BlcGlStateManager.r();
BlcGlStateManager.u();
GlStateManager.enableTexture2D();
CustomAbstractClientPlayer.players.get(entity).getShield().getTexture().update(partialTicks);
}
public double getShieldScale(String model) {
if(model.equals("roundshield") || model.equals("hexagon_shield") || model.equals("shield_dollar")) {
return 0.125;
}
return 0.009;
}
private void applyArmTransformations(String model, boolean paramBoolean1, boolean paramBoolean2) {
switch(model) {
case "shield":
GlStateManager.translate(0.33, 0.2, 0);
BlcGlStateManager.b(180.0f, 0.0f, 1.0f, 1.0f);
BlcGlStateManager.b(-180.0f, 1.0f, 0.0f, 0.0f);
BlcGlStateManager.b(-90.0f, 0.0f, 1.0f, 0.0f);
BlcGlStateManager.b(paramBoolean1 ? -0.5799999833106995 : -0.4000000059604645, paramBoolean1 ? -0.42 : -0.5, paramBoolean2 ? 0.13700000524520874 : 0.2);
break;
case "roundshield":
GlStateManager.translate(0.33, 0.2, 0);
BlcGlStateManager.b(-90.0F, 0.0F, 1.0F, 0.0F);
BlcGlStateManager.b(paramBoolean1 ? -0.10000000149011612D : 0.0D, paramBoolean1 ? 0.45D : 0.25D, paramBoolean2 ? -0.1399999964237213D : -0.2D);
BlcGlStateManager.b(180.0F, 0.0F, 0.0F, 1.0F);
break;
case "hexagon_shield":
GlStateManager.translate(0.75F, 0.2, 0);
BlcGlStateManager.b(90.0F, 0.0F, 1.0F, 0.0F);
BlcGlStateManager.b(paramBoolean1 ? 0.2 : 0, paramBoolean1 ? 0.45D : 0.25D, (paramBoolean2 ? -0.28D : -0.2D) + (paramBoolean1 ? -0.02 : 0));
BlcGlStateManager.b(180.0F, 0.0F, 0.0F, 1.0F);
break;
case "shield_dollar":
GlStateManager.translate(0.70F, 0.2, 0);
BlcGlStateManager.b(90.0F, 0.0F, 1.0F, 0.0F);
BlcGlStateManager.b(paramBoolean1 ? 0.2 : 0, paramBoolean1 ? 0.45D : 0.25D, (paramBoolean2 ? -0.265D : -0.2D) + (paramBoolean1 ? -0.02 : 0));
BlcGlStateManager.b(180.0F, 0.0F, 0.0F, 1.0F);
break;
}
}
@Override
public boolean shouldCombineTextures() {
return false;
}
}

View File

@ -0,0 +1,100 @@
package net.silentclient.client.cosmetics;
import java.util.ArrayList;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.utils.SCTextureManager;
import net.silentclient.client.utils.TimerUtils;
public class AnimatedResourceLocation {
protected final String folder;
protected final int frames;
protected final int fpt;
private int currentFrame = 0;
private TimerUtils timer = new TimerUtils();
protected ResourceLocation[] textures;
public ArrayList<ResourceLocation> bindedFrames = new ArrayList<ResourceLocation>();
private boolean binding;
public AnimatedResourceLocation(String folder, int frames, int fpt) {
this(folder, frames, fpt, false, false);
}
public AnimatedResourceLocation(String folder, int frames, int fpt, boolean clear) {
this(folder, frames, fpt, clear, false);
}
public AnimatedResourceLocation(String folder, int frames, int fpt, boolean clear, boolean bind) {
this.folder = folder;
this.frames = frames;
this.fpt = fpt;
if(!clear) {
textures = new ResourceLocation[frames];
for(int i = 0; i < frames; i++) {
if(bind) {
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(folder + "/" + i + ".png"));
}
textures[i] = new ResourceLocation(folder + "/" + i + ".png");
}
}
}
public int getCurrentFrame() {
return currentFrame;
}
public ArrayList<ResourceLocation> getBindedFrames() {
return bindedFrames;
}
public ResourceLocation getTexture() {
return textures[currentFrame];
}
public int getFrames() {
return frames;
}
public ResourceLocation[] getTextures() {
return textures;
}
public void bindTexture() {
if(currentFrame == 0) {
binding = false;
Minecraft.getMinecraft().getTextureManager().bindTexture(this.getTextures()[0]);
return;
}
binding = SCTextureManager.waitBindTexture(this.getTexture(), this.getTextures()[0], 1000);
}
public void setCurrentFrame(int currentFrame) {
this.currentFrame = currentFrame;
}
public void update(float deltaTick) {
if(textures.length == 1) {
currentFrame = 0;
return;
}
if(this.binding) {
return;
}
if(timer.delay(this.fpt)) {
currentFrame++;
if(currentFrame > textures.length - 1) {
currentFrame = 0;
}
timer.reset();
}
}
}

View File

@ -0,0 +1,170 @@
package net.silentclient.client.cosmetics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.UUID;
import javax.imageio.ImageIO;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.item.ItemStack;
import net.silentclient.client.Client;
import net.silentclient.client.blc.BlcGlStateManager;
import net.silentclient.client.mixin.accessors.MinecraftAccessor;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.CustomAbstractClientPlayer;
public class BandanaRenderer extends ModelBase implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
private static HashMap<UUID, Integer> uuidToHatLayer = new HashMap<UUID, Integer>();
private static HashSet<UUID> checkedUuids = new HashSet<UUID>();
public BandanaRenderer(RenderPlayer playerRendererIn)
{
this.playerRenderer = playerRendererIn;
}
@Override
public void doRenderLayer(AbstractClientPlayer entityIn, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if(Client.getInstance().getCosmetics().getBandana() == null || !Client.getInstance().getCosmetics().getBandana().loadModel() || !Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean() || CustomAbstractClientPlayer.players.get(entityIn).getBandana() == null || entityIn.isInvisible()) {
return;
}
GlStateManager.pushMatrix();
BlcGlStateManager.t();
BlcGlStateManager.s();
BlcGlStateManager.g();
BlcGlStateManager.a(770, 771);
BlcGlStateManager.q();
BlcGlStateManager.d();
BlcGlStateManager.t();
if(entityIn.isSneaking()) {
GlStateManager.translate(0.0f, 0.25f, 0.0f);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleZ != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleY != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleX != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
double applyTransformations = this.applyTransformations();
if(CustomAbstractClientPlayer.players.get(entityIn).getSilentAccount() != null && CustomAbstractClientPlayer.players.get(entityIn).getBandana().getTexture().getResourcePath().equals("silentclient/cosmetics/bandanas/17/0.png")) {
if(CustomAbstractClientPlayer.players.get(entityIn).getSilentAccount().getBandanaColor() == 50) {
ColorUtils.setColor(ColorUtils.getChromaColor(0, 0, 1).getRGB());
} else {
ColorUtils.setColor(CustomAbstractClientPlayer.players.get(entityIn).getSilentAccount().getBandanaColor());
}
}
applyTransformations += this.manipulate(entityIn);
GlStateManager.scale(applyTransformations, applyTransformations, applyTransformations);
CustomAbstractClientPlayer.players.get(entityIn).getBandana().bindTexture();
BlcGlStateManager.k();
Client.getInstance().getCosmetics().getBandana().renderModel();
BlcGlStateManager.c();
BlcGlStateManager.u();
BlcGlStateManager.c(1029);
BlcGlStateManager.l();
BlcGlStateManager.r();
BlcGlStateManager.u();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
CustomAbstractClientPlayer.players.get(entityIn).getBandana().update(partialTicks);
}
private void runSkinProcessing(final UUID uuid, final String s) {
if (BandanaRenderer.checkedUuids.contains(uuid)) {
return;
}
BandanaRenderer.checkedUuids.add(uuid);
new Thread(new Runnable() {
@Override
public void run() {
final String substring = s;
final String string = ((MinecraftAccessor) Minecraft.getMinecraft()).getFileAssets().getAbsolutePath() + "/skins/" + substring.substring(0, 2) + "/" + s;
try {
BandanaRenderer.uuidToHatLayer.put(uuid, BandanaRenderer.findMaxHatLayer(ImageIO.read(new File(string))));
BandanaRenderer.checkedUuids.remove(uuid);
}
catch (final Exception ex) {
try {
Thread.sleep(1000L);
}
catch (final InterruptedException ex2) {}
BandanaRenderer.checkedUuids.remove(uuid);
}
}
}).start();
}
public static int findMaxHatLayer(final BufferedImage bufferedImage) {
for (int i = 8, n = 8; i < 16; ++i, --n) {
for (int j = 32; j < 64; ++j) {
if (bufferedImage.getRGB(j, i) >> 24 != 0) {
return n;
}
}
}
return 0;
}
private double applyTransformations() {
GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
final Vector4f rotations = new Vector4f(180.0f, 0.0f, 1.0f, 0.0f);
final Vector3f translations = new Vector3f(0.0f, 0.375f, 0.0f);
GlStateManager.rotate(rotations.x, rotations.y, rotations.z, rotations.w);
GlStateManager.translate(translations.x, translations.y, translations.z);
return 0.068F;
}
private double manipulate(AbstractClientPlayer entity) {
double n = 0.0;
GlStateManager.translate(0.0, -1 * 0.06, 0.0);
ItemStack helmet = entity.getCurrentArmor(3);
if(helmet != null) {
n = 0.012;
} else {
final Integer n2 = BandanaRenderer.uuidToHatLayer.get(entity.getUniqueID());
if (n2 == null) {
this.runSkinProcessing(entity.getUniqueID(), entity.getLocationSkin().getResourcePath().replace("skins/", ""));
return n;
}
if (n2 == 0) {
return n;
}
if (n2 > 4) {
n = 0.001;
}
}
return n;
}
@Override
public boolean shouldCombineTextures() {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,142 @@
package net.silentclient.client.cosmetics;
import net.silentclient.client.utils.CustomAbstractClientPlayer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.silentclient.client.Client;
import net.silentclient.client.mods.settings.FPSBoostMod;
import net.silentclient.client.utils.AngleUtilities;
public class CapeRenderer extends ModelBase implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
private ModelRenderer bipedCloakShoulders;
public CapeRenderer(RenderPlayer playerRendererIn)
{
this.playerRenderer = playerRendererIn;
this.bipedCloakShoulders = new ModelRenderer(this, 0, 17);
this.bipedCloakShoulders.setTextureSize(22, 23);
this.bipedCloakShoulders.addBox(-5.0F, -1.0F, -2.0F, 2, 1, 5, 0.0F);
this.bipedCloakShoulders.addBox(3.0F, -1.0F, -2.0F, 2, 1, 5, 0.0F);
}
@Override
public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if(CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getLocationSilentCape() == null || CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getLocationCustomCape() != null) {
return;
}
if (entitylivingbaseIn.isInvisible()) {
return;
}
CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getDynamicCape().ticks(System.nanoTime());
String capeType = CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getCapeType();
GlStateManager.pushMatrix();
CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getLocationSilentCape().bindTexture();
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
GlStateManager.disableLighting();
GlStateManager.color(1, 1, 1);
double prevX = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks);
double prevY = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks);
double prevZ = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks);
float prevRenderYaw = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks;
float prevCameraYaw = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks;
double distanceWalkedModified = entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks;
final double a = AngleUtilities .a((double)(prevRenderYaw * 3.1415927f / 180.0f));
final double n2 = -AngleUtilities .b(prevRenderYaw * 3.1415927f / 180.0f);
float a2 = AngleUtilities .a((float)prevY * 10.0f, -6.0f, 32.0f);
float n3 = (float)(prevX * a + prevZ * n2) * 100.0f;
final float n4 = (float)(prevX * n2 - prevZ * a) * 100.0f;
if (n3 < 0.0f) {
n3 = 0.0f;
}
if (n3 > 165.0f) {
n3 = 165.0f;
}
if(entitylivingbaseIn.isSneaking()) {
n3 += 5.0F;
GlStateManager.translate(0.0F, 0.1F, 0.0F);
a2 += 25.0F;
GlStateManager.translate(0.0F, 0.05F, -0.0178F);
}
float n5 = a2 + (float) (AngleUtilities.a(6.0f * prevCameraYaw)) * (float) (16.0f * distanceWalkedModified);
GlStateManager.scale(0.0625f, 0.0625f, 0.0625f);
GlStateManager.translate(0.0f, 0.0f, 2.0f);
GlStateManager.rotate(6.0f + Math.min(n3 / 2.0f + n5, 90.0f), 1.0f, 0.0f, 0.0f);
GlStateManager.rotate(n4 / 2.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.rotate(-n4 / 2.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(-90.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(180.0f, 1.0f, 0.0f, 0.0f);
if(Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Low Graphics Mode").getValBoolean()) {
capeType = "rectangle";
}
switch(capeType) {
case "dynamic_curved":
final float max = Math.max(Math.min(0.0f, n5), -3.0f);
final float min = Math.min(n3 + n5, 90.0f);
CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getDynamicCape().renderDynamicCape();
CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getDynamicCape().update(min, max, true);
break;
case "curved_rectangle":
CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getCurvedCape().renderStaticCape();
break;
default:
CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getStaticCape().renderStaticCape();
break;
}
GlStateManager.translate(0.0f, 0.0f, 0.125f);
GlStateManager.rotate(6.0f + n3 / 2.0f + n5, 1.0f, 0.0f, 0.0f);
GlStateManager.rotate(n4 / 2.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.rotate(-n4 / 2.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.rotate(180.0f, 0.0f, 1.0f, 0.0f);
GlStateManager.popMatrix();
if(CustomAbstractClientPlayer.players.get(entitylivingbaseIn).capeShoulders() && CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getLocationCustomCape() == null) {
playerRenderer.bindTexture(CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getShoulders());
GlStateManager.pushMatrix();
if(entitylivingbaseIn.isSneaking()) {
GlStateManager.translate(0.0F, 0.2F, 0.0F);
GlStateManager.rotate(10.0F, 1.0F, 0.0F, 0.0F);
}
GlStateManager.rotate(-n4 / 2.0F, 0.0F, 1.0F, 0.0F);
this.bipedCloakShoulders.render(0.0625F);
GlStateManager.popMatrix();
}
GlStateManager.enableLighting();
if(CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getLocationSilentCape() != null) {
CustomAbstractClientPlayer.players.get(entitylivingbaseIn).getLocationSilentCape().update(partialTicks);
}
}
@Override
public boolean shouldCombineTextures() {
return false;
}
}

View File

@ -0,0 +1,338 @@
package net.silentclient.client.cosmetics;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.net.ssl.HttpsURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.model.ModelBuffer;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.utils.CustomAbstractClientPlayer;
import net.silentclient.client.utils.Players;
import net.silentclient.client.utils.types.CosmeticsResponse;
import net.silentclient.client.utils.types.PlayerResponse;
import net.silentclient.client.utils.types.PlayerResponse.Account.Cosmetics.CosmeticItem;
public class Cosmetics {
public Map<Number, AnimatedResourceLocation> capes = new HashMap<>();
public Map<Number, ResourceLocation> capesShoulders = new HashMap<>();
public Map<Number, ResourceLocation> wings = new HashMap<>();
public Map<Number, AnimatedResourceLocation> bandanas = new HashMap<>();
public Map<Number, HatData> hats = new HashMap<>();
public Map<Number, ShieldData> shields = new HashMap<>();
public Map<Number, ResourceLocation> icons = new HashMap<>();
public ArrayList<CosmeticItem> myIcons = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myWings = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myCapes = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myBandanas = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myHats = new ArrayList<CosmeticItem>();
public ArrayList<CosmeticItem> myShields = new ArrayList<CosmeticItem>();
public ArrayList<ResourceLocation> bindTextures = new ArrayList<ResourceLocation>();
public ResourceLocation defaultIcon;
private ModelBuffer bandana;
public Map<String, ModelBuffer> hatModels = new HashMap<>();
public Map<String, ModelBuffer> shieldModels = new HashMap<>();
public void init() {
init(true);
}
public void init(boolean cosmeticInit) {
if(cosmeticInit) {
Client.logger.info("STARTING > cosmeitcs > bandana_model");
try {
bandana = new ModelBuffer(new ResourceLocation("silentclient/models/bandana.obj"));
} catch (Exception e) {
e.printStackTrace();
}
Client.logger.info("STARTING > cosmeitcs > default_icon");
defaultIcon = new ResourceLocation("silentclient/icons/player_icon.png");
if(!Client.getInstance().isDebug()) {
CosmeticsResponse allCosmetics = getAllCosmetics();
Client.logger.info("STARTING > cosmeitcs > capes");
capes.clear();
capesShoulders.clear();
if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getCapes() != null) {
allCosmetics.getCosmetics().getCapes().forEach((cape) -> {
capes.put(cape.getId(), new AnimatedResourceLocation("silentclient/cosmetics/capes/"+cape.getId(), cape.getFrames(), cape.getFrameDelay(), false, cape.getId() == Client.getInstance().getAccount().getSelectedCape()));
capesShoulders.put(cape.getId(), new ResourceLocation("silentclient/cosmetics/capes/"+cape.getId()+"/shoulders.png"));
});
}
Client.logger.info("STARTING > cosmeitcs > wings");
wings.clear();
if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getWings() != null) {
allCosmetics.getCosmetics().getWings().forEach((wing) -> {
wings.put(wing.getId(), new ResourceLocation("silentclient/cosmetics/wings/"+ wing.getId() + "/0.png"));
});
}
Client.logger.info("STARTING > cosmeitcs > bandanas");
bandanas.clear();
if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getBandanas() != null) {
allCosmetics.getCosmetics().getBandanas().forEach((bandana) -> {
bandanas.put(bandana.getId(), new AnimatedResourceLocation("silentclient/cosmetics/bandanas/"+bandana.getId(), bandana.getFrames(), bandana.getFrameDelay(), false, bandana.getId() == Client.getInstance().getAccount().getSelectedBandana()));
});
}
Client.logger.info("STARTING > cosmeitcs > hats");
hats.clear();
if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getHats() != null) {
allCosmetics.getCosmetics().getHats().forEach((hat) -> {
hats.put(hat.getId(), new HatData(new AnimatedResourceLocation("silentclient/cosmetics/hats/"+hat.getId(), hat.getFrames(), hat.getFrameDelay(), false, hat.getId() == Client.getInstance().getAccount().getSelectedHat()), hat.getModel()));
if(!hatModels.containsKey(hat.getModel())) {
try {
Client.logger.info("STARTING > cosmeitcs > hats > model > " + hat.getModel());
ModelBuffer model = new ModelBuffer(new ResourceLocation("silentclient/models/"+ hat.getModel() + ".obj"));
if(model != null) {
hatModels.put(hat.getModel(), model);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
Client.logger.info("STARTING > cosmeitcs > shields");
shields.clear();
if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getShields() != null) {
allCosmetics.getCosmetics().getShields().forEach((shield) -> {
shields.put(shield.getId(), new ShieldData(new AnimatedResourceLocation("silentclient/cosmetics/shields/"+shield.getId(), shield.getFrames(), shield.getFrameDelay(), false, shield.getId() == Client.getInstance().getAccount().getSelectedShield()), shield.getModel()));
if(!hatModels.containsKey(shield.getModel())) {
try {
Client.logger.info("STARTING > cosmeitcs > shields > model > " + shield.getModel());
ModelBuffer model = new ModelBuffer(new ResourceLocation("silentclient/models/"+ shield.getModel() + ".obj"));
if(model != null) {
shieldModels.put(shield.getModel(), model);
}
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
Client.logger.info("STARTING > cosmeitcs > icons");
icons.clear();
if(allCosmetics != null && allCosmetics.getCosmetics() != null && allCosmetics.getCosmetics().getIcons() != null) {
allCosmetics.getCosmetics().getIcons().forEach((icon) -> {
icons.put(icon.getId(), new ResourceLocation("silentclient/cosmetics/icons/"+ icon.getId() + "/0.png"));
});
}
}
}
update(false);
}
public ModelBuffer getBandana() {
return bandana;
}
public void update(boolean async) {
Client.logger.info("Loading Player Information");
if(!async) {
PlayerResponse cosmetics = getCosmetics();
if(cosmetics != null) {
Client.getInstance().setAccount(cosmetics.getAccount());
Client.getInstance().getCosmetics().setMyCapes(cosmetics.getAccount().getCosmetics().getCapes());
Client.getInstance().getCosmetics().setMyWings(cosmetics.getAccount().getCosmetics().getWings());
Client.getInstance().getCosmetics().setMyIcons(cosmetics.getAccount().getCosmetics().getIcons());
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle");
if(Minecraft.getMinecraft().thePlayer != null) {
CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeType(cosmetics.getAccount().getCapeType());
CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeShoulders(cosmetics.getAccount().getCapeShoulders());
}
}
} else {
(new Thread("update") {
public void run() {
PlayerResponse cosmetics = getCosmetics();
if(cosmetics != null) {
Client.getInstance().setAccount(cosmetics.getAccount());
Client.getInstance().getCosmetics().setMyCapes(cosmetics.getAccount().getCosmetics().getCapes());
Client.getInstance().getCosmetics().setMyWings(cosmetics.getAccount().getCosmetics().getWings());
Client.getInstance().getCosmetics().setMyIcons(cosmetics.getAccount().getCosmetics().getIcons());
Client.getInstance().getCosmetics().setMyBandanas(cosmetics.getAccount().getCosmetics().getBandanas());
Client.getInstance().getCosmetics().setMyHats(cosmetics.getAccount().getCosmetics().getHats());
Client.getInstance().getCosmetics().setMyShields(cosmetics.getAccount().getCosmetics().getShields());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Shoulders").setValBoolean(cosmetics.getAccount().getCapeShoulders());
Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Cape Type").setValString(cosmetics.getAccount().getCapeType().equals("dynamic_curved") ? "Dynamic Curved" : cosmetics.getAccount().getCapeType().equals("curved_rectangle") ? "Curved Rectangle" : "Rectangle");
if(Minecraft.getMinecraft().thePlayer != null) {
CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeType(cosmetics.getAccount().getCapeType());
CustomAbstractClientPlayer.players.get(Minecraft.getMinecraft().thePlayer).setCapeShoulders(cosmetics.getAccount().getCapeShoulders());
}
}
}
}).start();
}
}
public void setMyCapes(ArrayList<CosmeticItem> myCapes) {
this.myCapes = myCapes;
}
public void setMyIcons(ArrayList<CosmeticItem> myIcons) {
this.myIcons = myIcons;
}
public void setMyWings(ArrayList<CosmeticItem> myWings) {
this.myWings = myWings;
}
public void setMyBandanas(ArrayList<CosmeticItem> myBandanas) {
this.myBandanas = myBandanas;
}
public void setMyHats(ArrayList<CosmeticItem> myHats) {
this.myHats = myHats;
}
public ArrayList<CosmeticItem> getMyHats() {
return myHats;
}
public void setMyShields(ArrayList<CosmeticItem> myShields) {
this.myShields = myShields;
}
public ArrayList<CosmeticItem> getMyShields() {
return myShields;
}
public static CosmeticsResponse getAllCosmetics() {
try {
URL url = new URL("https://api.silentclient.net/_next/get_cosmetics");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", "SilentClient");
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
Client.logger.info("STARTING > cosmeitcs > response: " + content.toString());
in.close();
con.disconnect();
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
CosmeticsResponse response = gson.fromJson(content.toString(), CosmeticsResponse.class);
return response;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public static PlayerResponse getCosmetics() {
try {
URL url = new URL("https://api.silentclient.net/account");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("User-Agent", "SilentClient");
con.setRequestProperty("Authorization", "Bearer " + Client.getInstance().getUserData().getAccessToken());
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
con.disconnect();
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
PlayerResponse response = gson.fromJson(content.toString(), PlayerResponse.class);
return response;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
public ResourceLocation getWingsById(int id) {
return wings.get(id);
}
public AnimatedResourceLocation getCapeById(int id) {
return capes.get(id);
}
public AnimatedResourceLocation getBandanaById(int id) {
return bandanas.get(id);
}
public HatData getHatById(int id) {;
return hats.get(id);
}
public ShieldData getShieldById(int id) {;
return shields.get(id);
}
public ResourceLocation getCapeShoulders(int id) {
return capesShoulders.get(id);
}
public ResourceLocation getIconById(int id) {
ResourceLocation icon = icons.get(id);
return icon != null ? icon : getDefaultIcon();
}
public ResourceLocation getDefaultIcon() {
return defaultIcon;
}
public ArrayList<CosmeticItem> getMyCapes() {
return myCapes;
}
public ArrayList<CosmeticItem> getMyWings() {
return myWings;
}
public ArrayList<CosmeticItem> getMyIcons() {
return myIcons;
}
public ArrayList<CosmeticItem> getMyBandanas() {
return myBandanas;
}
public static void reload(final AbstractClientPlayer player) {
Minecraft.getMinecraft().refreshResources();
Client.getInstance().getCosmetics().update(true);
Players.reload();
Players.getPlayerStatus(false, CustomAbstractClientPlayer.players.get(player).getNameClear(), EntityPlayer.getUUID(player.getGameProfile()), player);
}
}

View File

@ -0,0 +1,19 @@
package net.silentclient.client.cosmetics;
public class HatData {
private final String model;
private final AnimatedResourceLocation texture;
public HatData(AnimatedResourceLocation texture, String model) {
this.model = model;
this.texture = texture;
}
public String getModel() {
return model;
}
public AnimatedResourceLocation getTexture() {
return texture;
}
}

View File

@ -0,0 +1,262 @@
package net.silentclient.client.cosmetics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.UUID;
import javax.imageio.ImageIO;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
import net.silentclient.client.mixin.accessors.MinecraftAccessor;
import net.silentclient.client.utils.CustomAbstractClientPlayer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.item.ItemStack;
import net.silentclient.client.Client;
import net.silentclient.client.blc.BlcGlStateManager;
import net.silentclient.client.mods.settings.CosmeticsMod;
public class HatRenderer extends ModelBase implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer;
private static HashMap<UUID, Integer> uuidToHatLayer = new HashMap<UUID, Integer>();
private static HashSet<UUID> checkedUuids = new HashSet<UUID>();
public final String type;
public HatRenderer(RenderPlayer playerRendererIn, String type)
{
this.playerRenderer = playerRendererIn;
this.type = type;
}
@Override
public void doRenderLayer(AbstractClientPlayer entityIn, float p_177141_2_, float p_177141_3_,
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean() || entityIn.isInvisible()) {
return;
}
HatData data = null;
switch(type) {
case "hat":
data = CustomAbstractClientPlayer.players.get(entityIn).getHat();
break;
case "mask":
data = CustomAbstractClientPlayer.players.get(entityIn).getMask();
break;
case "neck":
data = CustomAbstractClientPlayer.players.get(entityIn).getNeck();
break;
}
if(data == null || !Client.getInstance().getCosmetics().hatModels.containsKey(data.getModel()) || !Client.getInstance().getCosmetics().hatModels.get(data.getModel()).loadModel()) {
return;
}
GlStateManager.pushMatrix();
BlcGlStateManager.t();
BlcGlStateManager.s();
BlcGlStateManager.g();
BlcGlStateManager.a(770, 771);
BlcGlStateManager.q();
BlcGlStateManager.d();
BlcGlStateManager.t();
if(entityIn.isSneaking()) {
GlStateManager.translate(0.0f, data.getModel().equals("gold_chain") ? 0.2f : 0.25f, 0.0f);
}
switch(data.getModel()) {
case "gold_chain":
if (playerRenderer.getMainModel().bipedBody.rotateAngleZ != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedBody.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
if (playerRenderer.getMainModel().bipedBody.rotateAngleY != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedBody.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (playerRenderer.getMainModel().bipedBody.rotateAngleX != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedBody.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
break;
default:
if (playerRenderer.getMainModel().bipedHead.rotateAngleZ != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleY != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
}
if (playerRenderer.getMainModel().bipedHead.rotateAngleX != 0.0F) {
GlStateManager.rotate(playerRenderer.getMainModel().bipedHead.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F);
}
break;
}
double applyTransformations = this.applyTransformations(data.getModel());
applyTransformations += this.manipulate(entityIn, data.getModel());
GlStateManager.scale(applyTransformations, applyTransformations, applyTransformations);
data.getTexture().bindTexture();
BlcGlStateManager.k();
Client.getInstance().getCosmetics().hatModels.get(data.getModel()).renderModel();
BlcGlStateManager.c();
BlcGlStateManager.u();
BlcGlStateManager.c(1029);
BlcGlStateManager.l();
BlcGlStateManager.r();
BlcGlStateManager.u();
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
data.getTexture().update(partialTicks);
}
private void runSkinProcessing(final UUID uuid, final String s) {
if (HatRenderer.checkedUuids.contains(uuid)) {
return;
}
HatRenderer.checkedUuids.add(uuid);
new Thread(new Runnable() {
@Override
public void run() {
final String substring = s;
final String string = ((MinecraftAccessor) Minecraft.getMinecraft()).getFileAssets().getAbsolutePath() + "/skins/" + substring.substring(0, 2) + "/" + s;
try {
HatRenderer.uuidToHatLayer.put(uuid, HatRenderer.findMaxHatLayer(ImageIO.read(new File(string))));
HatRenderer.checkedUuids.remove(uuid);
}
catch (final Exception ex) {
try {
Thread.sleep(1000L);
}
catch (final InterruptedException ex2) {}
HatRenderer.checkedUuids.remove(uuid);
}
}
}).start();
}
public static int findMaxHatLayer(final BufferedImage bufferedImage) {
for (int i = 8, n = 8; i < 16; ++i, --n) {
for (int j = 32; j < 64; ++j) {
if (bufferedImage.getRGB(j, i) >> 24 != 0) {
return n;
}
}
}
return 0;
}
private double applyTransformations(String model) {
GlStateManager.rotate(180.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
Vector4f rotations = new Vector4f(180.0f, 0.0f, 1.0f, 0.0f);
Vector3f translations = null;
double scale = 0.068F;
switch(model) {
case "halo":
case "halo2":
translations = new Vector3f(0.65f, 0.65f, 0.65f);
scale = 0.08f;
break;
case "cowboy":
translations = new Vector3f(0.0f, 0.5f, 0.0f);
scale = 0.0101f;
break;
case "crown":
rotations = null;
translations = new Vector3f(0.08f, 0.4f, 0.0f);
break;
case "flowersnew":
translations = new Vector3f(0.0f, 0.275f, 0.0f);
break;
}
if(rotations != null) {
GlStateManager.rotate(rotations.x, rotations.y, rotations.z, rotations.w);
}
if(translations != null) {
GlStateManager.translate(translations.x, translations.y, translations.z);
}
return scale;
}
private double manipulate(AbstractClientPlayer entity, String model) {
double n = 0.0;
ItemStack helmet = entity.getCurrentArmor(3);
ItemStack chestplate = entity.getCurrentArmor(2);
if(chestplate != null && model.equals("gold_chain")) {
return 0.018;
}
if(helmet != null) {
switch(model) {
case "sombrero":
GL11.glTranslatef(0.0f, 0.065f, 0.0f);
break;
case "cowboy":
GL11.glTranslatef(0.0f, 0.18f, 0.0f);
break;
case "crown_v2":
GL11.glTranslatef(0.0f, 0.15f, 0.0f);
break;
case "panda":
n = 0.018;
GL11.glTranslatef(0.0f, -0.1f, 0.0f);
break;
case "flowersnew":
n = 0.012;
break;
case "zekich_hat":
GL11.glTranslatef(0.0f, 0.01f, 0.0f);
break;
case "gaming_headset":
n = 0.018;
break;
}
} else {
final Integer n2 = HatRenderer.uuidToHatLayer.get(entity.getUniqueID());
if (n2 == null) {
this.runSkinProcessing(entity.getUniqueID(), entity.getLocationSkin().getResourcePath().replace("skins/", ""));
return n;
}
if (n2 == 0) {
return n;
}
switch(model) {
case "sombrero":
GL11.glTranslatef(0.0f, 0.04f, 0.0f);
break;
case "bunny_laying_hat":
GL11.glTranslatef(0.0f, -0.06f, 0.0f);
break;
case "zekich_hat":
GL11.glTranslatef(0.0f, -0.05f, 0.0f);
break;
}
}
return n;
}
@Override
public boolean shouldCombineTextures() {
return false;
}
}

View File

@ -0,0 +1,19 @@
package net.silentclient.client.cosmetics;
public class ShieldData {
private final String model;
private final AnimatedResourceLocation texture;
public ShieldData(AnimatedResourceLocation texture, String model) {
this.model = model;
this.texture = texture;
}
public String getModel() {
return model;
}
public AnimatedResourceLocation getTexture() {
return texture;
}
}

View File

@ -0,0 +1,119 @@
package net.silentclient.client.cosmetics;
import org.lwjgl.opengl.GL11;
import net.silentclient.client.cosmetics.dynamiccurved.Box;
public class StaticCape {
private final float curvePoints;
private final float horizCurve;
private final float vertCurve;
private Integer staticCloakCallList = null;
public StaticCape(float paramFloat1, float paramFloat2, float paramFloat3) {
this.curvePoints = paramFloat1;
this.horizCurve = paramFloat2;
this.vertCurve = paramFloat3;
}
public void init() {
this.staticCloakCallList = Integer.valueOf(GL11.glGenLists(1));
float f1 = 22.0F;
float f2 = 23.0F;
float f3 = 1.0F / f2;
float f4 = 17.0F / f2;
float f5 = 1.0F / f1;
float f6 = 11.0F / f1;
float f7 = 12.0F / f1;
float f8 = 22.0F / f1;
float f9 = 21.0F / f1;
Box b1 = new Box(0.0F, 0.0F, 5.0F);
Box b2 = new Box(0.0F + this.horizCurve, -16.0F + this.vertCurve, 5.0F);
Box b3 = new Box(0.0F + this.horizCurve, -16.0F + this.vertCurve, -5.0F);
Box b4 = new Box(0.0F, 0.0F, -5.0F);
Box b5 = new Box(1.0F, 0.0F, 5.0F);
Box b6 = new Box(1.0F + this.horizCurve, -16.0F + this.vertCurve, 5.0F);
Box b7 = new Box(1.0F + this.horizCurve, -16.0F + this.vertCurve, -5.0F);
Box b8 = new Box(1.0F, 0.0F, -5.0F);
Box b9 = new Box(0.0F, -10.0F, -5.0F);
Box b10 = new Box(0.0F, -10.0F, -5.0F);
GL11.glNewList(this.staticCloakCallList.intValue(), 4864);
GL11.glBegin(5);
byte b;
for (b = 0; b <= this.curvePoints; b++) {
float f10 = b / this.curvePoints;
float f11 = (1.0F - f10) * (1.0F - f10) * b7.a + 2.0F * (1.0F - f10) * f10 * b9.a + f10 * f10 * b8.a;
float f12 = (1.0F - f10) * (1.0F - f10) * b7.b + 2.0F * (1.0F - f10) * f10 * b9.b + f10 * f10 * b8.b;
GL11.glTexCoord2f(f5, f4 - (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b5.c);
GL11.glTexCoord2f(f6, f4 - (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b8.c);
}
GL11.glTexCoord2f(f5, f3);
GL11.glVertex3f(b5.a, b5.b, b5.c);
GL11.glTexCoord2f(f6, f3);
GL11.glVertex3f(b8.a, b8.b, b8.c);
GL11.glTexCoord2f(f5, 0.0F);
GL11.glVertex3f(b1.a, b1.b, b1.c);
GL11.glTexCoord2f(f6, 0.0F);
GL11.glVertex3f(b4.a, b4.b, b4.c);
for (b = 0; b <= this.curvePoints; b++) {
float f10 = b / this.curvePoints;
float f11 = (1.0F - f10) * (1.0F - f10) * b4.a + 2.0F * (1.0F - f10) * f10 * b10.a + f10 * f10 * b3.a;
float f12 = (1.0F - f10) * (1.0F - f10) * b4.b + 2.0F * (1.0F - f10) * f10 * b10.b + f10 * f10 * b3.b;
GL11.glTexCoord2f(f7, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b8.c);
f11 = (1.0F - f10) * (1.0F - f10) * b8.a + 2.0F * (1.0F - f10) * f10 * b9.a + f10 * f10 * b7.a;
f12 = (1.0F - f10) * (1.0F - f10) * b8.b + 2.0F * (1.0F - f10) * f10 * b9.b + f10 * f10 * b7.b;
GL11.glTexCoord2f(f6, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b8.c);
}
GL11.glTexCoord2f(f9, 0.0F);
GL11.glVertex3f(b7.a, b7.b, b7.c);
GL11.glTexCoord2f(f6, 0.0F);
GL11.glVertex3f(b6.a, b6.b, b6.c);
GL11.glTexCoord2f(f9, f3);
GL11.glVertex3f(b3.a, b3.b, b3.c);
GL11.glTexCoord2f(f6, f3);
GL11.glVertex3f(b2.a, b2.b, b2.c);
for (b = 0; b <= this.curvePoints; b++) {
float f10 = b / this.curvePoints;
float f11 = (1.0F - f10) * (1.0F - f10) * b3.a + 2.0F * (1.0F - f10) * f10 * b10.a + f10 * f10 * b4.a;
float f12 = (1.0F - f10) * (1.0F - f10) * b3.b + 2.0F * (1.0F - f10) * f10 * b10.b + f10 * f10 * b4.b;
GL11.glTexCoord2f(f7, f4 - (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b8.c);
GL11.glTexCoord2f(f8, f4 - (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b5.c);
}
for (b = 0; b <= this.curvePoints; b++) {
float f10 = b / this.curvePoints;
if (b == 0) {
float f13 = (1.0F - f10) * (1.0F - f10) * b4.a + 2.0F * (1.0F - f10) * f10 * b10.a + f10 * f10 * b3.a;
float f14 = (1.0F - f10) * (1.0F - f10) * b4.b + 2.0F * (1.0F - f10) * f10 * b10.b + f10 * f10 * b3.b;
GL11.glTexCoord2f(0.0F, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f13, f14, b5.c);
GL11.glTexCoord2f(0.0F, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f13, f14, b5.c);
}
float f11 = (1.0F - f10) * (1.0F - f10) * b8.a + 2.0F * (1.0F - f10) * f10 * b9.a + f10 * f10 * b7.a;
float f12 = (1.0F - f10) * (1.0F - f10) * b8.b + 2.0F * (1.0F - f10) * f10 * b9.b + f10 * f10 * b7.b;
GL11.glTexCoord2f(f5, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b5.c);
f11 = (1.0F - f10) * (1.0F - f10) * b4.a + 2.0F * (1.0F - f10) * f10 * b10.a + f10 * f10 * b3.a;
f12 = (1.0F - f10) * (1.0F - f10) * b4.b + 2.0F * (1.0F - f10) * f10 * b10.b + f10 * f10 * b3.b;
GL11.glTexCoord2f(0.0F, f3 + (f4 - f3) * f10);
GL11.glVertex3f(f11, f12, b5.c);
}
GL11.glEnd();
GL11.glEndList();
}
public void renderStaticCape() {
if (this.staticCloakCallList == null)
init();
GL11.glCallList(this.staticCloakCallList.intValue());
}
}

View File

@ -0,0 +1,46 @@
package net.silentclient.client.cosmetics.dynamiccurved;
public class Box {
public float a;
public float b;
public float c;
public Box(float f, float f1, float f2)
{
this.a = f;
this.b = f1;
this.c = f2;
}
public Box a(float f, float f1, float f2)
{
this.a = f;
this.b = f1;
this.c = f2;
return this;
}
public Box a(Box bx)
{
float f = (float)Math.sqrt((double)this.a());
return bx == null ? new Box(this.a / f, this.b / f, this.c / f) : bx.a(this.a / f, this.b / f, this.c / f);
}
public float a()
{
return this.a * this.a + this.b * this.b + this.c * this.c;
}
public static Box a(Box b1, Box b2, Box b3)
{
if (b3 == null)
{
return new Box(b1.a + b2.a, b1.b + b2.b, b1.c + b2.c);
}
else
{
b3.a(b1.a + b2.a, b1.b + b2.b, b1.c + b2.c);
return b3;
}
}
}

View File

@ -0,0 +1,250 @@
package net.silentclient.client.cosmetics.dynamiccurved;
import java.nio.FloatBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.ARBVertexBufferObject;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
public class DynamicCape {
private long COUNTER = 0L;
private long lastNanoTime = 0L;
private int vertexVbo;
private int textureVbo;
private FloatBuffer vertexBuffer = BufferUtils.createFloatBuffer(294);
private FloatBuffer textureBuffer;
private int vertexCount = 0;
private float lastHorz = 0.0F;
private float lastVert = 0.0F;
private float lastAmplitude = 0.0F;
private boolean deleted = false;
public DynamicCape() {
this.vertexBuffer.flip();
this.vertexVbo = GL15.glGenBuffers();
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.vertexVbo);
GL15.glBufferData(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) this.vertexBuffer, ARBVertexBufferObject.GL_DYNAMIC_DRAW_ARB);
this.textureBuffer = BufferUtils.createFloatBuffer(196);
this.textureBuffer.flip();
this.textureVbo = GL15.glGenBuffers();
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.textureVbo);
GL15.glBufferData(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) this.textureBuffer, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
}
public void ticks(long i) {
if (i - lastNanoTime > 16666666L) {
lastNanoTime = i;
++COUNTER;
}
}
public void update(float f, float f1, boolean flag) {
f = f / 55.0F;
float f2 = (float) COUNTER / 10.0F;
float f3 = f;
float f4 = 1.5F;
if (!this.deleted) {
if (flag || f != this.lastHorz || f1 != this.lastVert || this.lastAmplitude != f || f != 0.0F) {
this.lastAmplitude = f;
this.vertexBuffer.clear();
this.vertexCount = 0;
if (flag) {
this.textureBuffer.clear();
}
float f5 = 22.0F;
float f6 = 23.0F;
float f7 = 1.0F / f6;
float f8 = 17.0F / f6;
float f9 = 1.0F / f5;
float f10 = 11.0F / f5;
float f11 = 12.0F / f5;
float f12 = 22.0F / f5;
Box b = new Box(0.0F, 0.0F, 5.0F);
Box box1 = new Box(0.0F, -16.0F, 5.0F);
Box box2 = new Box(0.0F, -16.0F, -5.0F);
Box box3 = new Box(0.0F, 0.0F, -5.0F);
Box box4 = new Box(1.0F, 0.0F, 5.0F);
Box box5 = new Box(1.0F, -16.0F, 5.0F);
Box box6 = new Box(1.0F, -16.0F, -5.0F);
Box box7 = new Box(1.0F, 0.0F, -5.0F);
Box box8 = new Box(0.0F, -10.0F, -5.0F);
Box box9 = new Box(0.0F, -10.0F, -5.0F);
float f14 = 10.0F;
boolean flag1 = true;
float f15 = (float) Math.sin(Math.PI * (double) f4 + (double) f2) * f;
float f16 = -f15;
for (int i = 0; (float) i <= f14; ++i) {
float f17 = (float) i / f14;
float f18 = (1.0F - f17) * (1.0F - f17) * box6.a + 2.0F * (1.0F - f17) * f17 * box8.a + f17 * f17 * box7.a;
float f19 = (1.0F - f17) * (1.0F - f17) * box6.b + 2.0F * (1.0F - f17) * f17 * box8.b + f17 * f17 * box7.b;
if (flag1) {
f18 = (float) Math.sin((double) f17 * Math.PI * (double) f4 + (double) f2) * f3 + 1.0F + f16;
}
if (flag) {
this.textureBuffer.put(new float[]{f9, f8 - (f8 - f7) * f17});
this.textureBuffer.put(new float[]{f10, f8 - (f8 - f7) * f17});
}
this.vertexBuffer.put(new float[]{f18, f19, box4.c});
this.vertexBuffer.put(new float[]{f18, f19, box7.c});
this.vertexCount += 2;
}
if (flag) {
this.textureBuffer.put(new float[]{0.045454547F, 0.04347826F});
this.textureBuffer.put(new float[]{0.5F, 0.04347826F});
this.textureBuffer.put(new float[]{0.045454547F, 0.0F});
this.textureBuffer.put(new float[]{0.5F, 0.0F});
}
this.vertexBuffer.put(new float[]{box4.a, box4.b, box4.c});
this.vertexBuffer.put(new float[]{box7.a, box7.b, box7.c});
this.vertexBuffer.put(new float[]{b.a, b.b, b.c});
this.vertexBuffer.put(new float[]{box3.a, box3.b, box3.c});
this.vertexCount += 4;
for (int j = 0; (float) j <= f14; ++j) {
float f22 = (float) j / f14;
float f26 = (1.0F - f22) * (1.0F - f22) * box3.b + 2.0F * (1.0F - f22) * f22 * box9.b + f22 * f22 * box2.b;
float f23 = (float) Math.sin((double) (1.0F - f22) * Math.PI * (double) f4 + (double) f2) * f3 + f16;
if (flag) {
this.textureBuffer.put(new float[]{f11, f7 + (f8 - f7) * f22});
this.textureBuffer.put(new float[]{f10, f7 + (f8 - f7) * f22});
}
this.vertexBuffer.put(new float[]{f23, f26, box7.c});
f23 = (1.0F - f22) * (1.0F - f22) * box7.a + 2.0F * (1.0F - f22) * f22 * box8.a + f22 * f22 * box6.a;
f26 = (1.0F - f22) * (1.0F - f22) * box7.b + 2.0F * (1.0F - f22) * f22 * box8.b + f22 * f22 * box6.b;
if (flag1) {
f23 = (float) Math.sin((double) (1.0F - f22) * Math.PI * (double) f4 + (double) f2) * f3 + 1.0F + f16;
}
this.vertexBuffer.put(new float[]{f23, f26, box7.c});
this.vertexCount += 2;
}
if (flag) {
this.textureBuffer.put(new float[]{0.95454544F, 0.0F});
this.textureBuffer.put(new float[]{0.5F, 0.0F});
this.textureBuffer.put(new float[]{0.95454544F, 0.04347826F});
this.textureBuffer.put(new float[]{0.5F, 0.04347826F});
}
float f21 = 0.0F;
if (flag1) {
f21 = (float) Math.sin(0.0D * (double) f4 + (double) f2) * f3 + f16;
}
this.vertexBuffer.put(new float[]{box6.a + f21, box6.b, box6.c});
this.vertexBuffer.put(new float[]{box5.a + f21, box5.b, box5.c});
this.vertexBuffer.put(new float[]{box2.a + f21, box2.b, box2.c});
this.vertexBuffer.put(new float[]{box1.a + f21, box1.b, box1.c});
this.vertexCount += 4;
for (int k = 0; (float) k <= f14; ++k) {
float f24 = (float) k / f14;
float f27 = (1.0F - f24) * (1.0F - f24) * box2.a + 2.0F * (1.0F - f24) * f24 * box9.a + f24 * f24 * box3.a;
float f20 = (1.0F - f24) * (1.0F - f24) * box2.b + 2.0F * (1.0F - f24) * f24 * box9.b + f24 * f24 * box3.b;
if (flag1) {
f27 = (float) Math.sin((double) f24 * Math.PI * (double) f4 + (double) f2) * f3 + f16;
}
if (flag) {
this.textureBuffer.put(new float[]{f11, f8 - (f8 - f7) * f24});
this.textureBuffer.put(new float[]{f12, f8 - (f8 - f7) * f24});
}
this.vertexBuffer.put(new float[]{f27, f20, box7.c});
this.vertexBuffer.put(new float[]{f27, f20, box4.c});
this.vertexCount += 2;
}
for (int l = 0; (float) l <= f14; ++l) {
float f25 = (float) l / f14;
if (l == 0) {
float f28 = (1.0F - f25) * (1.0F - f25) * box3.a + 2.0F * (1.0F - f25) * f25 * box9.a + f25 * f25 * box2.a;
float f30 = (1.0F - f25) * (1.0F - f25) * box3.b + 2.0F * (1.0F - f25) * f25 * box9.b + f25 * f25 * box2.b;
if (flag) {
this.textureBuffer.put(new float[]{0.0F, f7 + (f8 - f7) * f25});
this.textureBuffer.put(new float[]{0.0F, f7 + (f8 - f7) * f25});
}
this.vertexBuffer.put(new float[]{f28, f30, box4.c});
this.vertexBuffer.put(new float[]{f28, f30, box4.c});
this.vertexCount += 2;
}
float f29 = (float) Math.sin((double) (1.0F - f25) * Math.PI * (double) f4 + (double) f2) * f3 + 1.0F + f16;
float f31 = (1.0F - f25) * (1.0F - f25) * box7.b + 2.0F * (1.0F - f25) * f25 * box8.b + f25 * f25 * box6.b;
if (flag) {
this.textureBuffer.put(new float[]{f9, f7 + (f8 - f7) * f25});
this.textureBuffer.put(new float[]{0.0F, f7 + (f8 - f7) * f25});
}
this.vertexBuffer.put(new float[]{f29, f31, box4.c});
f29 = (1.0F - f25) * (1.0F - f25) * box3.a + 2.0F * (1.0F - f25) * f25 * box9.a + f25 * f25 * box2.a;
f31 = (1.0F - f25) * (1.0F - f25) * box3.b + 2.0F * (1.0F - f25) * f25 * box9.b + f25 * f25 * box2.b;
if (flag1) {
f29 = (float) Math.sin((double) (1.0F - f25) * Math.PI * (double) f4 + (double) f2) * f3 + f16;
}
this.vertexBuffer.put(new float[]{f29, f31, box4.c});
this.vertexCount += 2;
}
this.vertexBuffer.flip();
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.vertexVbo);
GL15.glBufferData(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) this.vertexBuffer, ARBVertexBufferObject.GL_DYNAMIC_DRAW_ARB);
if (flag) {
this.textureBuffer.flip();
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.textureVbo);
GL15.glBufferData(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, (FloatBuffer) this.textureBuffer, ARBVertexBufferObject.GL_STATIC_DRAW_ARB);
}
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
this.lastHorz = f;
this.lastVert = f1;
}
}
}
public void renderDynamicCape() {
if (!this.deleted) {
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.vertexVbo);
GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0L);
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, this.textureVbo);
GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0L);
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, this.vertexCount);
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
GL15.glBindBuffer(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0);
}
}
public void deleteData() {
this.deleted = true;
GL15.glDeleteBuffers(this.vertexVbo);
GL15.glDeleteBuffers(this.textureVbo);
}
}

View File

@ -0,0 +1,489 @@
package net.silentclient.client.cosmetics.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.clickgui.TabButton;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils.Scroll;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.Sounds;
import net.silentclient.client.utils.types.PlayerResponse.Account.Cosmetics.CosmeticItem;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
public class CosmeticsGui extends SilentScreen {
public static double scrollY;
public static SimpleAnimation scrollAnimation = new SimpleAnimation(0.0F);
public static String selectedCategory = "capes";
private int rotate = 0;
@Override
public void initGui() {
rotate = 144;
if(mc.thePlayer == null) {
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
}
this.silentInputs.add(new Input("Search"));
CosmeticsGui.scrollY = 0;
CosmeticsGui.selectedCategory = "capes";
MenuBlurUtils.loadBlur();
Client.getInstance().getCosmetics().update(true);
int categoryOffsetY = 25;
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int height = addY * 2;
int tabId = 1;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Capes", selectedCategory == "capes"));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Wings", selectedCategory == "wings"));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Bandanas", selectedCategory == "bandanas"));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Hats", selectedCategory == "hats"));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Shields", selectedCategory == "shields"));
categoryOffsetY +=20;
tabId++;
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Icons", selectedCategory == "icons"));
tabId++;
this.buttonList.add(new Button(tabId, x + 5, (y + height) - 26, 75, 20, "Store"));
}
@Override
public void onGuiClosed() {
if(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Background Blur").getValBoolean()) {
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
}
super.onGuiClosed();
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button instanceof TabButton) {
TabButton tab = (TabButton) button;
switch (tab.id) {
case 1:
selectedCategory = "capes";
rotate = 144;
break;
case 2:
selectedCategory = "wings";
rotate = 144;
break;
case 3:
selectedCategory = "bandanas";
rotate = 340;
break;
case 4:
selectedCategory = "hats";
rotate = 340;
break;
case 5:
selectedCategory = "shields";
rotate = 340;
break;
case 6:
selectedCategory = "icons";
break;
}
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof TabButton) {
TabButton tabB = (TabButton) oldButton;
tabB.selected = false;
}
});
this.silentInputs.get(0).setValue("");
tab.selected = true;
scrollY = 0;
}
if(button.id == 7) {
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();
}
}
}
private ArrayList<CosmeticItem> getItems() {
ArrayList<CosmeticItem> items;
ArrayList<CosmeticItem> searchItems = new ArrayList<>();
if(selectedCategory == "capes") {
items = Client.getInstance().getCosmetics().getMyCapes();
} else if(selectedCategory == "wings") {
items = Client.getInstance().getCosmetics().getMyWings();
} else if(selectedCategory == "bandanas") {
items = Client.getInstance().getCosmetics().getMyBandanas();
} else if(selectedCategory == "hats") {
items = Client.getInstance().getCosmetics().getMyHats();
} else if(selectedCategory == "shields") {
items = Client.getInstance().getCosmetics().getMyShields();
} else {
items = Client.getInstance().getCosmetics().getMyIcons();
}
if(this.silentInputs.get(0).getValue().trim().equals("")) {
return items;
} else {
for(CosmeticItem item : items) {
if(item.getName().trim().toLowerCase().contains(this.silentInputs.get(0).getValue().toLowerCase().trim())) {
searchItems.add(item);
}
}
return searchItems;
}
}
private ArrayList<Number> getFavoriteItems() {
ArrayList<Number> items;
if(selectedCategory == "capes") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().capes;
} else if(selectedCategory == "wings") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().wings;
} else if(selectedCategory == "bandanas") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().bandanas;
} else if(selectedCategory == "hats") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().hats;
} else if(selectedCategory == "shields") {
items = Client.getInstance().getAccount().getFavoriteCosmetics().shields;
} else {
items = Client.getInstance().getAccount().getFavoriteCosmetics().icons;
}
return items;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
if(mc.thePlayer == null) {
GlStateManager.disableAlpha();
Client.backgroundPanorama.renderSkybox(mouseX, mouseY, partialTicks);
GlStateManager.enableAlpha();
this.drawGradientRect(0, 0, this.width, this.height, 0, Integer.MIN_VALUE);
} else {
super.drawDefaultBackground();
}
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int height = addY * 2;
int modOffsetY = 25;
int modIndex = 1;
//Draw background
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
ArrayList<CosmeticItem> items = null;
ArrayList<Number> selected_item = new ArrayList<>();
boolean can_show = true;
String error_text = "";
items = getItems();
selected_item.clear();
if(selectedCategory == "capes") {
selected_item.add(Client.getInstance().getAccount().getSelectedCape());
can_show = Client.getInstance().getAccount().customCape() ? false : Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean();
error_text = Client.getInstance().getAccount().customCape() ? "Please disable Custom Cape in Silent+ settings" : Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean() ? "" : "Please enable Capes in the cosmetics settings";
} else if(selectedCategory == "wings") {
selected_item.add(Client.getInstance().getAccount().getSelectedWings());
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean();
error_text = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean() ? "" : "Please enable Wings in the cosmetics settings";
} else if(selectedCategory == "bandanas") {
selected_item.add(Client.getInstance().getAccount().getSelectedBandana());
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean();
error_text = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean() ? "" : "Please enable Bandanas in the cosmetics settings";
} else if(selectedCategory == "hats") {
selected_item.add(Client.getInstance().getAccount().getSelectedHat());
selected_item.add(Client.getInstance().getAccount().getSelectedMask());
selected_item.add(Client.getInstance().getAccount().getSelectedNeck());
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean();
error_text = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean() ? "" : "Please enable Hats in the cosmetics settings";
} else if(selectedCategory == "shields") {
selected_item.add(Client.getInstance().getAccount().getSelectedShield());
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Shields").getValBoolean();
error_text = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Shields").getValBoolean() ? "" : "Please enable Shields in the cosmetics settings";
} else {
selected_item.add(Client.getInstance().getAccount().getSelectedIcon());
can_show = Client.getInstance().getAccount().plusIcon() ? false : true;
error_text = Client.getInstance().getAccount().plusIcon() ? "Please disable Plus Nametag Icon in Silent+ settings" : "";
}
if(can_show) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
ScaledResolution r = new ScaledResolution(mc);
int s = r.getScaleFactor();
int translatedY = r.getScaledHeight() - (y + 25) - (height - 25);
GL11.glScissor(x * s, translatedY * s, width * s, (height - 25) * s);
if(items != null) {
for(CosmeticItem m : items) {
RoundedUtils.drawRoundedOutline(x + 100, y + modOffsetY + scrollAnimation.getValue(), x + 100 + 135, y + modOffsetY + scrollAnimation.getValue() + 28, 10, 2, selected_item.contains(m.getId()) ? new Color(32, 252, 3).getRGB() : new Color(252, 3, 3).getRGB());
GL11.glDisable((int) 2929);
GL11.glEnable((int) 3042);
GL11.glDepthMask((boolean) false);
OpenGlHelper.glBlendFunc((int) 770, (int) 771, (int) 1, (int) 0);
GL11.glColor4f((float) 1.0f, (float) 1.0f, (float) 1.0f, 1f);
GL11.glDepthMask((boolean) true);
GL11.glDisable((int) 3042);
GL11.glEnable((int) 2929);
Client.getInstance().getSilentFontRenderer().drawString(m.getName(), x + 110, y + modOffsetY + 10 + (int) scrollAnimation.getValue() - 3, 14, SilentFontRenderer.FontType.TITLE, 100);
boolean favorite = false;
for(Number i : getFavoriteItems()) {
if(i.intValue() == m.getId()) {
favorite = true;
}
}
RenderUtil.drawImage(favorite ? new ResourceLocation("silentclient/icons/star.png") : new ResourceLocation("silentclient/icons/star_outline.png"), x + 100 + 120, y + modOffsetY + scrollAnimation.getValue() + 8, 12, 12, false);
modOffsetY+= 35;
modIndex += 1;
}
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GL11.glPopMatrix();
RenderUtil.drawImage(new ResourceLocation("silentclient/transparent.png"), x, y, 30, 30, false);
if(mc.thePlayer != null && selectedCategory != "icons") {
drawEntityOnScreen(x + 310, y + 175, 60, 1, 1, mc.thePlayer, rotate);
boolean drag = MouseUtils.isInside(mouseX, mouseY, x + 265, y + 50, 90, 150) && Mouse.isButtonDown(0);
if (drag) {
double diff = 360 - 0;
double mouse = MathHelper.clamp_double((mouseX - (x + 265)) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
rotate = (int) newVal;
}
}
}
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
Client.getInstance().getSilentFontRenderer().drawString("Cosmetics", x + 100, (int) (y + 5), 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
RenderUtil.drawRoundedOutline(x + 5, (y + height) - 26, x + 5 + 75, ((y + height) - 26) + 20, 5, 2, -1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Client.getInstance().getSilentFontRenderer().drawCenteredString("Store", x + 5 + (75 / 2), ((y + height) - 20) - 3, 14, SilentFontRenderer.FontType.TITLE);
if(mc.thePlayer == null && can_show && selectedCategory != "icons") {
Client.getInstance().getSilentFontRenderer().drawString("Preview not available", x + 100 + 160, y + 100 - 3, 14, SilentFontRenderer.FontType.TITLE);
}
if(!can_show) {
Client.getInstance().getSilentFontRenderer().drawString(error_text, x + ((width - 90) / 2) - 15, y + (height / 3) + 20 - 3, 14, SilentFontRenderer.FontType.TITLE);
}
if(selectedCategory == "icons" && can_show) {
RenderUtil.drawImage(Client.getInstance().getAccount().getSelectedIcon() != 0 && !Client.getInstance().getAccount().plusIcon() ? Client.getInstance().getCosmetics().getIconById(Client.getInstance().getAccount().getSelectedIcon()) : new ResourceLocation(Client.getInstance().getAccount().plusIcon() ? "silentclient/icons/plus_icon.png" : "silentclient/icons/player_icon.png"), x + 285, y + ((height / 2) - 25), 50, 50, false);
}
final Scroll scroll = MouseUtils.scroll();
if(scroll != null) {
switch (scroll) {
case DOWN:
if(scrollY > -((modIndex - 5.5) * 38)) {
scrollY -=20;
}
if(modIndex > 5) {
if(scrollY < -((modIndex - 7) * 38)) {
scrollY = -((modIndex - 6.1) * 38);
}
}
break;
case UP:
if(scrollY < -10) {
scrollY +=20;
}else {
if(modIndex > 5) {
scrollY = 0;
}
}
break;
}
}
if(can_show) {
this.silentInputs.get(0).render(mouseX, mouseY, x + width - 140, y + 2, 135);
}
scrollAnimation.setAnimation((float) scrollY, 16);
}
public void updateScreen()
{
Client.backgroundPanorama.tickPanorama();
}
public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent, int rotate)
{
GlStateManager.enableColorMaterial();
GlStateManager.pushMatrix();
GlStateManager.translate((float)posX, (float)posY, 50.0F);
GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(rotate, 0.0F, 1.0F, 0.0F);
float f = ent.renderYawOffset;
float f1 = ent.rotationYaw;
float f2 = ent.rotationPitch;
float f3 = ent.prevRotationYawHead;
float f4 = ent.rotationYawHead;
GlStateManager.rotate(135.0F, 0, 1.0F, 0.0F);
GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
ent.rotationYawHead = ent.rotationYaw;
ent.prevRotationYawHead = ent.rotationYaw;
GlStateManager.translate(0.0F, 0.0F, 0.0F);
RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
rendermanager.setPlayerViewY(180.0F);
rendermanager.setRenderShadow(false);
rendermanager.renderEntityWithPosYaw(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
rendermanager.setRenderShadow(true);
ent.renderYawOffset = f;
ent.rotationYaw = f1;
ent.rotationPitch = f2;
ent.prevRotationYawHead = f3;
ent.rotationYawHead = f4;
GlStateManager.popMatrix();
GlStateManager.disableLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.disableTexture2D();
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int modOffsetY = 25;
ArrayList<CosmeticItem> items = getItems();
boolean can_show = true;
if(selectedCategory == "capes") {
can_show = Client.getInstance().getAccount().customCape() ? false : Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean();
} else if(selectedCategory == "wings") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean();
} else if(selectedCategory == "bandanas") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean();
} else if(selectedCategory == "hats") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean();
}else if(selectedCategory == "shields") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Shields").getValBoolean();
} else {
can_show = Client.getInstance().getAccount().plusIcon() ? false : true;
}
if(items != null && can_show) {
this.silentInputs.get(0).onClick(mouseX, mouseY, x + width - 140, y + 2, 135);
for(CosmeticItem m : items) {
if(MouseUtils.isInside(mouseX, mouseY, x + 100 + 120, y + modOffsetY + scrollAnimation.getValue() + 8, 12, 12)) {
Client.getInstance().getAccount().updateFavorite(m.getId(), selectedCategory);
} else if(MouseUtils.isInside(mouseX, mouseY,x + 100, y + modOffsetY + scrollAnimation.getValue(), 135, 28) && mouseButton == 0) {
Sounds.playButtonSound();
if(selectedCategory == "capes") {
Client.getInstance().getAccount().setSelectedCape(m.getId());
} else if(selectedCategory == "wings") {
Client.getInstance().getAccount().setSelectedWings(m.getId());
} else if(selectedCategory == "bandanas") {
Client.getInstance().getAccount().setSelectedBandana(m.getId());
} else if(selectedCategory == "hats") {
Client.getInstance().getAccount().setSelectedHat(m.getId(), m.getModel().equals("gold_chain") ? "neck" : m.getModel().equals("facemask") ? "mask" : "hat");
} else if(selectedCategory == "shields") {
Client.getInstance().getAccount().setSelectedShield(m.getId());
} else {
Client.getInstance().getAccount().setSelectedIcon(m.getId());
}
}
modOffsetY+= 35;
}
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
super.keyTyped(typedChar, keyCode);
boolean can_show = true;
if(selectedCategory == "capes") {
can_show = Client.getInstance().getAccount().customCape() ? false : Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Capes").getValBoolean();
} else if(selectedCategory == "wings") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean();
} else if(selectedCategory == "bandanas") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Bandanas").getValBoolean();
} else if(selectedCategory == "hats") {
can_show = Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Hats").getValBoolean();
} else {
can_show = Client.getInstance().getAccount().plusIcon() ? false : true;
}
if(can_show) {
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
}
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
}

View File

@ -0,0 +1,70 @@
package net.silentclient.client.cosmetics.model;
public class Face
{
private final int[] vertexIndices;
private final int[] normalIndices;
private final int[] textureCoordinateIndices;
private Material material;
public Material getMaterial() {
return this.material;
}
public boolean hasNormals() {
return this.normalIndices[0] != -1;
}
public boolean hasTextureCoordinates() {
return this.textureCoordinateIndices[0] != -1;
}
public int[] getVertexIndices() {
return this.vertexIndices;
}
public int[] getTextureCoordinateIndices() {
return this.textureCoordinateIndices;
}
public int[] getNormalIndices() {
return this.normalIndices;
}
public Face(final int[] array) {
this.vertexIndices = new int[] { -1, -1, -1, -1 };
this.normalIndices = new int[] { -1, -1, -1, -1 };
this.textureCoordinateIndices = new int[] { -1, -1, -1, -1 };
this.vertexIndices[0] = array[0];
this.vertexIndices[1] = array[1];
this.vertexIndices[2] = array[2];
}
public Face(final int[] array, final int[] array2) {
this.vertexIndices = new int[] { -1, -1, -1, -1 };
this.normalIndices = new int[] { -1, -1, -1, -1 };
this.textureCoordinateIndices = new int[] { -1, -1, -1, -1 };
this.vertexIndices[0] = array[0];
this.vertexIndices[1] = array[1];
this.vertexIndices[2] = array[2];
this.normalIndices[0] = array2[0];
this.normalIndices[1] = array2[1];
this.normalIndices[2] = array2[2];
}
public Face(final int[] array, final int[] array2, final int[] array3, final Material material) {
this.vertexIndices = new int[] { -1, -1, -1, -1 };
this.normalIndices = new int[] { -1, -1, -1, -1 };
this.textureCoordinateIndices = new int[] { -1, -1, -1, -1 };
this.vertexIndices[0] = array[0];
this.vertexIndices[1] = array[1];
this.vertexIndices[2] = array[2];
this.textureCoordinateIndices[0] = array3[0];
this.textureCoordinateIndices[1] = array3[1];
this.textureCoordinateIndices[2] = array3[2];
this.normalIndices[0] = array2[0];
this.normalIndices[1] = array2[1];
this.normalIndices[2] = array2[2];
this.material = material;
}
}

View File

@ -0,0 +1,5 @@
package net.silentclient.client.cosmetics.model;
public class Material {
}

View File

@ -0,0 +1,52 @@
package net.silentclient.client.cosmetics.model;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.List;
public class Model
{
private String name;
private List<ModelBuffer.Vertex3f> vertices;
private List<ModelBuffer.Vertex2f> textureCoordinates;
private List<ModelBuffer.Vertex3f> normals;
private List<Face> faces;
private Map<String, Material> materials;
public Model() {
this.vertices = new ArrayList<ModelBuffer.Vertex3f>();
this.textureCoordinates = new ArrayList<ModelBuffer.Vertex2f>();
this.normals = new ArrayList<ModelBuffer.Vertex3f>();
this.faces = new ArrayList<Face>();
this.materials = new HashMap<String, Material>();
}
public void setName(final String name) {
this.name = name;
}
public String getName() {
return name;
}
public List<ModelBuffer.Vertex3f> getVertices() {
return this.vertices;
}
public List<ModelBuffer.Vertex2f> getTextureCoordinates() {
return this.textureCoordinates;
}
public List<ModelBuffer.Vertex3f> getNormals() {
return this.normals;
}
public List<Face> getFaces() {
return this.faces;
}
public Map<String, Material> getMaterials() {
return this.materials;
}
}

View File

@ -0,0 +1,221 @@
package net.silentclient.client.cosmetics.model;
import java.nio.FloatBuffer;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import net.minecraft.util.ResourceLocation;
public class ModelBuffer
{
private static final ExecutorService EXECUTOR_SERVICE;
private final ResourceLocation location;
private final boolean flipUVs;
private Model model;
private Integer bufferId;
private Future<FutureResult> loaded;
private int totalVertices;
public ModelBuffer(final ResourceLocation aj) {
this(aj, false);
}
public ModelBuffer(final ResourceLocation location, final boolean flipUVs) {
this.location = location;
this.flipUVs = flipUVs;
}
public boolean loadModel() {
if (this.isLoaded()) {
return true;
}
if (this.loaded != null && this.loaded.isDone()) {
FloatBuffer access$000;
try {
final FutureResult futureResult = this.loaded.get();
access$000 = futureResult.getBuffer();
this.model = futureResult.getModel();
this.totalVertices = futureResult.getTotalVertices();
}
catch (final Exception cause) {
throw new RuntimeException(cause);
}
this.bufferId = GL15.glGenBuffers();
GL15.glBindBuffer(34962, (int)this.bufferId);
GL15.glBufferData(34962, access$000, 35044);
GL15.glBindBuffer(34962, 0);
return true;
}
if (this.model == null && this.loaded == null) {
this.loaded = ModelBuffer.EXECUTOR_SERVICE.submit((Callable<FutureResult>)new Callable<FutureResult>() {
@Override
public FutureResult call() {
final Model loadModel = ModelLoader.loadModel(ModelBuffer.this.location, ModelBuffer.this.flipUVs);
final int n = loadModel.getFaces().size() * 3;
final FloatBuffer floatBuffer = BufferUtils.createFloatBuffer(n * 8);
for (final Face face : loadModel.getFaces()) {
final Vertex3f[] array = { loadModel.getNormals().get(face.getNormalIndices()[0] - 1), loadModel.getNormals().get(face.getNormalIndices()[1] - 1), loadModel.getNormals().get(face.getNormalIndices()[2] - 1) };
final Vertex2f[] array2 = { loadModel.getTextureCoordinates().get(face.getTextureCoordinateIndices()[0] - 1), loadModel.getTextureCoordinates().get(face.getTextureCoordinateIndices()[1] - 1), loadModel.getTextureCoordinates().get(face.getTextureCoordinateIndices()[2] - 1) };
final Vertex3f[] array3 = { loadModel.getVertices().get(face.getVertexIndices()[0] - 1), loadModel.getVertices().get(face.getVertexIndices()[1] - 1), loadModel.getVertices().get(face.getVertexIndices()[2] - 1) };
for (int i = 0; i < 3; ++i) {
floatBuffer.put(new float[] { array3[i].getX(), array3[i].getY(), array3[i].getZ() });
floatBuffer.put(new float[] { array2[i].getX(), array2[i].getY() });
floatBuffer.put(new float[] { array[i].getX(), array[i].getY(), array[i].getZ() });
}
}
floatBuffer.flip();
return new FutureResult(loadModel, floatBuffer, n);
}
});
}
return false;
}
public void renderModel() {
if (!this.isLoaded()) {
this.loadModel();
}
else {
GL15.glBindBuffer(34962, (int)this.bufferId);
GL11.glVertexPointer(3, 5126, 32, 0L);
GL11.glEnableClientState(32884);
GL11.glTexCoordPointer(2, 5126, 32, 12L);
GL11.glEnableClientState(32888);
GL11.glNormalPointer(5126, 32, 20L);
GL11.glEnableClientState(32885);
GL11.glDrawArrays(4, 0, this.totalVertices);
GL11.glDisableClientState(32884);
GL11.glDisableClientState(32888);
GL11.glDisableClientState(32885);
GL15.glBindBuffer(34962, 0);
}
}
public void deleteData() {
if (this.loaded != null) {
if (this.loaded.isDone()) {
GL15.glDeleteBuffers((int)this.bufferId);
}
else {
this.loaded.cancel(true);
}
}
this.bufferId = null;
this.model = null;
this.loaded = null;
}
private boolean isLoaded() {
return this.bufferId != null;
}
static {
EXECUTOR_SERVICE = Executors.newSingleThreadExecutor();
}
public static class Vertex2f
{
public float x;
public float y;
public Vertex2f(final float n, final float n2) {
this.set(n, n2);
}
public void set(final float x, final float y) {
this.x = x;
this.y = y;
}
public float getX() {
return this.x;
}
public float getY() {
return this.y;
}
public void setX(final float x) {
this.x = x;
}
public void setY(final float y) {
this.y = y;
}
}
public static class Vertex3f
{
public float x;
public float y;
public float z;
public Vertex3f() {
}
public Vertex3f(final float n, final float n2, final float n3) {
this.set(n, n2, n3);
}
public void set(final float x, final float y, final float z) {
this.x = x;
this.y = y;
this.z = z;
}
public float getX() {
return this.x;
}
public void setX(final float x) {
this.x = x;
}
public float getY() {
return this.y;
}
public void setY(final float y) {
this.y = y;
}
public float getZ() {
return this.z;
}
public void setZ(final float z) {
this.z = z;
}
}
private static class FutureResult
{
private Model model;
private FloatBuffer buffer;
private int totalVertices;
private FutureResult(final Model model, final FloatBuffer buffer, final int totalVertices) {
this.model = model;
this.buffer = buffer;
this.totalVertices = totalVertices;
}
private Model getModel() {
return this.model;
}
private FloatBuffer getBuffer() {
return this.buffer;
}
private int getTotalVertices() {
return this.totalVertices;
}
}
}

View File

@ -0,0 +1,97 @@
package net.silentclient.client.cosmetics.model;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
public class ModelLoader
{
private static ModelBuffer.Vertex2f parseTextureCoord(final String s, final boolean b) {
final String[] split = s.split(" ");
final float floatValue = Float.valueOf(split[1]);
final float floatValue2 = Float.valueOf(split[2]);
return new ModelBuffer.Vertex2f(floatValue, b ? (1.0f - floatValue2) : floatValue2);
}
private static ModelBuffer.Vertex3f parseVertex(final String s) {
final String[] split = s.split(" ");
return new ModelBuffer.Vertex3f(Float.valueOf(split[1]), Float.valueOf(split[2]), Float.valueOf(split[3]));
}
private static ModelBuffer.Vertex3f parseNormal(final String s) {
final String[] split = s.split(" ");
return new ModelBuffer.Vertex3f(Float.valueOf(split[1]), Float.valueOf(split[2]), Float.valueOf(split[3]));
}
private static Face parseFace(final boolean b, final boolean b2, final String s) {
final String[] split = s.split(" ");
final int[] array = { Integer.parseInt(split[1].split("/")[0]), Integer.parseInt(split[2].split("/")[0]), Integer.parseInt(split[3].split("/")[0]) };
if (b2) {
return new Face(array, new int[] { Integer.parseInt(split[1].split("/")[2]), Integer.parseInt(split[2].split("/")[2]), Integer.parseInt(split[3].split("/")[2]), 0 }, new int[] { Integer.parseInt(split[1].split("/")[1]), Integer.parseInt(split[2].split("/")[1]), Integer.parseInt(split[3].split("/")[1]), 0 }, null);
}
if (b) {
return new Face(array, new int[] { Integer.parseInt(split[1].split("/")[2]), Integer.parseInt(split[2].split("/")[2]), Integer.parseInt(split[3].split("/")[2]), 0 });
}
return new Face(array);
}
public static Model loadModel(final ResourceLocation aj) {
return loadModel(aj, false);
}
public static Model loadModel(final ResourceLocation aj, final boolean b) {
InputStream a = null;
try {
a = Minecraft.getMinecraft().getResourceManager().getResource(aj).getInputStream();
final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(a));
final Model model = new Model();
String line;
while ((line = bufferedReader.readLine()) != null) {
final String s = line.split(" ")[0];
if (!s.equals("#")) {
if (line.startsWith("#")) {
continue;
}
if (s.equals("o")) {
model.setName(line.split(" ")[1]);
}
else if (s.equals("v")) {
model.getVertices().add(parseVertex(line));
}
else if (s.equals("vn")) {
model.getNormals().add(parseNormal(line));
}
else if (s.equals("f")) {
model.getFaces().add(parseFace(model.getNormals().size() > 0, model.getTextureCoordinates().size() > 0, line));
}
else {
if (!s.equals("vt")) {
continue;
}
model.getTextureCoordinates().add(parseTextureCoord(line, b));
}
}
}
bufferedReader.close();
return model;
}
catch (final Exception ex) {
ex.printStackTrace();
Client.logger.error("MODEL LOADER ERROR: " + ex.getMessage());
}
finally {
if (a != null) {
try {
a.close();
}
catch (final IOException ex2) {}
}
}
return null;
}
}

View File

@ -0,0 +1,116 @@
package net.silentclient.client.cosmetics.wings;
import net.silentclient.client.mixin.accessors.ModelBaseAccessor;
import net.silentclient.client.utils.CustomAbstractClientPlayer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.Entity;
import net.silentclient.client.Client;
import net.silentclient.client.mods.settings.CosmeticsMod;
public class WingsModel implements LayerRenderer<AbstractClientPlayer> {
private static ModelRenderer wing;
private static ModelRenderer wingTip;
boolean flying;
private final ModelDragonWings modelDragonWings;
public WingsModel(RenderPlayer player) {
this.flying = false;
((ModelBaseAccessor) (this.modelDragonWings = new ModelDragonWings(player))).setTextureOffset("wingTip.bone", 112, 136);
((ModelBaseAccessor) this.modelDragonWings).setTextureOffset("wing.skin", -56, 88);
((ModelBaseAccessor) this.modelDragonWings).setTextureOffset("wing.bone", 112, 88);
((ModelBaseAccessor) this.modelDragonWings).setTextureOffset("wingTip.skin", -56, 144);
final int bw = this.modelDragonWings.textureWidth;
final int bh = this.modelDragonWings.textureHeight;
this.modelDragonWings.textureWidth = 256;
this.modelDragonWings.textureHeight = 256;
(wing = new ModelRenderer(this.modelDragonWings, "wing")).setRotationPoint(-12.0f, 5.0f, 2.0f);
wing.addBox("bone", -56.0f, -4.0f, -4.0f, 56, 8, 8);
wing.addBox("skin", -56.0f, 0.0f, 2.0f, 56, 0, 56);
wing.isHidden = true;
(wingTip = new ModelRenderer(this.modelDragonWings, "wingTip")).setRotationPoint(-56.0f, 0.0f, 0.0f);
wingTip.isHidden = true;
wingTip.addBox("bone", -56.0f, -2.0f, -2.0f, 56, 4, 4);
wingTip.addBox("skin", -56.0f, 0.0f, 2.0f, 56, 0, 56);
wing.addChild(wingTip);
this.modelDragonWings.textureWidth = bw;
this.modelDragonWings.textureWidth = bh;
}
private class ModelDragonWings extends ModelBase {
public ModelDragonWings(RenderPlayer player) {
// TODO Auto-generated constructor stub
}
@Override
public void render(final Entity entityIn, final float limbSwing, final float limbSwingAmount, final float ageInTicks, final float netHeadYaw, final float headPitch, final float scale) {
super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
GlStateManager.pushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
GlStateManager.scale(Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings Scale").getValDouble(), Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings Scale").getValDouble(), Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings Scale").getValDouble());
float f1 = 0.0f;
if (Minecraft.getMinecraft().thePlayer.capabilities.isFlying) {
f1 = ageInTicks / 200.0f;
}
else {
f1 = ageInTicks / 80.0f;
}
Minecraft.getMinecraft().getTextureManager().bindTexture(CustomAbstractClientPlayer.players.get(entityIn).getLocationOfWings());
if (!entityIn.onGround || flying) {
flying = true;
}
GlStateManager.scale(0.15, 0.15, 0.15);
GlStateManager.translate(0.0, -0.3, 1.1);
if(entityIn.isSneaking()) {
GlStateManager.translate(-0.04F, 1.1F + 0.2F, -0.04F);
}
GlStateManager.rotate(50.0f, -50.0f, 0.0f, 0.0f);
for (int i = 0; i < 2; ++i) {
final float f2 = f1 * 9.141593f * 2.0f;
wing.rotateAngleX = 0.125f - (float)Math.cos(f2) * 0.2f;
wing.rotateAngleY = 0.25f;
wing.rotateAngleZ = (float)(Math.sin(f2) + 1.225) * 0.3f;
wingTip.rotateAngleZ = -(float)(Math.sin(f2 + 2.0f) + 0.5) * 0.75f;
wing.isHidden = false;
wingTip.isHidden = false;
if (!entityIn.isInvisible()) {
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
wing.render(scale);
GlStateManager.popMatrix();
}
wing.isHidden = false;
wingTip.isHidden = false;
if (i == 0) {
GlStateManager.scale(-1.0f, 1.0f, 1.0f);
}
}
GlStateManager.popMatrix();
}
}
@Override
public boolean shouldCombineTextures() {
return false;
}
@Override
public void doRenderLayer(final AbstractClientPlayer player, final float limbSwing, final float limbSwingAmount, final float partialTicks, final float ageInTicks, final float HeadYaw, final float headPitch, final float scale) {
if (CustomAbstractClientPlayer.players.get(player).getLocationOfWings() != null && Client.getInstance().getSettingsManager().getSettingByClass(CosmeticsMod.class, "Wings").getValBoolean()) {
if (!player.isInvisible()) {
GlStateManager.pushMatrix();
this.modelDragonWings.render(player, limbSwing, limbSwingAmount, ageInTicks, HeadYaw, headPitch, scale);
this.modelDragonWings.setRotationAngles(scale, limbSwing, limbSwingAmount, ageInTicks, HeadYaw, headPitch, player);
GL11.glPopMatrix();
}
}
}
}

View File

@ -0,0 +1,63 @@
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.font.SilentFontRenderer;
public class GuiError extends GuiScreen {
private final String error;
public GuiError(String error) {
this.error = error;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
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);
Client.getInstance().getSilentFontRenderer().drawString("Error", (this.width / 2) - (Client.getInstance().getSilentFontRenderer().getStringWidth("Error", 14, SilentFontRenderer.FontType.HEADER) / 2), this.height / 3 - 3, 14, SilentFontRenderer.FontType.HEADER);
Client.getInstance().getSilentFontRenderer().drawString(error, (this.width / 2) - (Client.getInstance().getSilentFontRenderer().getStringWidth(error, 14, SilentFontRenderer.FontType.TITLE) / 2), this.height / 2 - 3, 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
public void initGui() {
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
this.buttonList.add(new Button(1, (this.width / 2) - (98 / 2), this.height - 30, 98, 20, "Quit Game"));
super.initGui();
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(button.id == 1) {
this.mc.shutdown();
}
}
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;
}
}

View File

@ -0,0 +1,50 @@
package net.silentclient.client.gui;
import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiScreenServerList;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.resources.I18n;
import net.silentclient.client.mixin.accessors.GuiMultiplayerAccessor;
public class GuiMultiplayerInGame extends GuiMultiplayer {
public GuiMultiplayerInGame(GuiScreen parentScreen) {
super(parentScreen);
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(button.id == 1) {
disconnect();
}
if(button.id == 4) {
((GuiMultiplayerAccessor) this).setDirectConnect(true);
((GuiMultiplayerAccessor) this).setSelectedServer(new ServerData(I18n.format("selectServer.defaultName", new Object[0]), "", false));
this.mc.displayGuiScreen(new GuiScreenServerList(this, ((GuiMultiplayerAccessor) this).getSelectedServer()));
}
super.actionPerformed(button);
}
@Override
public void connectToSelected() {
disconnect();
super.connectToSelected();
}
private void disconnect() {
if(this.mc.theWorld != null) {
this.mc.theWorld.sendQuittingDisconnectingPacket();
this.mc.loadWorld(null);
this.mc.displayGuiScreen(null);
((GuiMultiplayerAccessor) this).setParentScreen(null);
}
}
}

View File

@ -0,0 +1,99 @@
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.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.minecraft.GuiMainMenu;
import net.silentclient.client.gui.util.RenderUtil;
public class GuiNews extends GuiScreen {
private TimerUtils logoTimer = new TimerUtils();
private int logoY = 0;
private final boolean firstTime;
public GuiNews() {
this.firstTime = false;
}
public GuiNews(boolean firstTime) {
this.firstTime = firstTime;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
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);
super.drawScreen(mouseX, mouseY, partialTicks);
if(firstTime) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
mc.getTextureManager().bindTexture(new ResourceLocation("silentclient/splash.png"));
Gui.drawScaledCustomSizeModalRect(0, logoY, 0, 0, 1920, 1080, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), 1920, 1080);
if (this.logoY > -scaledResolution.getScaledHeight() && logoTimer.delay(1)) {
this.logoY -= 30;
logoTimer.reset();
}
}
}
@Override
public void initGui() {
Client.backgroundPanorama.updateWidthHeight(this.width, this.height);
this.buttonList.add(new Button(1, (this.width / 2) - (98 / 2), this.height - 30, 98, 20, "Exit"));
super.initGui();
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(button.id == 1) {
mc.displayGuiScreen(new GuiMainMenu());
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
if(MouseUtils.isInside(mouseX, mouseY, (this.width / 2) - (300 / 2), (this.height / 2) - (168 / 2) - 10, 300, 168)) {
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/latest")});
} catch (Throwable err) {
err.printStackTrace();
}
}
}
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;
}
}

View File

@ -0,0 +1,27 @@
package net.silentclient.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiScreenServerList;
import net.minecraft.client.multiplayer.ServerData;
import java.io.IOException;
public class GuiScreenServerListInGame extends GuiScreenServerList {
public GuiScreenServerListInGame(GuiScreen p_i1031_1_, ServerData p_i1031_2_) {
super(p_i1031_1_, p_i1031_2_);
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(button.id == 0) {
if(this.mc.theWorld != null) {
this.mc.theWorld.sendQuittingDisconnectingPacket();
this.mc.loadWorld(null);
this.mc.displayGuiScreen(null);
}
}
super.actionPerformed(button);
}
}

View File

@ -0,0 +1,82 @@
package net.silentclient.client.gui;
import java.io.IOException;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.mods.settings.GeneralMod;
public class ModalBase extends GuiScreen {
private final GuiScreen parentScreen;
private final int modalWidth;
private final int modalHeight;
private final String modalTitle;
public ModalBase(GuiScreen parentScreen, String modalTitle) {
this(parentScreen, modalTitle, 200, 90);
}
public ModalBase(GuiScreen parentScreen, String modalTitle, int modalWidth, int modalHeight) {
this.parentScreen = parentScreen;
this.modalWidth = modalWidth;
this.modalHeight = modalHeight;
this.modalTitle = modalTitle;
}
@Override
public void initGui() {
MenuBlurUtils.loadBlur();
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.buttonList.add(new IconButton(0, x + this.modalWidth - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(button.id == 0) {
mc.displayGuiScreen(parentScreen);
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
RenderUtils.drawRect(this.getContentX(), this.getContentY(), this.modalWidth, this.modalHeight, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString(this.modalTitle, this.getContentX() + 3, this.getContentY() + 3, 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
NotificationManager.render();
}
public int getContentX() {
return width / 2 - (this.modalWidth / 2);
}
public int getContentY() {
return height / 2 - (this.modalHeight / 2);
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_ESCAPE) {
mc.displayGuiScreen(parentScreen);
};
}
}

View File

@ -0,0 +1,10 @@
package net.silentclient.client.gui;
import net.minecraft.client.gui.GuiScreen;
import net.silentclient.client.gui.elements.Input;
import java.util.ArrayList;
public class SilentScreen extends GuiScreen {
protected ArrayList<Input> silentInputs = new ArrayList<>();
}

View File

@ -0,0 +1,63 @@
package net.silentclient.client.gui;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.util.ResourceLocation;
public class SplashScreen {
private static ResourceLocation SPLASH;
public static void update() {
if(Minecraft.getMinecraft() == null || Minecraft.getMinecraft().getLanguageManager() == null) {
return;
}
drawSplash(Minecraft.getMinecraft().getTextureManager());
}
public static void setProgress(int givenProgress, String givenText) {
update();
}
public static void drawSplash(TextureManager tm) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
int scaleFactor = scaledResolution.getScaleFactor();
Framebuffer framebuffer = new Framebuffer(scaledResolution.getScaledWidth() * scaleFactor, scaledResolution.getScaledHeight() * scaleFactor, true);
framebuffer.bindFramebuffer(false);
GlStateManager.matrixMode(GL11.GL_PROJECTION);
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double) scaledResolution.getScaledWidth(), (double) scaledResolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
GlStateManager.disableLighting();
GlStateManager.disableFog();
GlStateManager.disableDepth();
GlStateManager.enableTexture2D();
if(SPLASH == null) {
SPLASH = new ResourceLocation("silentclient/splash.png");
}
tm.bindTexture(SPLASH);
GlStateManager.resetColor();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Gui.drawScaledCustomSizeModalRect(0, 0, 0, 0, 1920, 1080, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), 1920, 1080);
framebuffer.unbindFramebuffer();
framebuffer.framebufferRender(scaledResolution.getScaledWidth() * scaleFactor, scaledResolution.getScaledHeight() * scaleFactor);
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(516, 0.1F);
Minecraft.getMinecraft().updateDisplay();
}
}

View File

@ -0,0 +1,64 @@
package net.silentclient.client.gui.animation;
public final class SimpleAnimation {
private float value;
private long lastMS;
public SimpleAnimation(float value){
this.value = value;
this.lastMS = System.currentTimeMillis();
}
public void setAnimation(float value, double speed){
long currentMS = System.currentTimeMillis();
long delta = currentMS - this.lastMS;
this.lastMS = currentMS;
double deltaValue = 0D;
if(speed > 28) {
speed = 28;
}
if (speed != 0D) {
deltaValue = Math.abs(value - this.value) * 0.35F / (10D / speed);
}
this.value = calculateCompensation(value, this.value, deltaValue, delta);
}
public float getValue() {
return value;
}
public void setValue(float value) {
this.value = value;
}
private float calculateCompensation(final float target, float current, final double speed, long delta) {
float diff = current - target;
double add = (delta * (speed / 50));
if (diff > speed){
if(current - add > target) {
current -= add;
}else {
current = target;
}
}
else if (diff < -speed) {
if(current + add < target) {
current += add;
}else {
current = target;
}
}
else{
current = target;
}
return current;
}
}

View File

@ -0,0 +1,122 @@
package net.silentclient.client.gui.animation.normal;
public abstract class Animation {
public AnimationTimer timer = new AnimationTimer();
protected int duration;
protected double endPoint;
protected Direction direction;
public Animation(int ms, double endPoint) {
this.duration = ms;
this.endPoint = endPoint;
this.direction = Direction.FORWARDS;
}
public Animation(int ms, double endPoint, Direction direction) {
this.duration = ms;
this.endPoint = endPoint;
this.direction = direction;
}
public boolean isDone(Direction direction) {
return isDone() && this.direction.equals(direction);
}
public double getLinearOutput() {
return 1 - ((timer.getTime() / (double) duration) * endPoint);
}
public void reset() {
timer.reset();
}
public boolean isDone() {
return timer.hasTimeElapsed(duration);
}
public void setDuration(int duration) {
this.duration = duration;
}
public void changeDirection() {
setDirection(direction.opposite());
}
public void setDirection(Direction direction) {
if (this.direction != direction) {
this.direction = direction;
timer.setTime(System.currentTimeMillis() - (duration - Math.min(duration, timer.getTime())));
}
}
protected boolean correctOutput() {
return false;
}
public double getValue() {
if (direction == Direction.FORWARDS) {
if (isDone())
return endPoint;
return (getEquation(timer.getTime()) * endPoint);
} else {
if (isDone()) return 0;
if (correctOutput()) {
double revTime = Math.min(duration, Math.max(0, duration - timer.getTime()));
return getEquation(revTime) * endPoint;
} else return (1 - getEquation(timer.getTime())) * endPoint;
}
}
protected abstract double getEquation(double x);
public double getEndPoint() {
return endPoint;
}
public void setEndPoint(double endPoint) {
this.endPoint = endPoint;
}
public int getDuration() {
return duration;
}
public Direction getDirection() {
return direction;
}
}
class AnimationTimer {
public long lastMS = System.currentTimeMillis();
public void reset() {
lastMS = System.currentTimeMillis();
}
public boolean hasTimeElapsed(long time, boolean reset) {
if (System.currentTimeMillis() - lastMS > time) {
if (reset) reset();
return true;
}
return false;
}
public boolean hasTimeElapsed(long time) {
return System.currentTimeMillis() - lastMS > time;
}
public long getTime() {
return System.currentTimeMillis() - lastMS;
}
public void setTime(long time) {
lastMS = time;
}
}

View File

@ -0,0 +1,12 @@
package net.silentclient.client.gui.animation.normal;
public enum Direction {
FORWARDS,
BACKWARDS;
public Direction opposite() {
if (this == Direction.FORWARDS) {
return Direction.BACKWARDS;
} else return Direction.FORWARDS;
}
}

View File

@ -0,0 +1,20 @@
package net.silentclient.client.gui.animation.normal.impl;
import net.silentclient.client.gui.animation.normal.Animation;
import net.silentclient.client.gui.animation.normal.Direction;
public class DecelerateAnimation extends Animation {
public DecelerateAnimation(int ms, double endPoint) {
super(ms, endPoint);
}
public DecelerateAnimation(int ms, double endPoint, Direction direction) {
super(ms, endPoint, direction);
}
protected double getEquation(double x) {
double x1 = x / duration;
return 1 - ((x1 - 1) * (x1 - 1));
}
}

View File

@ -0,0 +1,30 @@
package net.silentclient.client.gui.animation.normal.impl;
import net.silentclient.client.gui.animation.normal.Animation;
import net.silentclient.client.gui.animation.normal.Direction;
public class EaseBackIn extends Animation {
private final float easeAmount;
public EaseBackIn(int ms, double endPoint, float easeAmount) {
super(ms, endPoint);
this.easeAmount = easeAmount;
}
public EaseBackIn(int ms, double endPoint, float easeAmount, Direction direction) {
super(ms, endPoint, direction);
this.easeAmount = easeAmount;
}
@Override
protected boolean correctOutput() {
return true;
}
@Override
protected double getEquation(double x) {
double x1 = x / duration;
float shrink = easeAmount + 1;
return Math.max(0, 1 + shrink * Math.pow(x1 - 1, 3) + easeAmount * Math.pow(x1 - 1, 2));
}
}

View File

@ -0,0 +1,448 @@
package net.silentclient.client.gui.clickgui;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.regex.Pattern;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.Sys;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
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.ResourceLocation;
import net.minecraft.util.Util;
import net.silentclient.client.Client;
import net.silentclient.client.config.AddConfigModal;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.animation.normal.Animation;
import net.silentclient.client.gui.animation.normal.Direction;
import net.silentclient.client.gui.animation.normal.impl.EaseBackIn;
import net.silentclient.client.gui.clickgui.utils.GlUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.elements.Switch;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.font.SilentFontRenderer.FontType;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.premium.PremiumGui;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.Sounds;
public class ClickGUI extends SilentScreen {
private ModCategory selectedCategory;
public static double scrollY;
public static SimpleAnimation scrollAnimation = new SimpleAnimation(0.0F);
private Input nametagMessageInput = new Input("Nametag Message", Pattern
.compile("^[~`!@#$%^&*()_+=[\\\\]\\\\\\\\\\\\{\\\\}|;':\\\",.\\\\/<>?a-zA-Z0-9-\\s]+$"), 40);
private float scrollHeight = 0;
public static Animation introAnimation;
public static boolean close;
private boolean loaded;
public ClickGUI() {
this.loaded = false;
selectedCategory = ModCategory.MODS;
}
public ClickGUI(ModCategory category) {
this.loaded = false;
selectedCategory = category;
}
@Override
public void initGui() {
close = false;
Client.getInstance().configManager.updateConfigs();
ClickGUI.scrollY = 0;
MenuBlurUtils.loadBlur();
this.silentInputs.add(new Input("Search"));
int categoryOffsetY = 25;
int addX = 190;
int addY = 110;
if(!loaded) {
introAnimation = new EaseBackIn(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Animations").getValBoolean() ? Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Animations Speed").getValInt() : 1, 1, 2);
}
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int height = addY * 2;
int tabId = 1;
for(ModCategory c : ModCategory.values()) {
String formattedName = c.toString();
this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 20, formattedName, selectedCategory == c));
categoryOffsetY +=25;
tabId++;
}
this.buttonList.add(new Button(tabId, x + 5, (y + height) - 26, 75, 20, "Edit HUD"));
nametagMessageInput.setValue(Client.getInstance().getAccount().getNametagMessage());
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int height = addY * 2;
int modOffsetY = 25;
//Draw background
GlStateManager.pushMatrix();
GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) introAnimation.getValue());
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString(selectedCategory.toString(), x + 100, (int) (y + 5), 14, SilentFontRenderer.FontType.TITLE);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
ScaledResolution r = new ScaledResolution(mc);
int s = r.getScaleFactor();
int translatedY = r.getScaledHeight() - (y + 25) - (height - 25);
GL11.glScissor(x * s, translatedY * s, (width * s), (height - 25) * s);
int column = 1;
int modOffsetX = x + 100;
this.scrollHeight = 25;
boolean headerHovered = MouseUtils.isInside(mouseX, mouseY, modOffsetX, y, width, 25);
if(selectedCategory != ModCategory.PLUS && selectedCategory != ModCategory.CONFIGS) {
for(Mod m : getMods()) {
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;
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70) && !headerHovered && !switchHovered && (Client.getInstance().getSettingsManager().getSettingByMod(m).size() != 0 || m.getName() == "Auto Text");
RoundedUtils.drawRoundedOutline(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), modOffsetX + 65, y + modOffsetY - scrollAnimation.getValue() + 70, 5, 2, new Color(255, 255, 255, 127).getRGB());
RoundedUtils.drawRoundedRect(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), modOffsetX + 65, y + modOffsetY - scrollAnimation.getValue() + 70, 5, new Color(255, 255, 255, isHovered ? 30 : 0).getRGB());
GL11.glColor4f(1, 1, 1, 1);
Client.getInstance().getSilentFontRenderer().drawString(m.getName(), modOffsetX + ((65 / 2) - ((Client.getInstance().getSilentFontRenderer().getStringWidth(m.getName(), 8, FontType.HEADER)) / 2)), y + modOffsetY - scrollAnimation.getValue() + 4, 8, FontType.HEADER);
if(m.getIcon() != null) {
RenderUtil.drawImage(new ResourceLocation(m.getIcon()), modOffsetX + ((65 / 2) - 10), y + modOffsetY - scrollAnimation.getValue() + ((70 / 2) - 10), 20, 20, false);
}
if(selectedCategory.equals(ModCategory.MODS)) {
Switch.render(mouseX, mouseY, switchX, switchY, m.switchAniamation, m.isEnabled(), m.isForceDisabled());
}
if(m.isUpdated() || m.isNew()) {
String status = "UPDATED";
if(m.isNew()) {
status = "NEW";
}
float badgeX = modOffsetX + ((65 / 2) - 15);
float badgeY = y + modOffsetY - scrollAnimation.getValue() + 13;
RenderUtil.drawRoundedRect(badgeX, badgeY, badgeX + 30, badgeY + 8, 8, Color.RED.getRGB());
Client.getInstance().getSilentFontRenderer().drawString(status, badgeX + (status.equals("UPDATED") ? 3 : 9), badgeY + 1, 6, SilentFontRenderer.FontType.HEADER);
}
modOffsetY += column == 4 ? 75 : 0;
modOffsetX = column == 4 ? x + 100 : modOffsetX + 70;
this.scrollHeight += column == 4 ? 70 : 0;
column = column == 4 ? 1 : column + 1;
}
} else if(selectedCategory == ModCategory.CONFIGS) {
RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, -1);
Client.getInstance().getSilentFontRenderer().drawString("New Config", x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE);
modOffsetY+=column == 1 ? 0 : 35;
this.scrollHeight += column == 2 ? 28 : 0;
column = column == 1 ? 2 : 1;
RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, -1);
Client.getInstance().getSilentFontRenderer().drawString("Open Folder", x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE);
modOffsetY+=column == 1 ? 0 : 35;
this.scrollHeight += column == 2 ? 28 : 0;
column = column == 1 ? 2 : 1;
RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, new Color(32, 252, 3).getRGB());
RenderUtil.drawImage(new ResourceLocation("silentclient/transparent.png"), x + 90 + (column == 1 ? 0 : 130) + (column == 1 ? 125 : 135), y + modOffsetY + 7 - scrollAnimation.getValue(), 15, 15, false);
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawString(Client.getInstance().configManager.configFile.getName().replace(".txt", ""), x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE);
modOffsetY+=column == 1 ? 0 : 35;
this.scrollHeight += column == 2 ? 28 : 0;
column = column == 1 ? 2 : 1;
for(String config : Client.getInstance().configManager.getConfigFiles()) {
if(config.equals(".config-settings.txt") || config.equals(".DS_Store") || Client.getInstance().configManager.configFile.getName().equals(config)) {
continue;
}
RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, new Color(252, 3, 3).getRGB());
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/trash-icon.png"), x + 90 + (column == 1 ? 0 : 130) + (column == 1 ? 125 : 135), y + modOffsetY + 7 - scrollAnimation.getValue(), 15, 15, false);
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawString(config.replace(".txt", ""), x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE);
modOffsetY+=column == 1 ? 0 : 35;
this.scrollHeight += column == 2 ? 28 : 0;
column = column == 1 ? 2 : 1;
}
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GL11.glPopMatrix();
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
if(selectedCategory == ModCategory.PLUS) {
PremiumGui.drawScreen(x, y, width, height, mouseX, mouseY, partialTicks, nametagMessageInput);
}
for (int i = 0; i < this.buttonList.size(); ++i)
{
((GuiButton)this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY);
}
scrollAnimation.setAnimation((float) scrollY, 16);
if(selectedCategory == ModCategory.MODS) {
this.silentInputs.get(0).render(mouseX, mouseY, x + width - 140, y + 2, 135);
}
if(close) {
introAnimation.setDirection(Direction.BACKWARDS);
if(introAnimation.isDone(Direction.BACKWARDS)) {
mc.displayGuiScreen(null);
}
loaded = false;
}
if(introAnimation.isDone() && !close) {
loaded = true;
}
GlUtils.stopScale();
GlStateManager.popMatrix();
NotificationManager.render();
}
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
int dw = Mouse.getEventDWheel();
double newScrollY = scrollY;
if(dw != 0) {
if (dw > 0) {
dw = -1;
} else {
dw = 1;
}
float amountScrolled = (float) (dw * 10);
if (newScrollY + amountScrolled > 0)
newScrollY += amountScrolled;
else
newScrollY = 0;
if(newScrollY < scrollHeight) {
scrollY = newScrollY;
}
}
}
private ArrayList<Mod> getMods() {
if(this.silentInputs.get(0).getValue().trim().equals("") || !selectedCategory.equals(ModCategory.MODS)) {
return Client.getInstance().getModInstances().getModByCategory(selectedCategory);
}
return Client.getInstance().getModInstances().searchMods(this.silentInputs.get(0).getValue());
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
if(button instanceof TabButton) {
TabButton tab = (TabButton) button;
switch(tab.id) {
case 1:
selectedCategory = ModCategory.MODS;
break;
case 2:
selectedCategory = ModCategory.SETTINGS;
break;
case 3:
selectedCategory = ModCategory.CONFIGS;
break;
case 4:
selectedCategory = ModCategory.PLUS;
break;
}
scrollY = 0;
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof TabButton) {
TabButton tabB = (TabButton) oldButton;
tabB.selected = false;
}
});
tab.selected = true;
Client.getInstance().configManager.save();
}
if(button.id == 5) {
mc.displayGuiScreen(new HUDConfigScreen(this));
}
}
@Override
public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int height = addY * 2;
int modOffsetY = 25;
int column = 1;
int modOffsetX = x + 100;
if(selectedCategory == ModCategory.MODS) {
this.silentInputs.get(0).onClick(mouseX, mouseY, x + width - 140, y + 2, 135);
}
if(MouseUtils.isInside(mouseX, mouseY, modOffsetX, y, width, 25)) {
return;
}
if(selectedCategory != ModCategory.PLUS && selectedCategory != ModCategory.CONFIGS) {
for(Mod m : getMods()) {
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);
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70) && !switchHovered && (Client.getInstance().getSettingsManager().getSettingByMod(m).size() != 0 || m.getName() == "Auto Text");
if(switchHovered && !m.isForceDisabled()) {
Sounds.playButtonSound();
m.toggle();
}
if(isHovered) {
Sounds.playButtonSound();
mc.displayGuiScreen(new ModSettings(m, this));
}
modOffsetY += column == 4 ? 75 : 0;
modOffsetX = column == 4 ? x + 100 : modOffsetX + 70;
column = column == 4 ? 1 : column + 1;
}
}else if(selectedCategory == ModCategory.CONFIGS) {
if(MouseUtils.isInside(mouseX, mouseY,x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28) && mouseButton == 0) {
Sounds.playButtonSound();
mc.displayGuiScreen(new AddConfigModal(this));
}
modOffsetY+=column == 1 ? 0 : 35;
column = column == 1 ? 2 : 1;
if(MouseUtils.isInside(mouseX, mouseY,x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28) && mouseButton == 0) {
Sounds.playButtonSound();
File file1 = Client.getInstance().dir;
String s = file1.getAbsolutePath();
if (Util.getOSType() == Util.EnumOS.OSX) {
try {
Client.logger.info(s);
Runtime.getRuntime().exec(new String[]{"/usr/bin/open", s});
return;
} catch (IOException ioexception1) {
Client.logger.error((String) "Couldn\'t open file", (Throwable) ioexception1);
}
} else if (Util.getOSType() == Util.EnumOS.WINDOWS) {
String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[]{s});
try {
Runtime.getRuntime().exec(s1);
return;
} catch (IOException ioexception) {
Client.logger.error((String) "Couldn\'t open file", (Throwable) ioexception);
}
}
boolean flag = false;
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[]{file1.toURI()});
} catch (Throwable throwable) {
Client.logger.error("Couldn\'t open link", throwable);
flag = true;
}
if (flag) {
Client.logger.info("Opening via system class!");
Sys.openURL("file://" + s);
}
}
modOffsetY+=column == 1 ? 0 : 35;
column = column == 1 ? 2 : 1;
modOffsetY+=column == 1 ? 0 : 35;
column = column == 1 ? 2 : 1;
for(String config : Client.getInstance().configManager.getConfigFiles()) {
if(config.equals(".config-settings.txt") || config.equals(".DS_Store") || Client.getInstance().configManager.configFile.getName().equals(config)) {
continue;
}
if(MouseUtils.isInside(mouseX, mouseY, x + 90 + (column == 1 ? 0 : 130) + (column == 1 ? 125 : 135), y + modOffsetY + 7 - scrollAnimation.getValue(), 15, 15) && mouseButton == 0) {
Client.getInstance().configManager.deleteConfig(config);
Sounds.playButtonSound();
} else if(MouseUtils.isInside(mouseX, mouseY,x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28) && mouseButton == 0) {
Client.getInstance().configManager.loadConfig(config);
Sounds.playButtonSound();
}
modOffsetY+=column == 1 ? 0 : 35;
column = column == 1 ? 2 : 1;
}
} else {
PremiumGui.mouseClicked(x, y, width, height, mouseX, mouseY, mouseButton, this, nametagMessageInput);
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if(keyCode == Keyboard.KEY_ESCAPE) {
close = true;
}
if(selectedCategory != ModCategory.PLUS && selectedCategory != ModCategory.CONFIGS) {
if (selectedCategory == ModCategory.MODS) {
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
if(this.silentInputs.get(0).isFocused()) {
ClickGUI.scrollY = 0;
}
}
}
if(selectedCategory == ModCategory.PLUS && Client.getInstance().getAccount().isPremiumPlus()) {
nametagMessageInput.onKeyTyped(typedChar, keyCode);
}
}
@Override
public boolean doesGuiPauseGame() {
return !(selectedCategory.equals(ModCategory.CONFIGS));
}
@Override
public void onGuiClosed() {
Client.getInstance().configManager.save();
MenuBlurUtils.unloadBlur();
}
}

View File

@ -0,0 +1,221 @@
package net.silentclient.client.gui.clickgui;
import java.awt.Color;
import java.io.IOException;
import java.util.ArrayList;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.MathHelper;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.Slider;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.animation.normal.Direction;
import net.silentclient.client.gui.clickgui.utils.GlUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.utils.Sounds;
public class GuiColorPicker extends GuiScreen {
private final Mod mod;
private final GuiScreen parentScreen;
private ArrayList<Color> colors = new ArrayList<Color>();
private final String value;
private long initTime;
public GuiColorPicker(Mod mod, String value, GuiScreen parent) {
if (mod == null) throw new IllegalArgumentException("Mod is null");
this.mod = mod;
this.parentScreen = parent;
this.value = value;
}
@Override
public void initGui() {
this.initTime = System.currentTimeMillis();
colors.clear();
colors.add(new Color(255, 255, 255));
colors.add(new Color(156, 157, 151));
colors.add(new Color(71,79,82));
colors.add(new Color(0, 0, 0));
colors.add(new Color(255,216,61));
colors.add(new Color(249,128,29));
colors.add(new Color(176,46,38));
colors.add(new Color(130,84,50));
colors.add(new Color(128,199,31));
colors.add(new Color(58,179,218));
colors.add(new Color(22,156,157));
colors.add(new Color(60,68,169));
colors.add(new Color(243,140,170));
colors.add(new Color(198,79,189));
colors.add(new Color(137,50,183));
MenuBlurUtils.loadBlur();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int height = addY * 2;
this.buttonList.add(new Button(1, x + 5, y + 25, 75, 20, "< Back"));
this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD"));
}
@Override
public void onGuiClosed() {
if(mod.getName() == "Pack Tweaks" && mod.isEnabled()) {
mc.renderGlobal.loadRenderers();
}
MenuBlurUtils.unloadBlur();
super.onGuiClosed();
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int height = addY * 2;
GlStateManager.pushMatrix();
GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue());
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
GL11.glPushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int settingY = y + 25;
int colorIndex = 0;
int spacing = 100;
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
for(Color color : colors) {
RenderUtils.drawRect(x + spacing, settingY - 1, 22, 22, new Color(0, 0, 0).getRGB());
RenderUtils.drawRect(x + spacing + 1, settingY - 1 + 1, 20, 20, new Color(color.getRed(), color.getGreen(), color.getBlue(), setting.getOpacity()).getRGB());
spacing += 25;
colorIndex += 1;
if(colorIndex == 5 || colorIndex == 10) {
spacing = 100;
settingY += 30;
}
}
int settingHeight = 10 + 5;
settingY += settingHeight;
if(setting.isCanChangeOpacity()) {
settingY += settingHeight;
Slider.render(x, settingY - 1, width, "Opacity", 255, setting.getOpacity());
if (Slider.isDrag(mouseX, mouseY, x, settingY - 1, width) && (System.currentTimeMillis() - initTime) > 500) {
double diff = 255 - 0;
double mouse = MathHelper.clamp_double((mouseX - Slider.getLeft(x, width)) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
setting.setOpacity((int) newVal);
}
}
settingY += settingHeight;
Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Chroma", setting.isChroma());
GL11.glPopMatrix();
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
Client.getInstance().getSilentFontRenderer().drawString("Choose a color", x + 100, (int) (y + 5), 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
if(ClickGUI.close) {
ClickGUI.introAnimation.setDirection(Direction.BACKWARDS);
if(ClickGUI.introAnimation.isDone(Direction.BACKWARDS)) {
mc.displayGuiScreen(null);
}
}
GlUtils.stopScale();
GlStateManager.popMatrix();
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button.id == 1) {
mc.displayGuiScreen(parentScreen);
}
if(button.id == 2) {
mc.displayGuiScreen(new HUDConfigScreen(this));
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
// TODO Auto-generated method stub
super.mouseClicked(mouseX, mouseY, mouseButton);
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int settingY = y + 25;
int colorIndex = 0;
int spacing = 100;
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
for(Color color : colors) {
if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22) && mouseButton == 0) {
Sounds.playButtonSound();
Client.getInstance().getSettingsManager().getSettingByName(mod, this.value).setValColor(color);
mc.displayGuiScreen(parentScreen);
}
spacing += 25;
colorIndex += 1;
if(colorIndex == 5 || colorIndex == 10) {
spacing = 100;
settingY += 30;
}
}
int settingHeight = 10 + 5;
settingY += settingHeight + settingHeight + (setting.isCanChangeOpacity() ? settingHeight : 0);
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
Sounds.playButtonSound();
setting.setChroma(!setting.isChroma());
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_ESCAPE) {
ClickGUI.close = true;
}
}
}

View File

@ -0,0 +1,407 @@
package net.silentclient.client.gui.clickgui;
import java.io.IOException;
import java.net.URI;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
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.animation.SimpleAnimation;
import net.silentclient.client.gui.animation.normal.Direction;
import net.silentclient.client.gui.clickgui.utils.GlUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.MouseUtils.Scroll;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.ColorPicker;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.elements.Select;
import net.silentclient.client.gui.elements.Slider;
import net.silentclient.client.gui.elements.StaticButton;
import net.silentclient.client.gui.elements.Switch;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.mods.render.CrosshairMod;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.mods.world.TimeChangerMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.Sounds;
public class ModSettings extends SilentScreen {
private final Mod mod;
private final GuiScreen parentScreen;
private long initTime;
public double scrollY;
public static SimpleAnimation scrollAnimation = new SimpleAnimation(0.0F);
public ModSettings(Mod mod, GuiScreen parent) {
if (mod == null) throw new IllegalArgumentException("Mod is null");
this.mod = mod;
this.parentScreen = parent;
}
@Override
public void initGui() {
this.initTime = System.currentTimeMillis();
scrollAnimation.setValue(0);
MenuBlurUtils.loadBlur();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int height = addY * 2;
this.buttonList.add(new Button(1, x + 5, y + 25, 75, 20, "< Back"));
this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD"));
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
if(setting.isInput()) {
this.silentInputs.add(new Input(setting.getName(), setting.getValString()));
}
}
}
@Override
public void onGuiClosed() {
Client.getInstance().configManager.save();
MenuBlurUtils.unloadBlur();
int inputIndex = 0;
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
if (setting.isInput()) {
if(setting.getName() == "Text After Value" && !Client.getInstance().getAccount().isPremiumPlus()) {
inputIndex++;
continue;
}
setting.setValString(this.silentInputs.get(inputIndex).getValue().length() != 0 ? this.silentInputs.get(inputIndex).getValue() : setting.defaultsval);
inputIndex++;
}
}
super.onGuiClosed();
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button.id == 1) {
mc.displayGuiScreen(parentScreen);
}
if(button.id == 2) {
mc.displayGuiScreen(new HUDConfigScreen(this));
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int height = addY * 2;
GlStateManager.pushMatrix();
GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue());
RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB());
GL11.glPushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int settingY = (int) (y + 25 + scrollAnimation.getValue() + mod.customComponentHeight());
GL11.glPopMatrix();
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
int settingIndex = 0;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
ScaledResolution r = new ScaledResolution(mc);
int s = r.getScaleFactor();
int translatedY = r.getScaledHeight() - y - height;
GL11.glScissor(x * s, translatedY * s, width * s, height * s);
if(mod.getCategory() == ModCategory.MODS) {
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/reset_settings.png"), x + width - (10 + 8) - 15, y + 5 + scrollAnimation.getValue(), 10, 10);
Switch.render(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue(), mod.switchAniamation, mod.isEnabled(), mod.isForceDisabled());
}
Client.getInstance().getSilentFontRenderer().drawString(mod.getName(), x + 100, (int) (y + 5) + scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE);
mod.renderCustomComponent(x + 100, (int) (y + 25 + scrollAnimation.getValue()), width, height, mouseX, mouseY);
int inputIndex = 0;
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
if(mod.getName() == "Crosshair" && Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset Crosshair").getValBoolean() && setting.getName() != "Scale" && setting.getName() != "Crosshair Color" && setting.getName() != "Vanilla Blendering") {
continue;
}
if(mod.getName() == "Crosshair" && (setting.getName() == "Preset ID" || setting.getName() == "Preset Crosshair")) {
continue;
}
if(mod.getName() == "Crosshair" && setting.getName() == "Vanilla Blendering" && !Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset Crosshair").getValBoolean()) {
continue;
}
int settingHeight = 10 + 5;
if(setting.isInput()) {
Client.getInstance().getSilentFontRenderer().drawString(setting.getName() + ":", x + 100, settingY + 1, 12, SilentFontRenderer.FontType.TITLE);
if(setting.getName() == "Text After Value" && !Client.getInstance().getAccount().isPremiumPlus()) {
StaticButton.render(x + 310, settingY + (4), 65, 12, "BUY PREMIUM+");
} else {
this.silentInputs.get(inputIndex).render(mouseX, mouseY, x + 100 + ((190 * 2) - 108) / 2, settingY, ((190 * 2) - 108) / 2, true);
}
ColorUtils.setColor(-1);
settingY += 5;
inputIndex++;
}
if(setting.isCombo()) {
Select.render(mouseX, mouseY, x, settingY, width, setting.getName(), setting.getValString());
}
if (setting.isColor()) {
ColorPicker.render(x, settingY - 1, width, setting.getName(), setting.getValColor().getRGB());
}
if (setting.isCheck()) {
Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, setting.getName(), setting.getValBoolean());
}
if (setting.isSlider()) {
Slider.render(x, settingY - 1, width, setting.getName(), setting.getMax(), setting.getValDouble());
if (Slider.isDrag(mouseX, mouseY, x, settingY - 1, width) && (System.currentTimeMillis() - initTime) > 500) {
double diff = setting.getMax() - setting.getMin();
double mouse = MathHelper.clamp_double((mouseX - Slider.getLeft(x, width)) / 90D, 0, 1);
double newVal = setting.getMin() + mouse * diff;
if(newVal != setting.getValDouble()) {
setting.setValDouble(newVal);
mod.onChangeSettingValue(setting);
}
}
}
settingIndex++;
settingY += settingHeight;
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GL11.glPopMatrix();
super.drawScreen(mouseX, mouseY, partialTicks);
final Scroll scroll = MouseUtils.scroll();
if(scroll != null) {
switch (scroll) {
case DOWN:
if(scrollY > -((settingIndex - 13.5) * 38)) {
scrollY -=12;
}
if(settingIndex > 13) {
if(scrollY < -((settingIndex - 15) * 38)) {
scrollY = -((settingIndex - 14.1) * 38);
}
}
if(mod.customComponentHeight() > height - 30) {
if(scrollY > -((mod.customComponentHeight() - 13.5) * 38)) {
scrollY -=12;
}
if(scrollY < -((mod.customComponentHeight() - 15) * 38)) {
scrollY = -((mod.customComponentHeight() - 14.1) * 38);
}
}
break;
case UP:
if(scrollY < -10) {
scrollY +=12;
}else {
if(settingIndex > 13) {
scrollY = 0;
}
if(mod.customComponentHeight() > height - 30) {
scrollY = 0;
}
}
break;
}
}
scrollAnimation.setAnimation((float) scrollY, 16);
NotificationManager.render();
if(ClickGUI.close) {
ClickGUI.introAnimation.setDirection(Direction.BACKWARDS);
if(ClickGUI.introAnimation.isDone(Direction.BACKWARDS)) {
mc.displayGuiScreen(null);
}
}
GlUtils.stopScale();
GlStateManager.popMatrix();
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int settingY = (int) (y + 25 + scrollAnimation.getValue() + mod.customComponentHeight());
String category = "";
if(mod.getCategory() == ModCategory.MODS && MouseUtils.isInside(mouseX, mouseY, x + width - (10 + 8) - 15, y + 5 + scrollAnimation.getValue(), 10, 10)) {
Sounds.playButtonSound();
mod.reset(false);
}
if(mod.getCategory() == ModCategory.MODS && Switch.isHovered(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue())) {
Sounds.playButtonSound();
mod.toggle();
}
int inputIndex = 0;
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
if(mod.getName() == "Crosshair" && Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset Crosshair").getValBoolean() && setting.getName() != "Scale" && setting.getName() != "Crosshair Color" && setting.getName() != "Vanilla Blendering") {
continue;
}
if(mod.getName() == "Crosshair" && (setting.getName() == "Preset ID" || setting.getName() == "Preset Crosshair")) {
continue;
}
if(mod.getName() == "Crosshair" && setting.getName() == "Vanilla Blendering" && !Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset Crosshair").getValBoolean()) {
continue;
}
int settingHeight = 10 + 5;
if (!category.equals(setting.getCategory())) {
settingY += 5;
settingY += 15f;
settingY += 5;
category = setting.getCategory();
}
if(setting.isInput()) {
if(setting.getName() == "Text After Value" && !Client.getInstance().getAccount().isPremiumPlus()) {
if(StaticButton.isHovered(mouseX, mouseY, x + 310, settingY + (4), 65, 12)) {
Sounds.playButtonSound();
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/premium")});
} catch (Throwable err) {
err.printStackTrace();
}
}
} else {
this.silentInputs.get(inputIndex).onClick(mouseX, mouseY, x + 100 + ((190 * 2) - 108) / 2, settingY, ((190 * 2) - 108) / 2, true);
}
settingY += 5;
inputIndex++;
}
if(setting.isCombo()) {
int index = 0;
String curr = setting.getValString();
String next = "";
String prev = "";
for(int i=0;i<setting.getOptions().size();i++) {
if(curr == setting.getOptions().get(i)) {
index = i;
}
}
if((index + 1) > (setting.getOptions().size() - 1)) {
next = setting.getOptions().get(0);
} else {
next = setting.getOptions().get(index + 1);
}
if(!((index - 1) > (setting.getOptions().size() - 1)) && (index - 1) != -1) {
prev = setting.getOptions().get(index - 1);
} else {
prev = setting.getOptions().get(setting.getOptions().size() - 1);
}
if(Select.prevHovered(mouseX, mouseY, x, settingY, width)) {
Sounds.playButtonSound();
setting.setValString(prev);
mod.onChangeSettingValue(setting);
}
if(Select.nextHovered(mouseX, mouseY, x, settingY, width)) {
Sounds.playButtonSound();
setting.setValString(next);
mod.onChangeSettingValue(setting);
}
}
if (setting.isCheck()) {
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
Sounds.playButtonSound();
setting.setValBoolean(!setting.getValBoolean());
mod.onChangeSettingValue(setting);
}
}
if (setting.isColor() && ColorPicker.isHovered(mouseX, mouseY, x, settingY - 1, width)) {
Sounds.playButtonSound();
this.mc.displayGuiScreen(new GuiColorPicker(mod, setting.getName(), this));
}
settingY += settingHeight;
}
mod.customComponentClick(x + 100, (int) (y + 30 + scrollY), mouseX, mouseY, mouseButton, this);
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_ESCAPE) {
ClickGUI.close = true;
return;
}
int inputIndex = 0;
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
if (setting.isInput()) {
if(setting.getName() == "Text After Value" && !Client.getInstance().getAccount().isPremiumPlus()) {
inputIndex++;
continue;
}
this.silentInputs.get(inputIndex).onKeyTyped(typedChar, keyCode);
setting.setValString(this.silentInputs.get(inputIndex).getValue());
inputIndex++;
}
}
}
@Override
public boolean doesGuiPauseGame() {
return !(this.mod instanceof TimeChangerMod);
}
}

View File

@ -0,0 +1,162 @@
package net.silentclient.client.gui.clickgui;
import java.awt.Color;
import java.io.IOException;
import java.util.ArrayList;
import net.minecraft.client.gui.GuiButton;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
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.RenderUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.gui.util.RoundedUtils;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.Sounds;
public class PlusColorPicker extends GuiScreen {
private final GuiScreen parentScreen;
private ArrayList<Color> colors = new ArrayList<Color>();
public PlusColorPicker(GuiScreen parent) {
this.parentScreen = parent;
}
@Override
public void initGui() {
colors.clear();
colors.add(new Color(255, 255, 255));
colors.add(new Color(156, 157, 151));
colors.add(new Color(71,79,82));
colors.add(new Color(0, 0, 0));
colors.add(new Color(255,216,61));
colors.add(new Color(249,128,29));
colors.add(new Color(176,46,38));
colors.add(new Color(130,84,50));
colors.add(new Color(128,199,31));
colors.add(new Color(58,179,218));
colors.add(new Color(22,156,157));
colors.add(new Color(60,68,169));
colors.add(new Color(243,140,170));
colors.add(new Color(198,79,189));
colors.add(new Color(137,50,183));
MenuBlurUtils.loadBlur();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int height = addY * 2;
this.buttonList.add(new Button(1, x + 5, y + 42, 75, 20, "< Back"));
this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD"));
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
super.onGuiClosed();
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button.id == 1) {
mc.displayGuiScreen(parentScreen);
}
if(button.id == 2) {
mc.displayGuiScreen(new HUDConfigScreen(this));
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int width = addX * 2;
int height = addY * 2;
RoundedUtils.drawRoundedRect(x + 90, y, x + 90 + width - 90, y + height, 15, Theme.backgroundColor().getRGB());
RoundedUtils.drawRoundedRect(x, y, x + 85, y + height, 15, Theme.backgroundColor().getRGB());
GL11.glPushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int settingY = y + 30;
int colorIndex = 0;
int spacing = 100;
for(Color color : colors) {
RenderUtils.drawRect(x + spacing, settingY - 1, 22, 22, new Color(0, 0, 0).getRGB());
RenderUtils.drawRect(x + spacing + 1, settingY - 1 + 1, 20, 20, color.getRGB());
spacing += 25;
colorIndex += 1;
if(colorIndex == 5 || colorIndex == 10) {
spacing = 100;
settingY += 30;
}
}
GL11.glPopMatrix();
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo_small.png"), x + (85 / 3), y + 5, 30, 30);
Client.getInstance().getSilentFontRenderer().drawString("Choose a color", x + 100, y + 10 - 3, 15, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
// TODO Auto-generated method stub
super.mouseClicked(mouseX, mouseY, mouseButton);
int addX = 190;
int addY = 110;
int x = (width / 2) - addX;
int y = (height / 2) - addY;
int settingY = y + 30;
int colorIndex = 0;
int spacing = 100;
for(Color color : colors) {
if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22) && mouseButton == 0) {
Sounds.playButtonSound();
Client.getInstance().getAccount().setPlusIconColor(color.getRGB());
mc.displayGuiScreen(parentScreen);
}
spacing += 25;
colorIndex += 1;
if(colorIndex == 5 || colorIndex == 10) {
spacing = 100;
settingY += 30;
}
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_ESCAPE) {
Sounds.playButtonSound();
mc.displayGuiScreen(parentScreen);
}
}
}

View File

@ -0,0 +1,79 @@
package net.silentclient.client.gui.clickgui;
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.utils.ColorUtils;
import net.silentclient.client.utils.TimerUtils;
public class TabButton extends GuiButton {
private int animatedOpcaity = 0;
private TimerUtils animateTimer = new TimerUtils();
public boolean selected = false;
private int fontHeight = 14;
public TabButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean selected) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
this.selected = selected;
// TODO Auto-generated constructor stub
}
public TabButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, int fontHeight, boolean selected) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
this.selected = selected;
this.fontHeight = fontHeight;
// TODO Auto-generated constructor stub
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
if (this.visible)
{
GlStateManager.disableBlend();
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
if (!this.enabled)
{
new Color(255, 255, 255, 50).getRGB();
}
ColorUtils.setColor(this.enabled ? this.selected ? new Color(255,255,255, 255).getRGB() : new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, this.enabled ? this.selected ? new Color(255,255,255, 255).getRGB() : new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB());
ColorUtils.setColor(this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB());
this.mouseDragged(mc, mouseX, mouseY);
if (this.hovered && this.enabled) {
if (this.animatedOpcaity < 75 && animateTimer.delay(30)) {
this.animatedOpcaity += 15;
animateTimer.reset();
}
} else {
if (this.animatedOpcaity != 0 && animateTimer.delay(30)) {
this.animatedOpcaity -= 15;
animateTimer.reset();
}
}
ColorUtils.setColor(this.selected ? new Color(0, 0, 0).getRGB() : new Color(255, 255, 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - fontHeight) / 2, fontHeight, SilentFontRenderer.FontType.TITLE, width - (fontHeight / 2));
} else {
this.animatedOpcaity = 0;
}
}
@Override
public void playPressSound(SoundHandler soundHandlerIn) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Silent Button Sounds").getValBoolean()) {
return;
}
super.playPressSound(soundHandlerIn);
}
}

View File

@ -0,0 +1,81 @@
package net.silentclient.client.gui.clickgui.utils;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
public class GlUtils {
public static void scissor(float x, float y, float width, float height) {
int scaleFactor = getScaleFactor();
GL11.glScissor((int)(x * scaleFactor), (int)(Minecraft.getMinecraft().displayHeight - (y + height) * scaleFactor), (int)(((x + width) - x) * scaleFactor), (int)(((y + height) - y) * scaleFactor));
}
public static int getScaleFactor() {
int scaleFactor = 1;
boolean isUnicode = Minecraft.getMinecraft().isUnicode();
int guiScale = Minecraft.getMinecraft().gameSettings.guiScale;
if (guiScale == 0) {
guiScale = 1000;
}
while (scaleFactor < guiScale && Minecraft.getMinecraft().displayWidth / (scaleFactor + 1) >= 320 && Minecraft.getMinecraft().displayHeight / (scaleFactor + 1) >= 240) {
++scaleFactor;
}
if (isUnicode && scaleFactor % 2 != 0 && scaleFactor != 1) {
--scaleFactor;
}
return scaleFactor;
}
public static void startScale(float x, float y, float width, float height, float scale) {
GlStateManager.pushMatrix();
GlStateManager.translate((x + (x + width)) / 2, (y + (y + height)) / 2, 0);
GlStateManager.scale(scale, scale, 1);
GlStateManager.translate(-(x + (x + width)) / 2, -(y + (y + height)) / 2, 0);
}
public static void startScale(float x, float y, float scale) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
GlStateManager.scale(scale, scale, 1);
GlStateManager.translate(-x, -y, 0);
}
public static void stopScale() {
GlStateManager.popMatrix();
}
public static void fixEnchantment() {
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableTexture2D();
GlStateManager.disableAlpha();
GlStateManager.disableBlend();
GlStateManager.enableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
public static void bindTexture(int texture) {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
}
public static void startTranslate(float x, float y) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, 0);
}
public static void stopTranslate() {
GlStateManager.popMatrix();
}
}

View File

@ -0,0 +1,26 @@
package net.silentclient.client.gui.clickgui.utils;
import org.lwjgl.input.Mouse;
public final class MouseUtils {
public enum Scroll {
UP, DOWN;
}
public static Scroll scroll() {
int mouse = Mouse.getDWheel();
if(mouse > 0) {
return Scroll.UP;
}else if(mouse < 0) {
return Scroll.DOWN;
}else {
return null;
}
}
public static boolean isInside(int mouseX, int mouseY, double x, double y, double width, double height) {
return (mouseX >= x && mouseX <= (x + width)) && (mouseY >= y && mouseY <= (y + height));
}
}

View File

@ -0,0 +1,71 @@
package net.silentclient.client.gui.clickgui.utils;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.silentclient.client.utils.ColorUtils;
public class RenderUtils {
private static float zLevelFloat;
public static void drawRect(float x, float y, float width, float height, int color) {
float f = (color >> 24 & 0xFF) / 255.0F;
float f1 = (color >> 16 & 0xFF) / 255.0F;
float f2 = (color >> 8 & 0xFF) / 255.0F;
float f3 = (color & 0xFF) / 255.0F;
GL11.glEnable(3042);
GL11.glDisable(3553);
GL11.glBlendFunc(770, 771);
GL11.glEnable(2848);
GL11.glPushMatrix();
GL11.glColor4f(f1, f2, f3, f);
GL11.glBegin(7);
GL11.glVertex2d(x + width, y);
GL11.glVertex2d(x, y);
GL11.glVertex2d(x, y + height);
GL11.glVertex2d(x + width, y + height);
GL11.glEnd();
GL11.glPopMatrix();
GL11.glEnable(3553);
GL11.glDisable(3042);
GL11.glDisable(2848);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
GL11.glColor4f(1, 1, 1, 1);
}
public static void renderMarker(float x, float y, int color) {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
GlStateManager.enableBlend();
GlStateManager.disableTexture2D();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
ColorUtils.setColor(color);
worldrenderer.begin(6, DefaultVertexFormats.POSITION);
worldrenderer.pos((double) x, (double) (y + 4), 0.0D).endVertex();
worldrenderer.pos((double) (x + 4), (double) y, 0.0D).endVertex();
worldrenderer.pos((double) (x - 4), (double) y, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height){
float f = 0.00390625F;
float f1 = 0.00390625F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)(x + 0), (double)(y + height), (double)RenderUtils.zLevelFloat).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + height), (double)RenderUtils.zLevelFloat).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
worldrenderer.pos((double)(x + width), (double)(y + 0), (double)RenderUtils.zLevelFloat).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
worldrenderer.pos((double)(x + 0), (double)(y + 0), (double)RenderUtils.zLevelFloat).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
tessellator.draw();
}
}

View File

@ -0,0 +1,92 @@
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.utils.ColorUtils;
import net.silentclient.client.utils.TimerUtils;
public class Button extends GuiButton
{
private int animatedOpcaity = 0;
private boolean escMenu = false;
private TimerUtils animateTimer = new TimerUtils();
public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean escMenu) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
this.escMenu = escMenu;
// TODO Auto-generated constructor stub
}
public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) {
super(buttonId, x, y, widthIn, heightIn, buttonText);
// TODO Auto-generated constructor stub
}
public Button(int buttonId, int x, int y, String buttonText)
{
this(buttonId, x, y, 200, 20, buttonText);
}
public Button(int buttonId, int x, int y, String buttonText, boolean escMenu)
{
this(buttonId, x, y, 200, 20, buttonText);
this.escMenu = escMenu;
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
if(escMenu && Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Vanilla ESC Menu Layout").getValBoolean()) {
new GuiButton(this.id, this.xPosition, this.yPosition, this.width, this.height, this.displayString).drawButton(mc, mouseX, mouseY);
return;
}
if (this.visible)
{
GlStateManager.disableBlend();
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
if (!this.enabled)
{
new Color(255, 255, 255, 50).getRGB();
}
ColorUtils.setColor(this.enabled ? new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB());
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, this.enabled ? new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB());
ColorUtils.setColor(this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB());
this.mouseDragged(mc, mouseX, mouseY);
if (this.hovered && this.enabled) {
if (this.animatedOpcaity < 75 && animateTimer.delay(30)) {
this.animatedOpcaity += 15;
animateTimer.reset();
}
} else {
if (this.animatedOpcaity != 0 && animateTimer.delay(30)) {
this.animatedOpcaity -= 15;
animateTimer.reset();
}
}
Client.getInstance().getSilentFontRenderer().drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 14) / 2, 14, SilentFontRenderer.FontType.TITLE, width - 7);
} else {
this.animatedOpcaity = 0;
}
}
@Override
public void playPressSound(SoundHandler soundHandlerIn) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Silent Button Sounds").getValBoolean() && !(escMenu && Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Vanilla ESC Menu Layout").getValBoolean())) {
return;
}
super.playPressSound(soundHandlerIn);
}
}

View File

@ -0,0 +1,24 @@
package net.silentclient.client.gui.elements;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.RenderUtil;
import java.awt.*;
public class Checkbox {
public static void render(int mouseX, int mouseY, int x, int y, String name, boolean selected) {
boolean hovered = Checkbox.isHovered(mouseX, mouseY, x, y);
Color checkColor = selected ? Color.green : new Color(255, 255, 255);
RenderUtil.drawRoundedOutline(x, y, x + 9, y + 9, 9, 2, new Color(checkColor.getRed(), checkColor.getGreen(), checkColor.getBlue(), hovered ? 127 : 255).getRGB());
if(selected) {
RenderUtil.drawRoundedRect(x + (9 / 2 - 5 / 2), y + (9 / 2 - 5 / 2), x + (9 / 2 - 5 / 2) + 5, y + (9 / 2 - 5 / 2) + 5, 5, checkColor.getRGB());
}
Client.getInstance().getSilentFontRenderer().drawString(name, x + 12, y + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE);
}
public static boolean isHovered(int mouseX, int mouseY, int x, int y) {
return MouseUtils.isInside(mouseX, mouseY, x, y, 9, 9);
}
}

View File

@ -0,0 +1,20 @@
package net.silentclient.client.gui.elements;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.RenderUtil;
import java.awt.*;
public class ColorPicker {
public static void render(int x, int y, int width, String name, int color) {
Client.getInstance().getSilentFontRenderer().drawString(name, x + 100, y - 2, 12, SilentFontRenderer.FontType.TITLE);
RenderUtil.drawRoundedRect(x + width - 20, y + 1, x + width - 20 + 15, y + 9, 5, color);
RenderUtil.drawRoundedOutline(x + width - 20, y + 1, x + width - 20 + 15, y + 9, 5, 2, new Color(255, 255, 255).getRGB());
}
public static boolean isHovered(int mouseX, int mouseY, int x, int y, int width) {
return MouseUtils.isInside(mouseX, mouseY, x + width - 20, y + 1, 15, 9);
}
}

View File

@ -0,0 +1,73 @@
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.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.TimerUtils;
public class IconButton extends GuiButton
{
private int animatedOpcaity = 0;
private ResourceLocation icon;
private int iconWidth;
private int iconHeight;
private TimerUtils animateTimer = new TimerUtils();
public IconButton(int buttonId, int x, int y, int widthIn, int heightIn, int iconWidth, int iconHeight, ResourceLocation icon) {
super(buttonId, x, y, widthIn, heightIn, "");
this.icon = icon;
this.iconWidth = iconWidth;
this.iconHeight = iconHeight;
}
public IconButton(int buttonId, int x, int y, ResourceLocation icon)
{
this(buttonId, x, y, 20, 20, 12, 12, icon);
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
if (this.visible)
{
GlStateManager.disableBlend();
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, new Color(255,255,255,animatedOpcaity).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, new Color(255,255,255,255).getRGB());
this.mouseDragged(mc, mouseX, mouseY);
if (!this.enabled)
{
}
if (this.hovered && this.enabled) {
if (this.animatedOpcaity < 75 && animateTimer.delay(30)) {
this.animatedOpcaity += 15;
animateTimer.reset();
}
} else {
if (this.animatedOpcaity != 0 && animateTimer.delay(30)) {
this.animatedOpcaity -= 15;
animateTimer.reset();
}
}
RenderUtil.drawImage(icon, this.xPosition + ((this.width / 2) - (this.iconWidth / 2)), this.yPosition + ((this.height / 2) - (this.iconHeight / 2)), this.iconWidth, this.iconHeight, false);
}
}
@Override
public void playPressSound(SoundHandler soundHandlerIn) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Silent Button Sounds").getValBoolean()) {
return;
}
super.playPressSound(soundHandlerIn);
}
}

View File

@ -0,0 +1,157 @@
package net.silentclient.client.gui.elements;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ChatAllowedCharacters;
import net.minecraft.util.EnumChatFormatting;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.NotificationUtils;
import org.apache.commons.lang3.StringUtils;
import org.lwjgl.input.Keyboard;
import java.awt.*;
import java.util.regex.Pattern;
public class Input {
private boolean isFocused;
private String value;
private Pattern pattern;
private String name;
private int maxLength;
private boolean keyValue;
private int key;
public Input(String name, String value, int key, Pattern pattern, int maxLength, boolean keyValue) {
this.name = name;
this.pattern = pattern;
this.maxLength = maxLength;
this.keyValue = keyValue;
this.value = value;
this.key = key;
}
public Input(String name, Pattern pattern, int maxLength) {
this(name, "", -1, pattern, maxLength, false);
}
public Input(String name, String value) {
this(name, value, -1, Pattern
.compile("^[~`!@#$%^&*()_+=[\\\\]\\\\\\\\\\\\{\\\\}|;':\\\",.\\\\/<>?a-zA-Z0-9-\\s]+$"), 20, false);
}
public Input(String name, int key) {
this(name , "", key, Pattern
.compile("^[~`!@#$%^&*()_+=[\\\\]\\\\\\\\\\\\{\\\\}|;':\\\",.\\\\/<>?a-zA-Z0-9-\\s]+$"), 1, true);
}
public Input(String name, Pattern pattern) {
this(name, pattern, 20);
}
public Input(String name) {
this(name, Pattern
.compile("^[\\w,\\s-]{0,20}+$"), 20);
}
public void render(int mouseX, int mouseY, int x, int y, int width) {
this.render(mouseX, mouseY, x, y, width, false);
}
public void render(int mouseX, int mouseY, int x, int y, int width, boolean small) {
int borderColor = new Color(255, 255, 255, 41).getRGB();
if(MouseUtils.isInside(mouseX, mouseY, x, y, width, 20)) {
borderColor = new Color(255, 255, 255, 61).getRGB();
}
if(isFocused) {
borderColor = new Color(255, 255, 255, 255).getRGB();
}
RenderUtil.drawRoundedOutline(x, y, x + width, y + (small ? 15 : 20), 5, 3, borderColor);
String renderText = name;
ColorUtils.setColor(new Color(255, 255, 255, 41).getRGB());
if(value.length() != 0) {
renderText = value;
ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB());
}
if(keyValue) {
if(key != -1) {
renderText = Keyboard.getKeyName(key);
ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB());
}
if(isFocused) {
renderText = "...";
ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB());
}
}
Client.getInstance().getSilentFontRenderer().drawString(EnumChatFormatting.getTextWithoutFormattingCodes(renderText), x + 2, y + (small ? 1 : 3), small ? 12 : 14, SilentFontRenderer.FontType.TITLE);
}
public boolean isFocused() {
return isFocused;
}
public void onClick(int mouseX, int mouseY, int x, int y, int width) {
this.onClick(mouseX, mouseY, x, y, width, false);
}
public void onClick(int mouseX, int mouseY, int x, int y, int width, boolean small) {
if(MouseUtils.isInside(mouseX, mouseY, x, y, width, small ? 15 : 20)) {
this.isFocused = true;
} else {
this.isFocused = false;
}
}
public void onKeyTyped(char typedChar, int keyCode) {
if(isFocused) {
if(keyValue) {
key = keyCode;
isFocused = false;
return;
}
if(keyCode == Keyboard.KEY_BACK) {
if (value != null || value.length() != 0 || value != "") {
this.value = StringUtils.chop(this.value);
}
return;
}
if (GuiScreen.isKeyComboCtrlV(keyCode))
{
setValue(GuiScreen.getClipboardString());
return;
}
if(value.length() > maxLength - 1) {
NotificationUtils.showNotification("Error", "Maximum " + name + " size " + maxLength + " characters");
return;
}
String test = "";
test += typedChar;
if(this.pattern.matcher(test).matches()) {
value += ChatAllowedCharacters.filterAllowedCharacters(test);
}
}
}
public String getValue() {
return value;
}
public int getKey() {
return key;
}
public boolean isKeyValue() {
return keyValue;
}
public void setValue(String value) {
this.value = value;
}
}

View File

@ -0,0 +1,36 @@
package net.silentclient.client.gui.elements;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.utils.ColorUtils;
import java.awt.*;
public class Select {
public static void render(int mouseX, int mouseY, int x, int y, int width, String name, String selected) {
int left = Select.getLeft(x, width);
boolean firstHovered = Select.prevHovered(mouseX, mouseY, x, y, width);
boolean twoHovered = Select.nextHovered(mouseX, mouseY, x, y, width);
Client.getInstance().getSilentFontRenderer().drawString(name + ":", x + 100, y - 2, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255, firstHovered ? 127 : 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawString("<", left, y - 2, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawString(selected, left + 5 + ((Client.getInstance().getSilentFontRenderer().getStringWidth("<", 12, SilentFontRenderer.FontType.TITLE) + 5 + 100 + 5 + Client.getInstance().getSilentFontRenderer().getStringWidth(">", 12, SilentFontRenderer.FontType.TITLE)) / 2 - Client.getInstance().getSilentFontRenderer().getStringWidth(selected, 12, SilentFontRenderer.FontType.TITLE) / 2), y - 2, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255, twoHovered ? 127 : 255).getRGB());
Client.getInstance().getSilentFontRenderer().drawString(">", left + Client.getInstance().getSilentFontRenderer().getStringWidth("<", 12, SilentFontRenderer.FontType.TITLE) + 5 + 100 + 5, y - 2, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
}
public static int getLeft(int x, int width) {
return (int) (x + width - (Client.getInstance().getSilentFontRenderer().getStringWidth("<", 12, SilentFontRenderer.FontType.TITLE) + 5 + 100 + 5 + Client.getInstance().getSilentFontRenderer().getStringWidth(">", 12, SilentFontRenderer.FontType.TITLE) + 5));
}
public static boolean prevHovered(int mouseX, int mouseY, int x, int y, int width) {
return MouseUtils.isInside(mouseX, mouseY, Select.getLeft(x, width), y - 2, Client.getInstance().getSilentFontRenderer().getStringWidth("<", 12, SilentFontRenderer.FontType.TITLE), 12);
}
public static boolean nextHovered(int mouseX, int mouseY, int x, int y, int width) {
return MouseUtils.isInside(mouseX, mouseY, Select.getLeft(x, width) + Client.getInstance().getSilentFontRenderer().getStringWidth("<", 12, SilentFontRenderer.FontType.TITLE) + 5 + 100 + 5, y - 2, Client.getInstance().getSilentFontRenderer().getStringWidth(">", 12, SilentFontRenderer.FontType.TITLE), 12);
}
}

View File

@ -0,0 +1,31 @@
package net.silentclient.client.gui.elements;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.text.DecimalFormat;
public class Slider {
public static void render(int x, int y, int width, String name, double max, double value) {
Client.getInstance().getSilentFontRenderer().drawString(name, x + 100, y + 1 - 2, 12, SilentFontRenderer.FontType.TITLE);
int left = Slider.getLeft(x, width);
RenderUtils.drawRect(left, y, 90, 9, Color.black.getRGB());
RenderUtils.drawRect(left, y, 90F * (float) (value / max), 9, -1);
int textLeft = left + 100 + (Client.getInstance().getSilentFontRenderer().getStringWidth("100.00", 12, SilentFontRenderer.FontType.TITLE) - 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 - 2, 12, SilentFontRenderer.FontType.TITLE);
}
public static int getLeft(int x, int width) {
return x + width - 100 - Client.getInstance().getSilentFontRenderer().getStringWidth("100.00", 12, SilentFontRenderer.FontType.TITLE) - 5;
}
public static boolean isDrag(int mouseX, int mouseY, int x, int y, int width) {
return MouseUtils.isInside(mouseX, mouseY, Slider.getLeft(x, width), y, 90, 9) && Mouse.isButtonDown(0);
}
}

View File

@ -0,0 +1,30 @@
package net.silentclient.client.gui.elements;
import java.awt.Color;
import net.minecraft.client.renderer.GlStateManager;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.ColorUtils;
public class StaticButton {
public static void render(int xPosition, int yPosition, int width, int height, String displayString)
{
StaticButton.render(xPosition, yPosition, width, height, displayString, false);
}
public static void render(int xPosition, int yPosition, int width, int height, String displayString, boolean bold)
{
GlStateManager.disableBlend();
ColorUtils.setColor(new Color(255,255,255,255).getRGB());
RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, new Color(255,255,255,255).getRGB());
Client.getInstance().getSilentFontRenderer().drawCenteredString(displayString, xPosition + width / 2, yPosition + (height - (bold ? 8 : 10)) / 2, bold ? 8 : 10, bold ? SilentFontRenderer.FontType.HEADER : SilentFontRenderer.FontType.TITLE, width - (bold ? 8 : 10));
}
public static boolean isHovered(int mouseX, int mouseY, int xPosition, int yPosition, int width, int height) {
return MouseUtils.isInside(mouseX, mouseY, xPosition, yPosition, width, height);
}
}

View File

@ -0,0 +1,20 @@
package net.silentclient.client.gui.elements;
import java.awt.Color;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.util.RoundedUtils;
public class Switch {
public static void render(int mouseX, int mouseY, float x, float y, SimpleAnimation animation, boolean checked, boolean disabled) {
RoundedUtils.drawRoundedRect(x, y, x + 15, y + 8, 8, disabled ? new Color(229, 62, 62).getRGB() : checked ? Color.GREEN.getRGB() : new Color(255, 255, 255, 61).getRGB());
RoundedUtils.drawRoundedOutline(x, y, x + 15, y + 8, 8, 2, new Color(255, 255, 255, isHovered(mouseX, mouseY, x, y) ? 127 : 0).getRGB());
RoundedUtils.drawRoundedRect(x + 0.5F + (animation.getValue()), y + 0.5F, x + 0.5F + (animation.getValue()) + 7, y + 0.5F + 7, 7, -1);
animation.setAnimation(checked && !disabled ? 15 - 8 : 0, 20);
}
public static boolean isHovered(int mouseX, int mouseY, float x, float y) {
return MouseUtils.isInside(mouseX, mouseY, x, y, 15, 8);
}
}

View File

@ -0,0 +1,463 @@
package net.silentclient.client.gui.font;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import org.apache.commons.io.Charsets;
import org.lwjgl.opengl.GL11;
public class SilentFontRenderer {
private static final ResourceLocation silentFontHeader = new ResourceLocation("silentclient/fonts/silent-font-0.png");
private static final ResourceLocation silentFontTitle = new ResourceLocation("silentclient/fonts/silent-font-1.png");
private static final ResourceLocation silentFontText = new ResourceLocation("silentclient/fonts/silent-font-2.png");
private static final ResourceLocation silentFontDataHeader = new ResourceLocation("silentclient/fonts/silent-font-data-0.json");
private static final ResourceLocation silentFontDataTitle = new ResourceLocation("silentclient/fonts/silent-font-data-1.json");
private static final ResourceLocation silentFontDataText = new ResourceLocation("silentclient/fonts/silent-font-data-2.json");
private Map<Integer, Integer> fontDataHeader;
private Map<Integer, Integer> fontDataTitle;
private Map<Integer, Integer> fontDataText;
private int[] colorCode = new int[32];
@SuppressWarnings("unchecked")
public SilentFontRenderer() throws Throwable
{
try
{
InputStreamReader inputstreamreader = new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(silentFontDataHeader).getInputStream(), Charsets.UTF_8);
Throwable var6 = null;
try
{
this.fontDataHeader = (Map<Integer, Integer>)Client.getInstance().getGson().fromJson((Reader)inputstreamreader, (new TypeToken<Map<Integer, Integer>>()
{
}).getType());
}
catch (Throwable throwable6)
{
var6 = throwable6;
throw throwable6;
}
finally
{
if (inputstreamreader != null)
{
if (var6 != null)
{
try
{
inputstreamreader.close();
}
catch (Throwable throwable5)
{
var6.addSuppressed(throwable5);
}
}
else
{
inputstreamreader.close();
}
}
}
}
catch (IOException ioexception2)
{
ioexception2.printStackTrace();
}
try
{
InputStreamReader inputstreamreader1 = new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(silentFontDataTitle).getInputStream(), Charsets.UTF_8);
Throwable throwable7 = null;
try
{
this.fontDataTitle = (Map<Integer, Integer>)Client.getInstance().getGson().fromJson((Reader)inputstreamreader1, (new TypeToken<Map<Integer, Integer>>()
{
}).getType());
}
catch (Throwable throwable4)
{
throwable7 = throwable4;
throw throwable4;
}
finally
{
if (inputstreamreader1 != null)
{
if (throwable7 != null)
{
try
{
inputstreamreader1.close();
}
catch (Throwable throwable3)
{
throwable7.addSuppressed(throwable3);
}
}
else
{
inputstreamreader1.close();
}
}
}
}
catch (IOException ioexception1)
{
ioexception1.printStackTrace();
}
try
{
InputStreamReader inputstreamreader2 = new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(silentFontDataText).getInputStream(), Charsets.UTF_8);
Throwable throwable8 = null;
try
{
this.fontDataText = (Map<Integer, Integer>)Client.getInstance().getGson().fromJson((Reader)inputstreamreader2, (new TypeToken<Map<Integer, Integer>>()
{
}).getType());
}
catch (Throwable throwable2)
{
throwable8 = throwable2;
throw throwable2;
}
finally
{
if (inputstreamreader2 != null)
{
if (throwable8 != null)
{
try
{
inputstreamreader2.close();
}
catch (Throwable throwable1)
{
throwable8.addSuppressed(throwable1);
}
}
else
{
inputstreamreader2.close();
}
}
}
}
catch (IOException ioexception)
{
ioexception.printStackTrace();
}
for (int l = 0; l < 32; ++l)
{
int i1 = (l >> 3 & 1) * 85;
int i = (l >> 2 & 1) * 170 + i1;
int j = (l >> 1 & 1) * 170 + i1;
int k = (l >> 0 & 1) * 170 + i1;
if (l == 6)
{
i += 85;
}
if (l >= 16)
{
i /= 4;
j /= 4;
k /= 4;
}
this.colorCode[l] = (i & 255) << 16 | (j & 255) << 8 | k & 255;
}
}
private Map<Integer, Integer> bindFontTexture(FontType fontType, boolean mipmapped)
{
switch (fontType)
{
case HEADER:
if (mipmapped)
{
Client.getInstance().getTextureManager().bindTextureMipmapped(silentFontHeader);
}
else
{
Minecraft.getMinecraft().getTextureManager().bindTexture(silentFontHeader);
}
return this.fontDataHeader;
case TITLE:
if (mipmapped)
{
Client.getInstance().getTextureManager().bindTextureMipmapped(silentFontTitle);
}
else
{
Minecraft.getMinecraft().getTextureManager().bindTexture(silentFontTitle);
}
return this.fontDataTitle;
case TEXT:
if (mipmapped)
{
Client.getInstance().getTextureManager().bindTextureMipmapped(silentFontText);
}
else
{
Minecraft.getMinecraft().getTextureManager().bindTexture(silentFontText);
}
return this.fontDataText;
default:
return null;
}
}
private void renderString(float x, float y, String string, int scale, FontType fontType, boolean mipmapped)
{
this.renderString(x, y, string, scale, fontType, mipmapped, 0);
}
private void renderString(float x, float y, String string, int scale, FontType fontType, boolean mipmapped, int italicsWeight)
{
GL11.glEnable(GL11.GL_TEXTURE_2D);
Map<Integer, Integer> map = this.bindFontTexture(fontType, mipmapped);
if (map != null)
{
int i = 0;
boolean flag = false;
GlStateManager.enableAlpha();
GL11.glEnable(GL11.GL_BLEND);
for (char c0 : string.toCharArray())
{
if (flag)
{
++i;
flag = false;
}
else if (c0 == 167 && i + 1 < string.length())
{
int j = "0123456789abcdefklmnor".indexOf(string.toLowerCase().charAt(i + 1));
if (j < 16)
{
if (j < 0 || j > 15)
{
j = 15;
}
int l1 = this.colorCode[j];
GL11.glColor4f((float)(l1 >> 16) / 255.0F, (float)(l1 >> 8 & 255) / 255.0F, (float)(l1 & 255) / 255.0F, 1.0F);
}
++i;
flag = true;
}
else if (map.containsKey(Integer.valueOf(c0)))
{
int k = ((Integer)map.get(Integer.valueOf(c0))).intValue();
int l = (c0 - 32) * 128 % 2048;
int i1 = (c0 - 32 >> 4) * 128;
int j1 = k / scale;
this.getClass();
int k1 = 128 / scale;
float f = 4.8828125E-4F;
float f1 = 4.8828125E-4F;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX);
worldrenderer.pos((double)x, (double)(y + k1), 0.0D).tex((double)((float)l * f), (double)((float)(i1 + 128) * f1)).endVertex();
worldrenderer.pos((double)(x + j1), (double)(y + k1), 0.0D).tex((double)((float)(l + k) * f), (double)((float)(i1 + 128) * f1)).endVertex();
worldrenderer.pos((double)(x + j1 + italicsWeight), (double)y, 0.0D).tex((double)((float)(l + k) * f), (double)((float)i1 * f1)).endVertex();
worldrenderer.pos((double)(x + italicsWeight), (double)y, 0.0D).tex((double)((float)l * f), (double)((float)i1 * f1)).endVertex();
tessellator.draw();
x += j1;
++i;
}
}
GL11.glDisable(GL11.GL_BLEND);
}
}
public void drawString(String string, float x, float y, int fontHeight, FontType fontType)
{
this.getClass();
this.renderString(x, y, string, 128 / fontHeight, fontType, true);
}
public void drawString(String string, int x, int y, int fontHeight, FontType fontType, int maxWidth)
{
this.getClass();
if(this.getStringWidth(string, fontHeight, fontType) > maxWidth) {
int difference = -(maxWidth - this.getStringWidth(string, fontHeight, fontType));
int oneSymbolWidth = this.getStringWidth("a", fontHeight, fontType);
int symbolsCount = difference / oneSymbolWidth;
string = string.substring(0, string.length() - symbolsCount - 3);
string += "...";
}
this.renderString(x, y, string, 128 / fontHeight, fontType, true);
}
public void drawString(int x, int y, String string, int fontHeight, FontType fontType)
{
this.getClass();
this.renderString(x, y, string, 128 / fontHeight, fontType, true);
}
public void drawString(float x, float y, String string, int fontHeight, FontType fontType, boolean mipmapped)
{
this.getClass();
this.renderString(x, y, string, 128 / fontHeight, fontType, mipmapped);
}
public void drawItalicizedString(int x, int y, String string, int fontHeight, FontType fontType)
{
this.getClass();
this.renderString(x, y, string, 128 / fontHeight, fontType, true, 4);
}
public void drawItalicizedString(int x, int y, String string, int fontHeight, FontType fontType, boolean mipmapped)
{
this.getClass();
this.renderString(x, y, string, 128 / fontHeight, fontType, mipmapped, 4);
}
public int getStringWidth(String string, FontType fontType)
{
Map<Integer, Integer> map = this.getFontDataMap(fontType);
if (map != null)
{
int i = 0;
for (char c0 : string.toCharArray())
{
if (map.containsKey(Integer.valueOf(c0)))
{
int j = ((Integer)map.get(Integer.valueOf(c0))).intValue();
i += j;
}
}
return i;
}
else
{
return 0;
}
}
public int getCharWidth(char c, FontType fontType)
{
Map<Integer, Integer> map = this.getFontDataMap(fontType);
return map.containsKey(Integer.valueOf(c)) ? ((Integer)map.get(Integer.valueOf(c))).intValue() : 0;
}
public int getStringWidth(String string, int fontHeight, FontType fontType)
{
Map<Integer, Integer> map = this.getFontDataMap(fontType);
int i = 0;
int j = 0;
boolean flag = false;
for (char c0 : string.toCharArray())
{
if (flag)
{
++j;
flag = false;
}
else if (c0 == 167 && j + 1 < string.length())
{
++j;
flag = true;
}
else if (map.containsKey(Integer.valueOf(c0)))
{
int l = ((Integer)map.get(Integer.valueOf(c0))).intValue();
this.getClass();
int k = l / (128 / fontHeight);
i += k;
}
}
return i;
}
public int getCharWidth(char c, int fontHeight, FontType fontType)
{
Map<Integer, Integer> map = this.getFontDataMap(fontType);
if (map != null && map.containsKey(Integer.valueOf(c)))
{
int i = ((Integer)map.get(Integer.valueOf(c))).intValue();
this.getClass();
return i / (128 / fontHeight);
}
else
{
return 0;
}
}
private Map<Integer, Integer> getFontDataMap(FontType fontType)
{
switch (fontType)
{
case HEADER:
return this.fontDataHeader;
case TITLE:
return this.fontDataTitle;
case TEXT:
return this.fontDataText;
default:
return null;
}
}
public static enum FontType
{
HEADER,
TITLE,
TEXT;
}
public void drawCenteredString(String string, int x, int y, int fontHeight, FontType fontType, int maxWidth) {
this.getClass();
if(this.getStringWidth(string, fontHeight, fontType) > maxWidth) {
int difference = -(maxWidth - this.getStringWidth(string, fontHeight, fontType));
int oneSymbolWidth = this.getStringWidth("a", fontHeight, fontType);
int symbolsCount = difference / oneSymbolWidth;
string = string.substring(0, string.length() - symbolsCount - 3);
string += "...";
}
this.renderString(x - (this.getStringWidth(string, fontHeight, fontType) / 2), y, string, 128 / fontHeight, fontType, true);
}
public void drawCenteredString(String string, int x, int y, int fontHeight, FontType fontType) {
this.getClass();
this.renderString(x - (this.getStringWidth(string, fontHeight, fontType) / 2), y, string, 128 / fontHeight, fontType, true);
}
}

View File

@ -0,0 +1,139 @@
package net.silentclient.client.gui.friends;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.NotificationUtils;
public class AddFriendModal extends SilentScreen {
private final GuiScreen parentScreen;
private int modalWidth;
private int modalHeight;
public AddFriendModal(GuiScreen parentScreen) {
this.parentScreen = parentScreen;
this.modalWidth = 200;
this.modalHeight = 70;
}
@Override
public void initGui() {
MenuBlurUtils.loadBlur();
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.buttonList.add(new IconButton(1, x + this.modalWidth - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
this.buttonList.add(new Button(2, x + 3, y + this.modalHeight - 23, this.modalWidth - 6, 20, "Add Friend"));
this.silentInputs.add(new Input("Username"));
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
switch (button.id) {
case 1:
mc.displayGuiScreen(parentScreen);
break;
case 2:
if(this.silentInputs.get(0).getValue().length() != 0) {
try {
URL url = new URL("https://api.silentclient.net/friends/send_request");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("User-Agent", "SilentClient");
con.setRequestProperty("Authorization", "Bearer " + Client.getInstance().getUserData().getAccessToken());
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setDoOutput(true);
String jsonInputString = "{\"username\": \"" + this.silentInputs.get(0).getValue() + "\"}";
try(OutputStream os = con.getOutputStream()) {
byte[] input = jsonInputString.getBytes("utf-8");
os.write(input, 0, input.length);
}
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
con.disconnect();
Client.getInstance().updateFriendsList();
mc.displayGuiScreen(parentScreen);
} catch (IOException e) {
e.printStackTrace();
NotificationUtils.showNotification("Error", "User not found or you have already added him as a friend");
}
} else {
NotificationUtils.showNotification("Error", "Please enter a username");
}
break;
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
GlStateManager.pushMatrix();
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
// Header
RenderUtils.drawRect(x, y, this.modalWidth, this.modalHeight, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString("Add Friend", x + 3, y + 3, 14, SilentFontRenderer.FontType.TITLE);
// Content
this.silentInputs.get(0).render(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);
super.drawScreen(mouseX, mouseY, partialTicks);
GlStateManager.popMatrix();
NotificationManager.render();
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int x = width / 2 - (this.modalWidth / 2);
int y = height / 2 - (this.modalHeight / 2);
this.silentInputs.get(0).onClick(mouseX, mouseY, x + 3, y + 23, this.modalWidth - 6);
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_ESCAPE) {
mc.displayGuiScreen(parentScreen);
return;
};
this.silentInputs.get(0).onKeyTyped(typedChar, keyCode);
}
}

View File

@ -0,0 +1,202 @@
package net.silentclient.client.gui.friends;
import java.awt.Color;
import java.io.IOException;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
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.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.clickgui.TabButton;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.theme.Theme;
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.types.FriendsResponse;
public class FriendsListOverlay extends GuiScreen {
private double scrollY;
private SimpleAnimation scrollAnimation = new SimpleAnimation(0.0F);
private boolean showRequests;
private SimpleAnimation introAnimation;
@Override
public void initGui() {
super.initGui();
this.introAnimation = new SimpleAnimation(Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Menu Animations").getValBoolean() ? -150 : 0);
Client.getInstance().updateFriendsList();
this.scrollY = 0;
MenuBlurUtils.loadBlur();
this.buttonList.add(new IconButton(1, 133, 6, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
this.buttonList.add(new TabButton(2, 3, 26, 70, 15, "Friends", 12, !showRequests));
this.buttonList.add(new TabButton(3, 76, 26, 70, 15, "Requests", 12, showRequests));
this.buttonList.add(new IconButton(4, 116, 6, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/friends-add.png")));
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
this.buttonList.get(2).displayString = "Requests (" + Client.getInstance().getFriends().getRequestCount() + ")";
SilentFontRenderer font = Client.getInstance().getSilentFontRenderer();
GlStateManager.pushMatrix();
int width = 150;
GlStateManager.translate(this.introAnimation.getValue(), 0, 0);
this.introAnimation.setAnimation(0, 30);
RenderUtils.drawRect(0, 0, width, height, Theme.backgroundColor().getRGB());
RenderUtil.drawImage(Client.getInstance().getAccount().getSelectedIcon() != 0 && !Client.getInstance().getAccount().plusIcon() ? Client.getInstance().getCosmetics().getIconById(Client.getInstance().getAccount().getSelectedIcon()) : new ResourceLocation(Client.getInstance().getAccount().plusIcon() ? "silentclient/icons/plus_icon.png" : "silentclient/icons/player_icon.png"), 3, 5, 18, 18, false);
ColorUtils.setColor(new Color(9, 165, 51).getRGB());
font.drawString(Client.getInstance().getAccount().original_username, 23, 5 - 2, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB());
font.drawString(mc.getCurrentServerData() == null ? "Online" : "Playing on " + mc.getCurrentServerData().serverIP, 23, 5 + 8, 10, SilentFontRenderer.FontType.TITLE, 94);
super.drawScreen(mouseX, mouseY, partialTicks);
int friendY = 46 - (int) scrollAnimation.getValue();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_SCISSOR_TEST);
ScaledResolution r = new ScaledResolution(mc);
int s = r.getScaleFactor();
int listHeight = height - 46;
int translatedY = r.getScaledHeight() - 46 - listHeight;
GL11.glScissor(0 * s, translatedY * s, width * s, listHeight * s);
if(!showRequests) {
for(FriendsResponse.Friend friend : Client.getInstance().getFriends().getFriends()) {
RenderUtil.drawImage(friend.getIcon(), 3, friendY, 18, 18, false);
if(friend.isOnline()) {
ColorUtils.setColor(new Color(9, 165, 51).getRGB());
} else {
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
}
font.drawString(friend.getUsername(), 23, friendY - 2, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB());
font.drawString(friend.isOnline() ? friend.getCurrentServer().equals("") ? "Online" : "Playing on " + friend.getCurrentServer() : "Offline", 23, friendY + 8, 10, SilentFontRenderer.FontType.TITLE, 108);
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/cross.png"), 135, friendY + 3, 12, 12, false);
friendY += 25;
}
} else {
for(FriendsResponse.Request request : Client.getInstance().getFriends().getRequests()) {
RenderUtil.drawImage(request.getIcon(), 3, friendY, 18, 18, false);
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
font.drawString(request.getUsername(), 23, friendY - 2, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB());
font.drawString(request.isIncoming() ? "Incoming Friend Request" : "Outgoing Friend Request", 23, friendY + 8, 10, SilentFontRenderer.FontType.TITLE);
if(request.isIncoming()) {
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/accept.png"), 120, friendY + 3, 12, 12, false);
}
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/cross.png"), 135, friendY + 3, 12, 12, false);
friendY += 25;
}
}
GL11.glDisable(GL11.GL_SCISSOR_TEST);
GL11.glPopMatrix();
GlStateManager.popMatrix();
if(scrollY > height) {
scrollAnimation.setAnimation((float) scrollY, 16);
}
NotificationManager.render();
}
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
int dw = Mouse.getEventDWheel();
if(dw != 0) {
if (dw > 0) {
dw = -1;
} else {
dw = 1;
}
float amountScrolled = (float) (dw * 10);
if (scrollY + amountScrolled > 0)
scrollY += amountScrolled;
else
scrollY = 0;
}
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
super.actionPerformed(button);
if(button instanceof TabButton) {
TabButton tab = (TabButton) button;
if(tab.id == 2) {
showRequests = false;
} else {
showRequests = true;
}
scrollY = 0;
this.buttonList.forEach(oldButton -> {
if(oldButton instanceof TabButton) {
TabButton tabB = (TabButton) oldButton;
tabB.selected = false;
}
});
tab.selected = true;
}
switch (button.id) {
case 1:
mc.displayGuiScreen(null);
break;
case 4:
mc.displayGuiScreen(new AddFriendModal(this));
break;
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int friendY = 46 + (int) scrollY;
if(!showRequests) {
for(FriendsResponse.Friend friend : Client.getInstance().getFriends().getFriends()) {
if(MouseUtils.isInside(mouseX, mouseY, 135, friendY + 3, 12, 12)) {
(new Thread("cancelFriendRequest") {
public void run() {
friend.cancelRequest();
}
}).start();
}
friendY += 25;
}
} else {
for(FriendsResponse.Request request : Client.getInstance().getFriends().getRequests()) {
if(request.isIncoming() && MouseUtils.isInside(mouseX, mouseY, 120, friendY + 3, 12, 12)) {
(new Thread("acceptFriendRequest") {
public void run() {
request.acceptRequest();
}
}).start();
}
if(MouseUtils.isInside(mouseX, mouseY, 135, friendY + 3, 12, 12)) {
(new Thread("cancelFriendRequest") {
public void run() {
request.cancelRequest();
}
}).start();
}
friendY += 25;
}
}
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
MenuBlurUtils.unloadBlur();
}
}

View File

@ -0,0 +1,243 @@
package net.silentclient.client.gui.hud;
import java.awt.Color;
import java.io.IOException;
import java.text.DecimalFormat;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.utils.MenuBlurUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import net.minecraft.client.Minecraft;
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.clickgui.ModSettings;
import net.silentclient.client.gui.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.font.SilentFontRenderer.FontType;
import net.silentclient.client.mods.CustomFontRenderer;
import net.silentclient.client.mods.CustomFontRenderer.RenderMode;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModDraggable;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.Sounds;
public class HUDConfigScreen extends GuiScreen {
private final GuiScreen screen;
private CustomFontRenderer font;
private boolean tutorial = false;
private Mod mod = null;
@Override
public void initGui() {
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.font = new CustomFontRenderer();
font.setRenderMode(RenderMode.CUSTOM);
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m instanceof ModDraggable) {
((ModDraggable) m).setDragging(false);
}
}
}
public HUDConfigScreen(GuiScreen screen) {
this.screen = screen;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
super.drawDefaultBackground();
final float zBackup = this.zLevel;
this.zLevel = 200;
ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft());
boolean debug = Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Gui Debug").getValBoolean();
if(debug) {
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(0, 0, "mX: " + mouseX, 6, FontType.TITLE);
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(0, 6, "mY: " + mouseY, 6, FontType.TITLE);
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(0, 12, "width: " + scaledresolution.getScaledWidth() * Client.getInstance().getScaleFactor(), 6, FontType.TITLE);
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(0, 18, "height: " + scaledresolution.getScaledHeight() * Client.getInstance().getScaleFactor(), 6, FontType.TITLE);
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(0, 24, "scale: " + Client.getInstance().getScaleFactor(), 6, FontType.TITLE);
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(0, 30, "mouseDown: " + Mouse.isButtonDown(0), 6, FontType.TITLE);
ColorUtils.setColor(-1);
Client.getInstance().getSilentFontRenderer().drawString(0, 36, "selectedMod: " + (this.mod != null ? this.mod.getClass().getName() : "null"), 6, FontType.TITLE);
}
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m.isEnabled() && m instanceof ModDraggable) {
((ModDraggable) m).renderEditing(mouseX, mouseY, scaledresolution, debug, this);
if(((ModDraggable) m).isDragging()) {
((ModDraggable) m).setPos(new ScreenPosition(mouseX + ((ModDraggable) m).getDraggingX(), mouseY + ((ModDraggable) m).getDraggingY()));
}
}
}
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();
}
@Override
protected void actionPerformed(GuiButton button) throws IOException {
// TODO Auto-generated method stub
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(new ModSettings(mod, this));
} else {
this.tutorial = true;
this.mod = null;
this.buttonList.get(1).visible = false;
this.buttonList.get(1).displayString = "Help";
}
break;
}
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if(keyCode == Keyboard.KEY_ESCAPE) {
Sounds.playButtonSound();
mc.displayGuiScreen(null);
}
}
@Override
protected void mouseClickMove(int x, int y, int button, long time) {
super.mouseClickMove(x, y, button, time);
}
@Override
public void onGuiClosed() {
MenuBlurUtils.unloadBlur();
Client.getInstance().configManager.save();
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m instanceof ModDraggable) {
((ModDraggable) m).setDragging(false);
}
}
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m instanceof ModDraggable) {
((ModDraggable) m).setDragging(false);
}
}
}
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
ScaledResolution scaledResolution = new ScaledResolution(mc);
for(Mod m : Client.getInstance().getModInstances().getMods()) {
if(m.isEnabled() && m instanceof ModDraggable) {
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);
}
break;
}
}
}
}
@Override
public boolean doesGuiPauseGame() {
return true;
}
}

View File

@ -0,0 +1,7 @@
package net.silentclient.client.gui.hud;
public interface IRenderConfig {
public void Save(ScreenPosition pos);
public ScreenPosition load();
}

Some files were not shown because too many files have changed in this diff Show More