Merge pull request #96 from Silent-Client/TEST2

2.1.0-beta.1
This commit is contained in:
kirillsaint 2024-01-21 15:16:10 +06:00 committed by GitHub
commit 6664bc1a2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
77 changed files with 3438 additions and 230 deletions

4
.gitignore vendored
View File

@ -13,7 +13,9 @@ autobuilder/temp/
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
.idea/libraries
.idea/misc.xml
.idea/gradle.xml
*.iws
*.iml
*.ipr

View File

@ -5,7 +5,6 @@
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="zulu-1.8 (4)" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View File

@ -4,7 +4,7 @@
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="zulu-1.8 (3)" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="zulu-1.8 (4)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

Binary file not shown.

View File

@ -72,6 +72,8 @@ async function build() {
console.log(`Extracting ${lib}`);
await unzip(assetsPaths.libs + `/${lib}`, tempPaths.jar);
}
console.log(`Extracting asm-tree-5.2.jar`);
await unzip("./assets/asm-tree-5.2.jar", tempPaths.jar);
console.log("Cleaning up extra files in JAR");
try {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,35 @@
package me.djtheredstoner.lwjgl;
import org.lwjgl.opengl.GLContext;
import org.lwjgl.system.FunctionProvider;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
public class Lwjgl2FunctionProvider implements FunctionProvider {
private final Method m_getFunctionAddress;
public Lwjgl2FunctionProvider() {
try {
m_getFunctionAddress = GLContext.class.getDeclaredMethod("getFunctionAddress", String.class);
m_getFunctionAddress.setAccessible(true);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public long getFunctionAddress(CharSequence functionName) {
try {
return (long) m_getFunctionAddress.invoke(null, functionName.toString());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public long getFunctionAddress(ByteBuffer byteBuffer) {
throw new UnsupportedOperationException();
}
}

View File

@ -8,6 +8,7 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.resources.data.IMetadataSerializer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Session;
import net.silentclient.client.config.ConfigManager;
import net.silentclient.client.cosmetics.Cosmetics;
import net.silentclient.client.event.EventManager;
@ -26,6 +27,7 @@ import net.silentclient.client.keybinds.KeyBindManager;
import net.silentclient.client.mixin.SilentClientTweaker;
import net.silentclient.client.mixin.accessors.MinecraftAccessor;
import net.silentclient.client.mixin.ducks.AbstractClientPlayerExt;
import net.silentclient.client.mixin.ducks.MinecraftExt;
import net.silentclient.client.mods.ModInstances;
import net.silentclient.client.mods.SettingsManager;
import net.silentclient.client.mods.settings.CosmeticsMod;
@ -34,6 +36,7 @@ import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.mods.util.PingSource;
import net.silentclient.client.mods.util.Server;
import net.silentclient.client.mods.util.Utils;
import net.silentclient.client.nanovg.UI;
import net.silentclient.client.premium.PremiumCosmeticsGui;
import net.silentclient.client.premium.PremiumUtils;
import net.silentclient.client.skillissue.SkillIssue;
@ -59,7 +62,7 @@ import java.util.List;
public class Client {
public static final Logger logger = LogManager.getLogger("SC");
private final String version = "2.0.1";
private final String version = "2.1.0";
private static final Client INSTANCE = new Client();
public static final Client getInstance() {
@ -200,6 +203,10 @@ public class Client {
if(acc != null) {
Client.getInstance().setAccount(acc.getAccount());
if(ClientUtils.isDevelopment()) {
Session session = new Session(account.original_username, AccountManager.nameToUuid(account.original_username), "0", "legacy");
((MinecraftExt) Minecraft.getMinecraft()).setSession(session);
}
}
logger.info("STARTING > settings-manager");
settingsManager = new SettingsManager();
@ -278,10 +285,12 @@ public class Client {
Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(mod.getIcon()));
}
});
logger.info("STARTING > ui");
UI.init();
logger.info("STARTING > servers");
ArrayList<FeaturedServers.FeaturedServerInfo> servers = FeaturedServers.get();
featuredServers.clear();
if(servers != null && servers != null) {
if(servers != null) {
servers.forEach(server -> {
featuredServers.add(new ServerDataFeature(server.getName(), server.getIp()));
});

View File

@ -13,6 +13,7 @@ import net.silentclient.client.utils.MenuBlurUtils;
import java.awt.*;
import java.io.*;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -190,6 +191,11 @@ public final class ConfigManager {
}
}
if(set.isCellGrid()) {
try {
set.setCells(stringToBooleanArray(args[3]));
} catch (Exception ignored) {}
}
if (set.isCombo()) {
try {
if(set.getOptions().contains(args[3])) {
@ -247,6 +253,32 @@ public final class ConfigManager {
}
}
public static String booleanArrayToString(boolean[][] cells) {
StringBuilder sb = new StringBuilder();
for (boolean[] row : cells) {
for (boolean cell : row) {
sb.append(cell ? '1' : '0');
}
sb.append('/');
}
return sb.toString();
}
public static boolean[][] stringToBooleanArray(String input) {
String[] rows = input.trim().split("/");
int numRows = rows.length;
int numCols = rows[0].length();
boolean[][] result = new boolean[numRows][numCols];
for (int i = 0; i < numRows; i++) {
for (int j = 0; j < numCols; j++) {
result[i][j] = rows[i].charAt(j) == '1';
}
}
return result;
}
public void save() {
Client.logger.info("Saving Config: " + this.configFile.getName());
try(PrintWriter writer = new PrintWriter(this.configFile)) {
@ -277,6 +309,9 @@ public final class ConfigManager {
if(set.isKeybind()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + set.getKeybind());
}
if(set.isCellGrid()) {
writer.println("SET:" + set.getName() + ":" + set.getParentMod().getName() + ":" + booleanArrayToString(set.getCells()));
}
}
for(AutoTextCommand command : Client.getInstance().getModInstances().getAutoText().getCommands()) {

View File

@ -0,0 +1,276 @@
package net.silentclient.client.gui.elements;
import net.minecraft.client.gui.Gui;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.util.RenderUtil;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class HSBPicker extends Gui {
public float[] color;
private boolean pickingColor;
private boolean pickingHue;
private boolean pickingAlpha;
private int pickerX, pickerY, pickerWidth, pickerHeight;
private int hueSliderX, hueSliderY, hueSliderWidth, hueSliderHeight;
private int alphaSliderX, alphaSliderY, alphaSliderWidth, alphaSliderHeight;
private boolean rainbowState = false;
private final int x, y, width, height;
private int selectedColorFinal = -1;
private Color selectedColorFinalAsColor;
public int cursorX;
public int cursorY;
public boolean alphaSlider = true;
public String text;
public SimpleAnimation sx = new SimpleAnimation(0f);
public SimpleAnimation sy = new SimpleAnimation(0f);
public HSBPicker(int x, int y, int width, int height, boolean alphaSlider, String text) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.color = new float[]{0.4f, 1.0f, 1.0f, 1.0f};
this.pickingColor = false;
this.alphaSlider = alphaSlider;
this.text = text;
}
public void init() {
this.pickerWidth = width;
this.pickerHeight = height;
this.pickerX = x;
this.pickerY = y;
this.hueSliderX = pickerX;
this.hueSliderY = pickerY + pickerHeight + 6;
this.hueSliderWidth = pickerWidth;
this.hueSliderHeight = 6;
this.alphaSliderX = pickerX + pickerWidth + 6;
this.alphaSliderY = pickerY;
this.alphaSliderWidth = 6;
this.alphaSliderHeight = pickerHeight;
}
public void render(int mouseX, int mouseY) {
if (this.rainbowState) {
double rainbowState = Math.ceil((System.currentTimeMillis() + 200) / 20.0);
rainbowState %= 360.0;
this.color[0] = (float) (rainbowState / 360.0);
}
if (this.pickingHue) {
if (this.hueSliderWidth > this.hueSliderHeight) {
float restrictedX = (float) Math.min(Math.max(hueSliderX, mouseX), hueSliderX + hueSliderWidth);
this.color[0] = (restrictedX - (float) hueSliderX) / hueSliderWidth;
} else {
float restrictedY = (float) Math.min(Math.max(hueSliderY, mouseY), hueSliderY + hueSliderHeight);
this.color[0] = (restrictedY - (float) hueSliderY) / hueSliderHeight;
}
}
if (this.pickingAlpha) {
if (this.alphaSliderWidth > this.alphaSliderHeight) {
float restrictedX = (float) Math.min(Math.max(alphaSliderX, mouseX), alphaSliderX + alphaSliderWidth);
this.color[3] = 1 - (restrictedX - (float) alphaSliderX) / alphaSliderWidth;
} else {
float restrictedY = (float) Math.min(Math.max(alphaSliderY, mouseY), alphaSliderY + alphaSliderHeight);
this.color[3] = 1 - (restrictedY - (float) alphaSliderY) / alphaSliderHeight;
}
}
if (this.pickingColor) {
float restrictedX = (float) Math.min(Math.max(pickerX, mouseX), pickerX + pickerWidth);
float restrictedY = (float) Math.min(Math.max(pickerY, mouseY), pickerY + pickerHeight);
this.color[1] = (restrictedX - (float) pickerX) / pickerWidth;
this.color[2] = 1 - (restrictedY - (float) pickerY) / pickerHeight;
}
int selectedX = pickerX + pickerWidth + 6;
int selectedY = pickerY + pickerHeight + 6;
int selectedWidth = 6;
int selectedHeight = 6;
Gui.drawRect(pickerX - 1, pickerY - 1, pickerX + pickerWidth + 1, pickerY + pickerHeight + 1, new Color(0, 0, 0, 0).getRGB());
Gui.drawRect(hueSliderX - 1, hueSliderY - 1, hueSliderX + hueSliderWidth + 1, hueSliderY + hueSliderHeight + 1, new Color(0, 0, 0, 0).getRGB());
Gui.drawRect(alphaSliderX - 1, alphaSliderY - 1, alphaSliderX + alphaSliderWidth + 1, alphaSliderY + alphaSliderHeight + 1, new Color(0, 0, 0, 0).getRGB());
int selectedColor = Color.HSBtoRGB(this.color[0], 1.0f, 1.0f);
float selectedRed = (selectedColor >> 16 & 0xFF) / 255.0f;
float selectedGreen = (selectedColor >> 8 & 0xFF) / 255.0f;
float selectedBlue = (selectedColor & 0xFF) / 255.0f;
this.drawPickerBase(pickerX, pickerY, pickerWidth, pickerHeight, selectedRed, selectedGreen, selectedBlue, 255);
this.drawHueSlider(hueSliderX, hueSliderY, hueSliderWidth, hueSliderHeight, this.color[0]);
if (alphaSlider) {
this.drawAlphaSlider(alphaSliderX, alphaSliderY, alphaSliderWidth, alphaSliderHeight, selectedRed, selectedGreen, selectedBlue, this.color[3]);
}
selectedColorFinal = alpha(new Color(Color.HSBtoRGB(this.color[0], this.color[1], this.color[2])), this.color[3]);
selectedColorFinalAsColor = color(new Color(Color.HSBtoRGB(this.color[0], this.color[1], this.color[2])), this.color[3]);
Gui.drawRect(selectedX - 1, selectedY - 1, selectedX + selectedWidth + 1, selectedY + selectedHeight + 1, new Color(0, 0, 0, 0).getRGB());
Gui.drawRect(selectedX, selectedY, selectedX + selectedWidth, selectedY + selectedHeight, selectedColorFinal);
cursorX = (int) (pickerX + color[1] * pickerWidth);
cursorY = (int) ((pickerY + pickerHeight) - color[2] * pickerHeight);
sx.setAnimation(cursorX, 25f);
sy.setAnimation(cursorY, 25f);
RenderUtils.drawRect(sx.getValue() - 1, sy.getValue() - 1, 2, 2, Color.WHITE.getRGB());
}
final int alpha(Color color, float alpha) {
final float red = (float) color.getRed() / 255;
final float green = (float) color.getGreen() / 255;
final float blue = (float) color.getBlue() / 255;
return new Color(red, green, blue, alpha).getRGB();
}
final Color color(Color color, float alpha) {
final float red = (float) color.getRed() / 255;
final float green = (float) color.getGreen() / 255;
final float blue = (float) color.getBlue() / 255;
return new Color(red, green, blue, alpha);
}
public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
this.pickingColor = check(pickerX, pickerY, pickerX + pickerWidth, pickerY + pickerHeight, mouseX, mouseY);
this.pickingHue = check(hueSliderX, hueSliderY, hueSliderX + hueSliderWidth, hueSliderY + hueSliderHeight, mouseX, mouseY);
if (alphaSlider) {
this.pickingAlpha = check(alphaSliderX, alphaSliderY, alphaSliderX + alphaSliderWidth, alphaSliderY + alphaSliderHeight, mouseX, mouseY);
}
}
public void mouseReleased(int mouseX, int mouseY, int state) {
this.pickingColor = this.pickingHue = this.pickingAlpha = false;
}
private void drawHueSlider(int x, int y, int width, int height, float hue) {
int step = 0;
if (height > width) {
Gui.drawRect(x, y, x + width, y + 4, 0xFFFF0000);
y += 4;
for (int colorIndex = 0; colorIndex < 6; colorIndex++) {
int previousStep = Color.HSBtoRGB((float) step / 6, 1.0f, 1.0f);
int nextStep = Color.HSBtoRGB((float) (step + 1) / 6, 1.0f, 1.0f);
this.drawGradientRect(x, y + step * (height / 6), x + width, y + (step + 1) * (height / 6), previousStep, nextStep);
step++;
}
final int sliderMinY = (int) (y + (height * hue)) - 4;
Gui.drawRect(x, sliderMinY - 1, x + width, sliderMinY + 1, -1);
} else {
for (int colorIndex = 0; colorIndex < 6; colorIndex++) {
int previousStep = Color.HSBtoRGB((float) step / 6, 1.0f, 1.0f);
int nextStep = Color.HSBtoRGB((float) (step + 1) / 6, 1.0f, 1.0f);
this.gradient(x + step * (width / 6), y, x + (step + 1) * (width / 6), y + height, previousStep, nextStep, true);
step++;
}
final int sliderMinX = (int) (x + (width * hue));
Gui.drawRect(sliderMinX - 1, y, sliderMinX, y + height, -1);
}
}
private void drawAlphaSlider(int x, int y, int width, int height, float red, float green, float blue, float alpha) {
boolean left = true;
int checkerBoardSquareSize = width / 2;
for (int squareIndex = -checkerBoardSquareSize; squareIndex < height; squareIndex += checkerBoardSquareSize) {
if (!left) {
Gui.drawRect(x, y + squareIndex, x + width, y + squareIndex + checkerBoardSquareSize, 0xFFFFFFFF);
Gui.drawRect(x + checkerBoardSquareSize, y + squareIndex, x + width, y + squareIndex + checkerBoardSquareSize, 0xFF909090);
if (squareIndex < height - checkerBoardSquareSize) {
int minY = y + squareIndex + checkerBoardSquareSize;
int maxY = Math.min(y + height, y + squareIndex + checkerBoardSquareSize * 2);
Gui.drawRect(x, minY, x + width, maxY, 0xFF909090);
Gui.drawRect(x + checkerBoardSquareSize, minY, x + width, maxY, 0xFFFFFFFF);
}
}
left = !left;
}
this.gradient(x, y, x + width, y + height, new Color((int)red, (int)green, (int)blue, 255).getRGB(), 0, false);
final int sliderMinY = (int) (y + height - (height * alpha));
Gui.drawRect(x, sliderMinY - 1, x + width, sliderMinY, -1);
}
private void drawPickerBase(int pickerX, int pickerY, int pickerWidth, int pickerHeight, float red, float green, float blue, float alpha) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glBegin(GL11.GL_POLYGON);
{
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
GL11.glVertex2f(pickerX, pickerY);
GL11.glVertex2f(pickerX, pickerY + pickerHeight);
GL11.glColor4f(red, green, blue, alpha);
GL11.glVertex2f(pickerX + pickerWidth, pickerY + pickerHeight);
GL11.glVertex2f(pickerX + pickerWidth, pickerY);
}
GL11.glEnd();
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glBegin(GL11.GL_POLYGON);
{
GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glVertex2f(pickerX, pickerY);
GL11.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
GL11.glVertex2f(pickerX, pickerY + pickerHeight);
GL11.glVertex2f(pickerX + pickerWidth, pickerY + pickerHeight);
GL11.glColor4f(0.0f, 0.0f, 0.0f, 0.0f);
GL11.glVertex2f(pickerX + pickerWidth, pickerY);
}
GL11.glEnd();
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
}
protected void gradient(int minX, int minY, int maxX, int maxY, int startColor, int endColor, boolean left) {
if (left) {
final float startA = (startColor >> 24 & 0xFF) / 255.0f;
final float startR = (startColor >> 16 & 0xFF) / 255.0f;
final float startG = (startColor >> 8 & 0xFF) / 255.0f;
final float startB = (startColor & 0xFF) / 255.0f;
final float endA = (endColor >> 24 & 0xFF) / 255.0f;
final float endR = (endColor >> 16 & 0xFF) / 255.0f;
final float endG = (endColor >> 8 & 0xFF) / 255.0f;
final float endB = (endColor & 0xFF) / 255.0f;
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glBegin(GL11.GL_POLYGON);
{
GL11.glColor4f(startR, startG, startB, startA);
GL11.glVertex2f(minX, minY);
GL11.glVertex2f(minX, maxY);
GL11.glColor4f(endR, endG, endB, endA);
GL11.glVertex2f(maxX, maxY);
GL11.glVertex2f(maxX, minY);
}
GL11.glEnd();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
} else drawGradientRect(minX, minY, maxX, maxY, startColor, endColor);
}
protected boolean check(int minX, int minY, int maxX, int maxY, int curX, int curY) {
return curX >= minX && curY >= minY && curX < maxX && curY < maxY;
}
public Color getSelectedColorFinal() {
return new Color(selectedColorFinal);
}
public void setFinalColor(Color color) {
float r = color.getRed() / 255.0F;
float g = color.getGreen() / 255.0F;
float b = color.getBlue() / 255.0F;
float a = color.getAlpha() / 255.0F;
this.color[0] = r;
this.color[1] = g;
this.color[2] = b;
this.color[3] = a;
}
}

View File

@ -8,14 +8,13 @@ import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.normal.Direction;
import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.HSBPicker;
import net.silentclient.client.gui.elements.Slider;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.Mod;
@ -38,12 +37,16 @@ public class GuiColorPicker extends SilentScreen {
private final String value;
private long initTime;
public GuiColorPicker(Mod mod, String value, GuiScreen parent) {
private HSBPicker hsb;
public GuiColorPicker(Mod mod, String value, GuiScreen parentScreen) {
if (mod == null) throw new IllegalArgumentException("Mod is null");
this.mod = mod;
this.parentScreen = parent;
this.parentScreen = parentScreen;
this.value = value;
float colorY = 80;
int colorX = 3;
}
@Override
@ -51,29 +54,19 @@ public class GuiColorPicker extends SilentScreen {
defaultCursor = false;
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;
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
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"));
hsb = new HSBPicker(x + 100, y + 40, 120, 70, false, value);
float[] vals = Color.RGBtoHSB(setting.getValColor(true).getRed(),setting.getValColor(true).getGreen(), setting.getValColor(true).getBlue(), null);
hsb.color = new float[] {vals[0],vals[1],vals[2], setting.getValColor(true).getAlpha() / 255.0f};
hsb.init();
}
@Override
@ -112,40 +105,30 @@ public class GuiColorPicker extends SilentScreen {
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());
if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
spacing += 25;
colorIndex += 1;
if(colorIndex == 5 || colorIndex == 10) {
spacing = 100;
settingY += 30;
}
}
setting.setValColor(hsb.getSelectedColorFinal());
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());
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
settingY += settingHeight + 90;
hsb.render(mouseX, mouseY);
if(setting.isCanChangeOpacity()) {
GlStateManager.color(1, 1, 1, 1);
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;
double mouse = MathHelper.clamp_double((double) (mouseX - Slider.getLeft(x, width)) / 90D, 0, 1);
double newVal = 0 + mouse * diff;
setting.setOpacity((int) newVal);
}
}
GL11.glPopMatrix();
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15);
@ -196,23 +179,7 @@ public class GuiColorPicker extends SilentScreen {
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);
hsb.mouseClicked(mouseX, mouseY, mouseButton);
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
Sounds.playButtonSound();
@ -220,10 +187,17 @@ public class GuiColorPicker extends SilentScreen {
}
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
hsb.mouseReleased(mouseX, mouseY, state);
super.mouseReleased(mouseX, mouseY, state);
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (keyCode == Keyboard.KEY_ESCAPE) {
ClickGUI.close = true;
Client.getInstance().configManager.save();
}
}
}

View File

@ -16,13 +16,14 @@ import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils.Scroll;
import net.silentclient.client.gui.elements.*;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.modmenu.CellGrid;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.theme.input.DefaultInputTheme;
import net.silentclient.client.gui.util.RenderUtil;
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.render.crosshair.CrosshairMod;
import net.silentclient.client.mods.world.TimeChangerMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.MenuBlurUtils;
@ -198,6 +199,13 @@ public class ModSettings extends SilentScreen {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
}
if(setting.isCellGrid()) {
MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, x + 100, settingY, setting);
if(cellGridCursor != null) {
cursorType = cellGridCursor;
}
settingY += 135;
}
if (setting.isSlider()) {
Slider.render(x, settingY - 1, width, setting.getName(), setting.getMax(), setting.getValDouble());
@ -354,7 +362,10 @@ public class ModSettings extends SilentScreen {
settingY += 5;
inputIndex++;
}
if(setting.isCellGrid()) {
CellGrid.click(mouseX, mouseY, mouseButton, setting);
settingY += 135;
}
if(setting.isCombo()) {
int index = 0;
String curr = setting.getValString();
@ -437,6 +448,16 @@ public class ModSettings extends SilentScreen {
}
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
if(setting.isCellGrid()) {
CellGrid.release();
}
}
super.mouseReleased(mouseX, mouseY, state);
}
@Override
public boolean doesGuiPauseGame() {
return !(this.mod instanceof TimeChangerMod);

View File

@ -0,0 +1,76 @@
package net.silentclient.client.gui.modmenu;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.utils.MouseCursorHandler;
import java.awt.*;
/**
* @author refactoring
*/
public class CellGrid {
private static IconButton trashBtn = new IconButton(0,0,0,new ResourceLocation("silentclient/icons/trash-icon.png"));
private static boolean rmb;
private static boolean lmb;
public static MouseCursorHandler.CursorType render(float mouseX, float mouseY, float x, float y, Setting grid) {
MouseCursorHandler.CursorType cursorType = null;
for (int row = 0; row < 11; row++) {
for (int col = 0; col < 11; col++) {
float rx = x + col * 11;
float ry = y + row * 11;
RenderUtil.drawRoundedOutline(rx, ry, 11, 11, 0f, 1f, new Color(255, 255, 255, 120).getRGB());
RenderUtils.drawRect(rx, ry, 11, 11,
grid.getCells()[row][col] ?
MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11) ? 0x70ffffff : 0x50ffffff :
MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11) ? 0x20ffffff : 0x00ffffff
);
if(MouseUtils.isInside((int) mouseX, (int) mouseY, rx, ry, 11, 11)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
if(rmb) {
grid.getCells()[row][col] = true;
}
if(lmb) {
grid.getCells()[row][col] = false;
}
}
}
}
trashBtn.xPosition = (int)x;
trashBtn.yPosition = (int)y + 125;
trashBtn.drawButton(Minecraft.getMinecraft(), (int)mouseX, (int)mouseY);
if(trashBtn.isMouseOver()) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
return cursorType;
}
public static void click(float mouseX, float mouseY, int btn, Setting setting) {
if(trashBtn.isMouseOver() && btn == 0) {
setting.setCells(new boolean[11][11]);
} else {
if(btn == 1) {
lmb = true;
} else if (btn == 0) {
rmb = true;
}
}
}
public static void release() {
lmb = false;
rmb = false;
}
}

View File

@ -2,15 +2,15 @@ package net.silentclient.client.gui.modmenu;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.elements.HSBPicker;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import net.silentclient.client.mods.Setting;
@ -27,6 +27,7 @@ public class ColorPicker extends SilentScreen {
private final GuiScreen parentScreen;
private ArrayList<Color> colors = new ArrayList<Color>();
private final String value;
private HSBPicker hsb;
public ColorPicker(Mod mod, String value, GuiScreen parentScreen) {
if (mod == null) throw new IllegalArgumentException("Mod is null");
@ -34,6 +35,13 @@ public class ColorPicker extends SilentScreen {
this.mod = mod;
this.parentScreen = parentScreen;
this.value = value;
float colorY = 80;
int colorX = 3;
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
hsb = new HSBPicker((int)colorX, (int)colorY, 120, 70, false, value);
float[] vals = Color.RGBtoHSB(setting.getValColor(true).getRed(),setting.getValColor(true).getGreen(), setting.getValColor(true).getBlue(), null);
hsb.color = new float[] {vals[0],vals[1],vals[2], setting.getValColor(true).getAlpha() / 255.0f};
hsb.init();
}
@Override
@ -52,23 +60,6 @@ public class ColorPicker extends SilentScreen {
if(mod.getCategory() == ModCategory.MODS) {
this.buttonList.add(new Button(3, 76, this.height - 18, 70, 15, mod.isEnabled() ? "Enabled" : "Disabled", false, mod.isEnabled() ? new SelectedButtonTheme() : new DefaultButtonTheme()));
}
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));
}
@Override
@ -79,47 +70,32 @@ public class ColorPicker extends SilentScreen {
ModMenu.drawOverlayListBase(height, "Choose a color");
super.drawScreen(mouseX, mouseY, partialTicks);
ModMenu.trimContentStart(width, height);
float colorY = 66;
int colorX = 3;
int colorIndex = 0;
for(Color color : colors) {
RenderUtil.drawRoundedRect(colorX, colorY, 20, 20, 3, new Color(color.getRed(), color.getGreen(), color.getBlue(), setting.getOpacity()).getRGB());
RenderUtil.drawRoundedOutline(colorX, colorY, 20, 20, 3, 2, new Color(0, 0, 0).getRGB());
if(MouseUtils.isInside(mouseX, mouseY, colorX, colorY, 20, 20)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
colorX += 25;
colorIndex += 1;
if(colorIndex == 6) {
colorIndex = 0;
colorX = 3;
colorY += 25;
}
}
int settingHeight = 15;
colorY += settingHeight;
if(setting.isCanChangeOpacity()) {
colorY += settingHeight;
RegularSlider.render(3, colorY, 144, "Opacity", 255, setting.getOpacity());
if (RegularSlider.isDrag(mouseX, mouseY, 3, colorY, 144) && (System.currentTimeMillis() - initTime) > 500) {
double diff = 255 - 0;
double mouse = MathHelper.clamp_double((mouseX - 3) / 100D, 0, 1);
double newVal = 0 + mouse * diff;
setting.setOpacity((int) newVal);
}
colorY += settingHeight;
}
colorY += settingHeight;
Checkbox.render(mouseX, mouseY, 3, colorY, "Chroma", setting.isChroma());
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
super.drawScreen(mouseX, mouseY, partialTicks);
hsb.render(mouseX, mouseY);
colorY += 100;
Client.getInstance().getSettingsManager().getSettingByName(mod, this.value).setValColor(hsb.getSelectedColorFinal());
if(setting.isCanChangeOpacity()) {
GlStateManager.color(1, 1, 1, 1);
RegularSlider.render(3, colorY, 144, "Opacity", 255, setting.getOpacity());
if (RegularSlider.isDrag(mouseX, mouseY, 3, colorY, 144) && (System.currentTimeMillis() - initTime) > 500) {
double diff = 255;
double mouse = MathHelper.clamp_double((mouseX - 3) / 144D, 0, 1);
double newVal = 0 + mouse * diff;
setting.setOpacity((int) newVal);
}
}
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
@ -153,34 +129,17 @@ public class ColorPicker extends SilentScreen {
super.mouseClicked(mouseX, mouseY, mouseButton);
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
float colorY = 66;
int colorX = 3;
int colorIndex = 0;
for(Color color : colors) {
if(MouseUtils.isInside(mouseX, mouseY, colorX, colorY, 20, 20)) {
setting.setValColor(color);
mc.displayGuiScreen(parentScreen);
}
colorX += 25;
colorIndex += 1;
if(colorIndex == 6) {
colorIndex = 0;
colorX = 3;
colorY += 25;
}
}
int settingHeight = 15;
colorY += settingHeight;
if(setting.isCanChangeOpacity()) {
colorY += settingHeight * 2;
}
colorY += settingHeight;
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
setting.setChroma(!setting.isChroma());
mc.displayGuiScreen(parentScreen);
}
hsb.mouseClicked(mouseX, mouseY, mouseButton);
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
hsb.mouseReleased(mouseX, mouseY, state);
super.mouseReleased(mouseX, mouseY, state);
}
@Override
@ -190,5 +149,6 @@ public class ColorPicker extends SilentScreen {
mc.renderGlobal.loadRenderers();
}
MenuBlurUtils.unloadBlur();
Client.getInstance().configManager.save();
}
}

View File

@ -19,7 +19,7 @@ import net.silentclient.client.gui.theme.input.DefaultInputTheme;
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.render.crosshair.CrosshairMod;
import net.silentclient.client.mods.world.TimeChangerMod;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler;
@ -135,7 +135,13 @@ public class ModSettings extends SilentScreen {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
}
if(setting.isCellGrid()) {
MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, 3, settingY, setting);
if(cellGridCursor != null) {
cursorType = cellGridCursor;
}
settingY += 135;
}
if(setting.isSlider()) {
RegularSlider.render(3, settingY, 144, setting.getName(), setting.getMax(), setting.getValDouble());
@ -264,6 +270,11 @@ public class ModSettings extends SilentScreen {
}
}
if(setting.isCellGrid()) {
CellGrid.click(mouseX, mouseY, mouseButton, setting);
settingY += 135;
}
if(setting.isSlider()) {
settingY += 15;
}
@ -381,6 +392,17 @@ public class ModSettings extends SilentScreen {
MenuBlurUtils.unloadBlur();
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
for (Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(mod)) {
if(setting.isCellGrid()) {
CellGrid.release();
}
}
}
@Override
public boolean doesGuiPauseGame() {
return !(this.mod instanceof TimeChangerMod);

View File

@ -11,6 +11,7 @@ import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.cosmetics.gui.CosmeticsGui;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.LiteMainMenu;
@ -19,10 +20,12 @@ import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.silentmainmenu.components.AccountPicker;
import net.silentclient.client.gui.silentmainmenu.components.MenuOption;
import net.silentclient.client.gui.theme.button.IButtonTheme;
import net.silentclient.client.gui.util.GlUtil;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.MouseCursorHandler;
import net.silentclient.client.utils.PromoController;
import net.silentclient.client.utils.SCTextureManager;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.awt.image.BufferedImage;
@ -36,6 +39,7 @@ public class MainMenuConcept extends SilentScreen {
public static boolean loading = false;
public static boolean initSkin = false;
private AccountPicker accountPicker;
private final SimpleAnimation scaleAnimation = new SimpleAnimation(0f);
@Override
public void initGui() {
@ -99,13 +103,23 @@ public class MainMenuConcept extends SilentScreen {
if(MouseUtils.isInside(mouseX, mouseY, 10, 10, 109, 63)) {
cursorType = MouseCursorHandler.CursorType.POINTER;
}
RenderUtils.drawRect(10, 10, 109, 63, -1);
RenderUtil.drawImage(PromoController.getResponse().getCurrentPanel().getImageLocation(), 12, 12, 105, 59, false);
RenderUtils.drawRect(11, 11, 107, 61, -1);
GL11.glEnable(GL11.GL_SCISSOR_TEST);
GlUtil.scissor(12, 12, 12 + 105, 12 + 59);
RenderUtil.drawImage(PromoController.getResponse().getCurrentPanel().getImageLocation(), 12 - scaleAnimation.getValue(), 12 - scaleAnimation.getValue(), 105 + (scaleAnimation.getValue() * 2), 59 + (scaleAnimation.getValue() * 2), false);
GL11.glDisable(GL11.GL_SCISSOR_TEST);
if(MouseUtils.isInside(mouseX, mouseY, 12, 12, 105, 59)) {
scaleAnimation.setAnimation(10f, 15f);
} else {
scaleAnimation.setAnimation(0f, 15f);
}
} else {
PromoController.getResponse().getCurrentPanel().loadImage();
}
}
Client.getInstance().getSilentFontRenderer().drawString(3, height - 14, "Silent Client 1.8.9", 12, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);

View File

@ -10,14 +10,17 @@ import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.util.GlUtil;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.PromoController;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
public class SilentMainMenu extends SilentScreen {
@Override
public void initGui() {
super.initGui();
@ -51,6 +54,7 @@ public class SilentMainMenu extends SilentScreen {
blockY = 70;
}
RenderUtils.drawRect(blockX, blockY, 320, 150, new Color(20, 20, 20).getRGB());
if(PromoController.getResponse().getCurrentPanel() != null) {
if(PromoController.getResponse().getCurrentPanel().getImageLocation() != null) {
RenderUtil.drawImage(PromoController.getResponse().getCurrentPanel().getImageLocation(), blockX + 78, blockY + 10, 231, 130, false);
@ -59,6 +63,7 @@ public class SilentMainMenu extends SilentScreen {
}
}
int optionY = blockY + 10;
this.drawOptionButton(mouseX, mouseY, blockX + 5, optionY, new ResourceLocation("silentclient/icons/settings/cosmetics.png"), "Cosmetics");
optionY += 15;

View File

@ -4,6 +4,7 @@ import net.minecraft.launchwrapper.ITweaker;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.silentclient.client.Client;
import net.silentclient.client.mixin.transformer.NVGClassTransformer;
import org.spongepowered.asm.launch.MixinBootstrap;
import org.spongepowered.asm.mixin.MixinEnvironment;
import org.spongepowered.asm.mixin.Mixins;
@ -66,6 +67,19 @@ public class SilentClientTweaker implements ITweaker {
}
environment.setSide(MixinEnvironment.Side.CLIENT);
classLoader.registerTransformer("net.silentclient.client.mixin.SilentClientTransformer");
classLoader.registerTransformer(NVGClassTransformer.class.getName());
unlockLwjgl();
}
private void unlockLwjgl() {
try {
Field transformerExceptions = LaunchClassLoader.class.getDeclaredField("classLoaderExceptions");
transformerExceptions.setAccessible(true);
Object o = transformerExceptions.get(Launch.classLoader);
((Set<String>) o).remove("org.lwjgl.");
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
@Override

View File

@ -155,6 +155,16 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
}
}
@Redirect(method = "hurtCameraEffect", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;rotate(FFFF)V", ordinal = 2))
public void changeIntensity(float angle, float x, float y, float z) {
if(!Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() || Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "No Shaking").getValBoolean()) {
GlStateManager.rotate(angle, x, y, z);
return;
}
float intensity = Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "Shaking Intensity").getValFloat();
GlStateManager.rotate(angle * (intensity / 14), x, y, z);
}
@Redirect(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;setupViewBobbing(F)V"))
public void modelBobbing(EntityRenderer instance, float f) {
if(!Client.getInstance().getSettingsManager().getSettingByClass(RenderMod.class, "Model Bobbing Only").getValBoolean()) {

View File

@ -15,7 +15,7 @@ import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
import net.silentclient.client.mods.hud.BossBarMod;
import net.silentclient.client.mods.hud.ScoreboardMod;
import net.silentclient.client.mods.render.AnimationsMod;
import net.silentclient.client.mods.render.CrosshairMod;
import net.silentclient.client.mods.render.crosshair.CrosshairMod;
import net.silentclient.client.mods.render.PackTweaksMod;
import net.silentclient.client.mods.render.TitlesMod;
import net.silentclient.client.mods.settings.RenderMod;

View File

@ -1,6 +1,7 @@
package net.silentclient.client.mixin.mixins;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.*;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.renderer.EntityRenderer;
@ -132,6 +133,8 @@ public abstract class MinecraftMixin implements MinecraftExt {
@Shadow private Timer timer;
@Shadow public EntityPlayerSP thePlayer;
@Inject(method = "displayGuiScreen", at = @At("HEAD"), cancellable = true)
public void displayGuiScreenInject(GuiScreen guiScreenIn, CallbackInfo ci) {
if(guiScreenIn instanceof SilentScreen) {
@ -329,8 +332,8 @@ public abstract class MinecraftMixin implements MinecraftExt {
{
if (this.theWorld == null && this.currentScreen != null) return this.currentScreen instanceof SilentScreen ? ((SilentScreen) this.currentScreen).getFpsLimit() : 30;
if(!Display.isActive()) {
return 60;
if(!Display.isActive() && Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Limit Unfocused FPS").getValBoolean()) {
return Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Unfocused FPS Limit").getValInt();
}
return this.gameSettings.limitFramerate;

View File

@ -4,7 +4,9 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.network.NetworkPlayerInfo;
import net.minecraft.network.play.server.S01PacketJoinGame;
import net.minecraft.network.play.server.S0CPacketSpawnPlayer;
import net.minecraft.network.play.server.S19PacketEntityStatus;
import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.util.IChatComponent;
@ -16,9 +18,28 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.UUID;
@Mixin(NetHandlerPlayClient.class)
public class NetHandlerPlayClientMixin {
public abstract class NetHandlerPlayClientMixin {
@Shadow private WorldClient clientWorldController;
@Shadow
public abstract NetworkPlayerInfo getPlayerInfo(UUID p_175102_1_);
@Inject(
method = "handleSpawnPlayer",
cancellable = true,
at =
@At(
value = "INVOKE",
target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue(Lnet/minecraft/network/Packet;Lnet/minecraft/network/INetHandler;Lnet/minecraft/util/IThreadListener;)V",
shift = At.Shift.AFTER
))
private void patcher$fixHandleSpawnPlayerNPE(S0CPacketSpawnPlayer packetIn, CallbackInfo ci) {
if (this.getPlayerInfo(packetIn.getPlayer()) == null) {
ci.cancel();
}
}
@Inject(method = "handleEntityStatus", at = @At("RETURN"))
public void callEntityDamageEvent(S19PacketEntityStatus packetIn, CallbackInfo ci) {

View File

@ -93,7 +93,7 @@ public class RendererLivingEntityMixin<T extends EntityLivingBase> {
return;
}
}
if(entity instanceof EntityArmorStand && Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide Armor Stands").getValBoolean()) {
if(entity instanceof EntityArmorStand && (Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide Armor Stands").getValBoolean() || entity.isInvisible())) {
((RendererLivingEntity<EntityArmorStand>) (Object) this).renderName((EntityArmorStand) entity, x, y, z);
ci.cancel();
}

View File

@ -0,0 +1,26 @@
package net.silentclient.client.mixin.mixins.lwjgl;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(targets = "org.lwjgl.opengl.WindowsDisplay")
public abstract class WindowsDisplayMixin {
@Inject(method = "doHandleMessage", at = @At("HEAD"), cancellable = true, remap = false)
private void doHandleMessage(long hwnd, int msg, long wParam, long lParam, long millis,
CallbackInfoReturnable<Long> callback) {
if (msg == 0x020B) {
if ((wParam >> 16) == 1L) {
handleMouseButton(3, 1, millis);
} else {
handleMouseButton(4, 1, millis);
}
callback.setReturnValue(1L);
}
}
@Shadow
protected abstract void handleMouseButton(int button, int state, long millis);
}

View File

@ -0,0 +1,51 @@
package net.silentclient.client.mixin.transformer;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.*;
public class NVGClassTransformer implements IClassTransformer {
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass) {
if (name.equals("org.lwjgl.nanovg.NanoVGGLConfig")) {
ClassReader reader = new ClassReader(basicClass);
ClassNode node = new ClassNode();
reader.accept(node, ClassReader.EXPAND_FRAMES);
for (MethodNode method : node.methods) {
if (method.name.equals("configGL")) {
InsnList list = new InsnList();
list.add(new VarInsnNode(Opcodes.LLOAD, 0));
list.add(new TypeInsnNode(Opcodes.NEW, "me/djtheredstoner/lwjgl/Lwjgl2FunctionProvider"));
list.add(new InsnNode(Opcodes.DUP));
list.add(new MethodInsnNode(
Opcodes.INVOKESPECIAL,
"me/djtheredstoner/lwjgl/Lwjgl2FunctionProvider",
"<init>",
"()V",
false
));
list.add(new MethodInsnNode(
Opcodes.INVOKESTATIC,
"org/lwjgl/nanovg/NanoVGGLConfig",
"config",
"(JLorg/lwjgl/system/FunctionProvider;)V",
false
));
list.add(new InsnNode(Opcodes.RETURN));
method.instructions.clear();
method.instructions.insert(list);
}
}
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
node.accept(cw);
return cw.toByteArray();
}
return basicClass;
}
}

View File

@ -259,6 +259,10 @@ public class Mod implements IMod {
return setting;
}
public Setting addCellSetting(String name, Mod mod, boolean[][] cells) {
return Client.getInstance().getSettingsManager().addSetting(new Setting(name, mod, cells));
}
public Setting addKeybindSetting(String name, Mod mod, int keybind) {
Setting setting;

View File

@ -9,6 +9,7 @@ import net.silentclient.client.mods.hypixel.QuickPlayMod;
import net.silentclient.client.mods.hypixel.togglechat.ToggleChatMod;
import net.silentclient.client.mods.player.*;
import net.silentclient.client.mods.render.*;
import net.silentclient.client.mods.render.crosshair.CrosshairMod;
import net.silentclient.client.mods.settings.CosmeticsMod;
import net.silentclient.client.mods.settings.FPSBoostMod;
import net.silentclient.client.mods.settings.GeneralMod;

View File

@ -35,9 +35,14 @@ public class Setting implements Comparable<Setting> {
private Color cval;
public Color defaultcval;
// for cell setting
private boolean[][] cells;
private int key;
// Settings category
private String category = "";
private int opacity = 255;
public int defaultopacity = 255;
private boolean chroma = false;
@ -80,6 +85,25 @@ public class Setting implements Comparable<Setting> {
this.defaultopacity = 255;
}
public Setting(String name, Mod parent, boolean[][] cells) {
this.mode = "CellGrid";
this.name = name;
this.parent = parent;
this.cells = new boolean[][]{
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, true, true, false, true, false, true, true, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false}
};;
}
public Setting(String name, Mod parent, Color cval, int opacity) {
this.name = name;
this.parent = parent;
@ -135,6 +159,10 @@ public class Setting implements Comparable<Setting> {
return this.sval;
}
public void setCells(boolean[][] cells) {
this.cells = cells;
}
public void setValString(String in) {
if(onlyPremiumPlus) {
if(Client.getInstance().getAccount() != null && Client.getInstance().getAccount().isPremiumPlus()) {
@ -167,6 +195,10 @@ public class Setting implements Comparable<Setting> {
return Minecraft.getMinecraft().inGameHasFocus && Keyboard.isKeyDown(kval);
}
public boolean[][] getCells() {
return cells;
}
public List<String> getOptions() {
return this.options;
}
@ -184,7 +216,11 @@ public class Setting implements Comparable<Setting> {
}
public Color getValColor() {
if(chroma) {
return getValColor(false);
}
public Color getValColor(boolean ignoreChroma) {
if(chroma && !ignoreChroma) {
return new Color(ColorUtils.getChromaColor(0, 0, 1).getRed(), ColorUtils.getChromaColor(0, 0, 1).getGreen(), ColorUtils.getChromaColor(0, 0, 1).getBlue(), getOpacity());
}
return new Color(this.cval.getRed(), this.cval.getGreen(), this.cval.getBlue(), getOpacity());
@ -261,6 +297,10 @@ public class Setting implements Comparable<Setting> {
return this.mode.equalsIgnoreCase("Input");
}
public boolean isCellGrid() {
return this.mode.equalsIgnoreCase("CellGrid");
}
public String getMode() {
return mode;
}

View File

@ -12,8 +12,9 @@ public class SettingsManager {
this.settings = new ArrayList<>();
}
public void addSetting(Setting in){
public Setting addSetting(Setting in){
this.settings.add(in);
return in;
}
public ArrayList<Setting> getSettingByMod(Mod mod){

View File

@ -50,7 +50,7 @@ public class ComboCounterMod extends HudMod {
if(combo == 0) {
return "No " + getPostText();
} else {
return combo + getPostText();
return combo + " " + getPostText();
}
}

View File

@ -14,6 +14,7 @@ import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.ArrayList;
import java.util.Iterator;
@ -24,8 +25,15 @@ public class ScoreboardMod extends Mod {
@Override
public void setup() {
this.setUpdated(true);
this.addSliderSetting("Scale", this, 1, 0.3, 2, false);
this.addBooleanSetting("Header Background", this, true);
this.addColorSetting("Header Background Color", this, new Color(0, 0, 0), 96);
this.addBooleanSetting("Background", this, true);
this.addColorSetting("Background Color", this, new Color(0, 0, 0), 80);
this.addBooleanSetting("Font Shadow", this, true);
this.addBooleanSetting("Numbers", this, false);
@ -35,6 +43,9 @@ public class ScoreboardMod extends Mod {
if (Client.getInstance().getModInstances().getModByClass(ScoreboardMod.class).isEnabled()) {
boolean redNumbers = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Numbers").getValBoolean();
boolean background = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Background").getValBoolean();
Color bgColor = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Background Color").getValColor();
boolean headerBackground = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Header Background").getValBoolean();
Color headerBgColor = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Header Background Color").getValColor();
boolean fontShadow = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Font Shadow").getValBoolean();
float scale = Client.getInstance().getSettingsManager().getSettingByClass(ScoreboardMod.class, "Scale").getValFloat();
@ -87,7 +98,7 @@ public class ScoreboardMod extends Mod {
int scoreY = sidebarY - k * fr.FONT_HEIGHT;
if(background) {
Gui.drawRect(sidebarX - 2, scoreY, scoreX, scoreY + fr.FONT_HEIGHT, 1342177280);
Gui.drawRect(sidebarX - 2, scoreY, scoreX, scoreY + fr.FONT_HEIGHT, bgColor.getRGB());
}
fr.drawString(s1, sidebarX, scoreY, -1, fontShadow);
fr.drawString(s21, scoreX - fr.getStringWidth(s21), scoreY, -1, fontShadow);
@ -95,8 +106,10 @@ public class ScoreboardMod extends Mod {
String s3 = sidebar.getDisplayName();
if(background) {
Gui.drawRect(sidebarX - 2, scoreY - fr.FONT_HEIGHT - 1, scoreX, scoreY - 1, 1610612736);
Gui.drawRect(sidebarX - 2, scoreY - 1, scoreX, scoreY, 1342177280);
if(headerBackground) {
Gui.drawRect(sidebarX - 2, scoreY - fr.FONT_HEIGHT - 1, scoreX, scoreY - 1, headerBgColor.getRGB());
}
Gui.drawRect(sidebarX - 2, scoreY - 1, scoreX, scoreY, bgColor.getRGB());
}
fr.drawString(s3, sidebarX + (sidebarWidth - fr.getStringWidth(s3)) / 2, scoreY - fr.FONT_HEIGHT, -1, fontShadow);
}

View File

@ -49,9 +49,10 @@ public class AutoGGMod extends Mod {
err.printStackTrace();
AutoGGMod.isHypixel = false;
}
if(Server.isRuHypixel()) {
String unformattedMessage = e.getChatComponent().getUnformattedText();
if(unformattedMessage.contains("Победитель:") && unformattedMessage.startsWith(" ")) {
if((unformattedMessage.contains("Победитель:") || unformattedMessage.contains("Winner:")) && unformattedMessage.startsWith(" ")) {
AutoGGMod.isRunning = true;
AutoGGMod.THREAD_POOL.submit(new sendGG());
}

View File

@ -36,8 +36,7 @@ public class AutoTipMod extends Mod {
@EventTarget
public void onTick(ClientTickEvent event) {
if(Server.isHypixel()) {
if(timer.delay(1200000)) {
Client.logger.info("Attempting to tip: all");
if(timer.delay(600000)) {
mc.thePlayer.sendChatMessage("/tip all");
timer.reset();
}

View File

@ -113,7 +113,6 @@ public class PerspectiveMod extends Mod {
private void start() {
if(!active) {
Client.logger.info("perspective active");
active = true;
previousPerspective = mc.gameSettings.thirdPersonView;
mc.gameSettings.thirdPersonView = 3;
@ -125,7 +124,6 @@ public class PerspectiveMod extends Mod {
private void stop() {
if(active) {
Client.logger.info("perspective deactive");
active = false;
mc.gameSettings.thirdPersonView = previousPerspective;
mc.renderGlobal.setDisplayListEntitiesDirty();

View File

@ -12,6 +12,7 @@ public class AnimationsMod extends Mod {
@Override
public void setup() {
this.setUpdated(true);
this.addBooleanSetting("1.7 Item Positions", this, true);
this.addBooleanSetting("1.7 Bow Pullback", this, true);
this.addBooleanSetting("1.7 Block Animation", this, true);
@ -20,8 +21,9 @@ public class AnimationsMod extends Mod {
this.addBooleanSetting("1.7 Throwing", this, true);
this.addBooleanSetting("1.7 Enchant Glint", this, true);
this.addBooleanSetting("1.7 Skins", this, false);
this.addBooleanSetting("Smooth Sneaking", this, true);
this.addBooleanSetting("No Shaking", this, true);
this.addSliderSetting("Shaking Intensity", this, 14, 0, 100, true);
this.addBooleanSetting("Smooth Sneaking", this, true);
this.addBooleanSetting("Consume Animation", this, true);
this.addBooleanSetting("Block-Hitting Animation", this, true);
this.addBooleanSetting("Red Armor", this, true);

View File

@ -1,24 +1,31 @@
package net.silentclient.client.mods.render;
import java.awt.Color;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.EventRender3D;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import org.lwjgl.opengl.GL11;
import java.awt.*;
public class ChunkBordersMod extends Mod {
public ChunkBordersMod() {
super("Chunk Borders", ModCategory.MODS, "silentclient/icons/mods/chunkborders.png");
}
@Override
public void setup() {
super.setup();
this.addColorSetting("Chunk Walls", this, Color.YELLOW);
this.addColorSetting("Chunk Corners", this, Color.BLUE);
}
@EventTarget
public void onRender3D(EventRender3D event) {
EntityPlayerSP entity = Minecraft.getMinecraft().thePlayer;
@ -41,8 +48,8 @@ public class ChunkBordersMod extends Mod {
double x = 0.0D;
double z = 0.0D;
Color color = Color.BLUE;
Color color2 = Color.YELLOW;
Color color = Client.getInstance().getSettingsManager().getSettingByName(this, "Chunk Corners").getValColor();
Color color2 = Client.getInstance().getSettingsManager().getSettingByName(this, "Chunk Walls").getValColor();
int eyeHeightBlock;

View File

@ -1,13 +1,13 @@
package net.silentclient.client.mods.render;
import java.awt.Color;
import net.silentclient.client.Client;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.EventHitOverlay;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import java.awt.*;
public class HitColorMod extends Mod {
public HitColorMod() {
super("Hit Color", ModCategory.MODS, "silentclient/icons/mods/hitcolor.png");
@ -15,17 +15,17 @@ public class HitColorMod extends Mod {
@Override
public void setup() {
this.addSliderSetting("Alpha", this, 0.8, 0, 1, false);
this.setUpdated(true);
this.addColorSetting("Color", this, new Color(255, 0, 0), 76);
}
@EventTarget
public void onHitOverlay(EventHitOverlay event) {
Color color = new Color(1, 0, 0, 0.3F);
float alpha = (float) Client.getInstance().getSettingsManager().getSettingByName(this, "Alpha").getValDouble();
Color color = Client.getInstance().getSettingsManager().getSettingByName(this, "Color").getValColor();
event.setRed(color.getRed() / 255F);
event.setGreen(color.getGreen() / 255F);
event.setBlue(color.getBlue() / 255F);
event.setAlpha(alpha);
event.setAlpha(color.getAlpha() / 255F);
}
}

View File

@ -2,6 +2,7 @@ package net.silentclient.client.mods.render;
import java.awt.Color;
import net.silentclient.client.mods.render.crosshair.CrosshairMod;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.GlStateManager;

View File

@ -0,0 +1,42 @@
package net.silentclient.client.mods.render.crosshair;
/**
* @author refactoring
*/
import java.util.ArrayList;
import java.util.List;
public class CLayoutManager {
private final List<boolean[][]> layouts = new ArrayList<>();
public CLayoutManager() {
init();
}
public void init() {
addLayout(cDefault);
}
public boolean[][] getLayout(int index) {
return layouts.get(index);
}
public void addLayout(boolean[][] layout) {
layouts.add(layout);
}
final boolean[][] cDefault = new boolean[][]{
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, true, true, false, true, false, true, true, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false}
};
}

View File

@ -1,7 +1,8 @@
package net.silentclient.client.mods.render;
package net.silentclient.client.mods.render.crosshair;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
@ -32,13 +33,30 @@ import java.util.ArrayList;
public class CrosshairMod extends Mod {
private int componentWidth = 0;
private final CLayoutManager layoutManager;
boolean[][] cDefault = new boolean[][]{
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, true, true, false, true, false, true, true, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false},
{false, false, false, false, false, true, false, false, false, false, false}
};
public CrosshairMod() {
super("Crosshair", ModCategory.MODS, "silentclient/icons/mods/crosshair.png");
layoutManager = new CLayoutManager();
}
@Override
public void setup() {
this.setUpdated(true);
this.addBooleanSetting("Preset Crosshair", this, false);
ArrayList<String> presets = new ArrayList<String>();
@ -91,6 +109,8 @@ public class CrosshairMod extends Mod {
options.add("Square");
options.add("None");
this.addBooleanSetting("Use custom shape", this, false);
this.addCellSetting("Shape", this, cDefault);
this.addModeSetting("Type", this, "Cross", options);
this.addColorSetting("Crosshair Color", this, new Color(255, 255, 255));
this.addColorSetting("Player Color", this, new Color(176,46,38));
@ -111,6 +131,10 @@ public class CrosshairMod extends Mod {
this.addBooleanSetting("Vanilla Blendering", this, true);
}
private boolean[][] getCells() {
return Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Shape").getCells();
}
@Override
public int customComponentHeight() {
boolean preset = Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset Crosshair").getValBoolean();
@ -352,8 +376,28 @@ public class CrosshairMod extends Mod {
if(Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset Crosshair").getValBoolean()) {
return;
}
if(Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Use custom Shape").getValBoolean()) {
renderCustomShape();
} else {
renderCrosshair();
}
}
public void renderCustomShape() {
ScaledResolution res = new ScaledResolution(mc);
for (int row = 0; row < 11; row++) {
for (int col = 0; col < 11; col++) {
if (getCells()[row][col] && isToggled()) {
RenderUtils.drawRect(
(float) res.getScaledWidth() / 2 - 5 + col,
(float) res.getScaledHeight() / 2 - 5 + row,
1, 1, Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Crosshair Color").getValColor().getRGB()
);
}
}
}
}
public void renderCrosshair() {
String type = Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Type").getValString();

View File

@ -38,6 +38,8 @@ public class FPSBoostMod extends Mod {
@Override
public void setup() {
this.setUpdated(true);
ArrayList<String> lazyLoading = new ArrayList<String>();
lazyLoading.add("Off");
@ -57,6 +59,8 @@ public class FPSBoostMod extends Mod {
this.addBooleanSetting("Low Graphics Mode", this, false); // ready
this.addBooleanSetting("Hud Optimization", this, false); // ready
this.addBooleanSetting("Optimized Entity Movement", this, true);
this.addBooleanSetting("Limit Unfocused FPS", this, true);
this.addSliderSetting("Unfocused FPS Limit", this, 60, 10, 200, true);
this.addModeSetting("Lazy Chunk Loading", this, "Balance", lazyLoading); // ready
this.addModeSetting("Occlusion Culling", this, "Balance", entityCulling); // ready
this.addBooleanSetting("Hide Tall Grass", this, false); // ready
@ -107,7 +111,7 @@ public class FPSBoostMod extends Mod {
return;
}
if(setting.getName().equals("Optimized Entity Movement") || setting.getName().equals("Low Graphics Mode") || !setting.isCheck() || setting.getName().equals("Check glError") || setting.getName().equals("Do memory debug")) {
if(setting.getName().equals("Optimized Entity Movement") || setting.getName().equals("Low Graphics Mode") || !setting.isCheck() || setting.getName().equals("Check glError") || setting.getName().equals("Do memory debug") || setting.getName().equals("Limit Unfocused FPS")) {
return;
}

View File

@ -48,6 +48,7 @@ public class GeneralMod extends Mod {
public void onChangeSettingValue(Setting setting) {
switch(setting.getName()) {
case "Raw Mouse Input":
RawInputHandler.reload();
RawInputHandler.toggleRawInput(setting.getValBoolean());
break;
case "Menu Background Blur":

View File

@ -0,0 +1,68 @@
package net.silentclient.client.nanovg;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.utils.io.BufferUtil;
import net.silentclient.client.utils.io.LinkedStorage;
import org.lwjgl.nanovg.NVGColor;
import java.awt.*;
import java.io.IOException;
import java.nio.ByteBuffer;
public class NVGHelper {
public static int DRAW_STROKE = 0;
public static int DRAW_FILL = 1;
public static NVGColor nvgcolor(Color color) {
return NVGColor.calloc().r(color.getRed()/255f).g(color.getGreen()/255f).b(color.getBlue()/255f).a(color.getAlpha()/255f);
}
public static int[] int_to_rgba(int color) {
int[] rgba = new int[4];
rgba[0] = color >> 24 & 0xFF;
rgba[1] = color >> 16 & 0xFF;
rgba[2] = color >> 8 & 0xFF;
rgba[3] = color & 0xFF;
return rgba;
}
public static void path(Runnable r, int mode) {
NVGWrapper.beginPath();
r.run();
if(mode == 0) NVGWrapper.stroke();
if(mode == 1) NVGWrapper.fill();
NVGWrapper.closePath();
}
public static void path(float x, float y, Runnable r, int mode) {
NVGWrapper.beginPath();
NVGWrapper.moveTo(x,y);
r.run();
if(mode == 0) NVGWrapper.stroke();
if(mode == 1) NVGWrapper.fill();
NVGWrapper.closePath();
}
public static void initFont(String fontName, String fileName) {
try {
ByteBuffer data = BufferUtil.get().getResourceBytes(new ResourceLocation("silentclient/fonts/"+fileName), 1024);
Client.logger.info(" LOADING > ui > font > " + fontName);
LinkedStorage.put(data);
NVGWrapper.createFontMem(fontName, data, 0);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static void initImage(String imgName, String fileName) {
try {
ByteBuffer data = BufferUtil.get().getResourceBytes(new ResourceLocation("silentclient/images/"+fileName), 1024);
LinkedStorage.put(data);
Client.logger.info("LOADING > ui > image > " + imgName);
int img = NVGWrapper.createImageMem(0, data);
UI.imagesmap.put(imgName,img);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

View File

@ -0,0 +1,404 @@
package net.silentclient.client.nanovg;
import org.lwjgl.nanovg.*;
import java.nio.ByteBuffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
public class NVGWrapper {
public static long cx;
public static void beginFrame(float width, float height, float dpi) {
NanoVG.nvgBeginFrame(cx, width, height, dpi);
}
public static void cancelFrame() {
NanoVG.nvgCancelFrame(cx);
}
public static void endFrame() {
NanoVG.nvgEndFrame(cx);
}
public static void globalCompositeOperation(int op) {
NanoVG.nvgGlobalCompositeOperation(cx, op);
}
public static void globalCompositeBlendFunc(int sfactor, int dfactor) {
NanoVG.nvgGlobalCompositeBlendFunc(cx, sfactor, dfactor);
}
public static void globalCompositeBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
NanoVG.nvgGlobalCompositeBlendFuncSeparate(cx, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
public static NVGColor RGB(byte r, byte g, byte b, NVGColor __result) {
return NanoVG.nvgRGB(r, g, b, __result);
}
public static NVGColor RGBf(float r, float g, float b, NVGColor __result) {
return NanoVG.nvgRGBf(r, g, b, __result);
}
public static NVGColor RGBA(byte r, byte g, byte b, byte a, NVGColor __result) {
return NanoVG.nvgRGBA(r, g, b, a, __result);
}
public static NVGColor RGBAf(float r, float g, float b, float a, NVGColor __result) {
return NanoVG.nvgRGBAf(r, g, b, a, __result);
}
public static NVGColor lerpRGBA(NVGColor c0, NVGColor c1, float u, NVGColor __result) {
return NanoVG.nvgLerpRGBA(c0, c1, u, __result);
}
public static NVGColor transRGBA(NVGColor c0, byte a, NVGColor __result) {
return NanoVG.nvgTransRGBA(c0, a, __result);
}
public static NVGColor transRGBAf(NVGColor c0, float a, NVGColor __result) {
return NanoVG.nvgTransRGBAf(c0, a, __result);
}
public static NVGColor HSL(float h, float s, float l, NVGColor __result) {
return NanoVG.nvgHSL(h, s, l, __result);
}
public static NVGColor HSLA(float h, float s, float l, byte a, NVGColor __result) {
return NanoVG.nvgHSLA(h, s, l, a, __result);
}
public static void save() {
NanoVG.nvgSave(cx);
}
public static void restore() {
NanoVG.nvgRestore(cx);
}
public static void reset() {
NanoVG.nvgReset(cx);
}
public static void shapeAntiAlias(boolean enabled) {
NanoVG.nvgShapeAntiAlias(cx, enabled);
}
public static void strokeColor(NVGColor color) {
NanoVG.nvgStrokeColor(cx, color);
}
public static void strokePaint(NVGPaint paint) {
NanoVG.nvgStrokePaint(cx, paint);
}
public static void fillColor(NVGColor color) {
NanoVG.nvgFillColor(cx, color);
}
public static void fillPaint(NVGPaint paint) {
NanoVG.nvgFillPaint(cx, paint);
}
public static void miterLimit(float limit) {
NanoVG.nvgMiterLimit(cx, limit);
}
public static void strokeWidth(float width) {
NanoVG.nvgStrokeWidth(cx, width);
}
public static void lineCap(int cap) {
NanoVG.nvgLineCap(cx, cap);
}
public static void lineJoin(int join) {
NanoVG.nvgLineJoin(cx, join);
}
public static void globalAlpha(float alpha) {
NanoVG.nvgGlobalAlpha(cx, alpha);
}
public void resetTransformation() {
NanoVG.nvgResetTransform(cx);
}
public static void transform(float a, float b, float c, float d, float e, float f) {
NanoVG.nvgTransform(cx, a, b, c, d, e, f);
}
public static void translate(float x, float y) {
NanoVG.nvgTranslate(cx, x, y);
}
public static void rotate(float angle) {
NanoVG.nvgRotate(cx, angle);
}
public static void skewX(float angle) {
NanoVG.nvgSkewX(cx,angle);
}
public static void skewY(float angle) {
NanoVG.nvgSkewY(cx,angle);
}
public static void scale(float x, float y) {
NanoVG.nvgScale(cx,x,y);
}
public static void currentTransform(FloatBuffer xFrom) {
NanoVG.nvgCurrentTransform(cx,xFrom);
}
public static void transformIdentity(FloatBuffer dst) {
NanoVG.nvgTransformIdentity(dst);
}
public static void transformTranslate(FloatBuffer dst, float x, float y) {
NanoVG.nvgTransformTranslate(dst,x,y);
}
public static void transformScale(FloatBuffer dst, float x, float y) {
NanoVG.nvgTransformScale(dst,x,y);
}
public static void transformRotate(FloatBuffer dst, float angle) {
NanoVG.nvgTransformRotate(dst,angle);
}
public static void transformSkewX(FloatBuffer dst, float angle) {
NanoVG.nvgTransformSkewX(dst,angle);
}
public static void transformSkewY(FloatBuffer dst, float angle) {
NanoVG.nvgTransformSkewY(dst,angle);
}
public static void transformMultiply(FloatBuffer dst, FloatBuffer src) {
NanoVG.nvgTransformMultiply(dst,src);
}
public static void transfromPremultiply(FloatBuffer dst, FloatBuffer src) {
NanoVG.nvgTransformPremultiply(dst,src);
}
public static void transfromInverse(FloatBuffer dst, FloatBuffer src) {
NanoVG.nvgTransformInverse(dst,src);
}
public static void transfromPoint(FloatBuffer dstx, FloatBuffer dsty, FloatBuffer xfrom, float srcX, float srcY) {
NanoVG.nvgTransformPoint(dstx, dsty, xfrom, srcX, srcY);
}
public static float deg_rad(float val) {
return NanoVG.nvgDegToRad(val);
}
public static float rad_deg(float val) {
return NanoVG.nvgDegToRad(val);
}
public static int createImage(CharSequence filename, int imageFlags) {
return NanoVG.nvgCreateImage(cx,filename,imageFlags);
}
public static int createImageMem(int imageFlags, ByteBuffer data) {
return NanoVG.nvgCreateImageMem(cx,imageFlags,data);
}
public static int createImageRGBA(int w, int h, int imageFlags, ByteBuffer data) {
return NanoVG.nvgCreateImageRGBA(cx,w, h, imageFlags, data);
}
public static void updateImage(int image,ByteBuffer data) {
NanoVG.nvgUpdateImage(cx,image,data);
}
public static void imageSize(int image, IntBuffer w, IntBuffer h) {
NanoVG.nvgImageSize(cx,image,w,h);
}
public static void deleteImage(int image) {
NanoVG.nvgDeleteImage(cx,image);
}
public static NVGPaint linearGradient(float sx, float sy, float ex, float ey, NVGColor from, NVGColor to, NVGPaint __result) {
return NanoVG.nvgLinearGradient(cx,sx,sy,ex,ey,from,to,__result);
}
public static NVGPaint boxGradient(float x, float y, float w, float h, float r, float f, NVGColor from, NVGColor to, NVGPaint __result) {
return NanoVG.nvgBoxGradient(cx,x,y,w,h,r,f,from,to, __result);
}
public static NVGPaint imagePattern(float ox, float oy, float ex, float ey, float angle, int image, float alpha, NVGPaint __result) {
return NanoVG.nvgImagePattern(cx,ox,oy,ex,ey,angle,image,alpha,__result);
}
public static void scissor(float x, float y, float w, float h) {
NanoVG.nvgScissor(cx,x,y,w,h);
}
public static void intersectScissor(float x, float y, float w, float h) {
NanoVG.nvgIntersectScissor(cx,x,y,w,h);
}
public static void resetScissor() {
NanoVG.nvgResetScissor(cx);
}
public static void beginPath() {
NanoVG.nvgBeginPath(cx);
}
public static void moveTo(float x, float y) {
NanoVG.nvgMoveTo(cx,x,y);
}
public static void lineTo(float x, float y) {
NanoVG.nvgLineTo(cx,x,y);
}
public static void bezierTo(float cx1, float cy1, float cx2, float cy2, float x, float y) {
NanoVG.nvgBezierTo(cx,cx1,cy1,cx2,cy2, x,y);
}
public static void guadTo(float cx, float cy, float x, float y) {
NanoVG.nvgQuadTo(NVGWrapper.cx,cx,cy,x,y);
}
public static void arcTo(float x1, float y1, float x2, float y2, float radius) {
NanoVG.nvgArcTo(cx,x1,y1,x2,y2,radius);
}
public static void closePath() {
NanoVG.nvgClosePath(cx);
}
public static void pathWinding(int op) {
NanoVG.nvgPathWinding(cx,op);
}
public static void rect(float x, float y, float w, float h) {
NanoVG.nvgRect(cx,x,y,w,h);
}
public static void rrect(float x, float y, float w, float h, float rad) {
NanoVG.nvgRoundedRect(cx,x,y,w,h,rad);
}
public static void rrect(float x, float y, float w, float h, float rTL, float rTR, float rBL, float rBR) {
NanoVG.nvgRoundedRectVarying(cx,x,y,w,h,rTL,rTR,rBL,rBR);
}
public static void ellipse(float cx, float cy, float rx, float ry) {
NanoVG.nvgEllipse(NVGWrapper.cx,cx,cy,rx,ry);
}
public static void circle(float x, float y, float r) {
NanoVG.nvgCircle(cx,x,y,r);
}
public static void fill() {
NanoVG.nvgFill(cx);
}
public static void stroke() {
NanoVG.nvgStroke(cx);
}
public static int createFont(CharSequence name, CharSequence filename) {
return NanoVG.nvgCreateFont(cx,name,filename);
}
public static int createFontAtIndex(CharSequence name, CharSequence filename, int index) {
return NanoVG.nvgCreateFontAtIndex(cx,name,filename,index);
}
public static int createFontMem(CharSequence name, ByteBuffer data, int freeData) {
return NanoVG.nvgCreateFontMem(cx,name,data,freeData);
}
public static int createFontMemAtIndex(CharSequence name, ByteBuffer data, int freeData, int index) {
return NanoVG.nvgCreateFontMemAtIndex(cx,name,data,freeData,index);
}
public static int findFont(CharSequence name) {
return NanoVG.nvgFindFont(cx, name);
}
public static int addFallbackFontID(int baseFont, int fallbackFont) {
return NanoVG.nvgAddFallbackFontId(cx,baseFont,fallbackFont);
}
public static int addFallbackFont(CharSequence baseFont, CharSequence fallbackFont) {
return NanoVG.nvgAddFallbackFont(cx,baseFont, fallbackFont);
}
public static void resetFallbackFontsID(int baseFont) {
NanoVG.nvgResetFallbackFontsId(cx,baseFont);
}
public static void resetFallbackFonts(CharSequence baseFont) {
NanoVG.nvgResetFallbackFonts(cx,baseFont);
}
public static void fontSize(float size) {
NanoVG.nvgFontSize(cx,size);
}
public static void fontBlur(float blur) {
NanoVG.nvgFontBlur(cx,blur);
}
public static void textLetterSpacing(float spacing) {
NanoVG.nvgTextLetterSpacing(cx,spacing);
}
public static void textLineHeight(float lineHeight) {
NanoVG.nvgTextLineHeight(cx,lineHeight);
}
public static void textAlign(int align) {
NanoVG.nvgTextAlign(cx, align);
}
public static void fontFaceID(int font) {
NanoVG.nvgFontFaceId(cx, font);
}
public static void fontFace(CharSequence font) {
NanoVG.nvgFontFace(cx, font);
}
public static void text(CharSequence text, float x, float y) {
NanoVG.nvgText(cx,x,y,text);
}
public static void textBox(float x, float y, float breakLine, CharSequence text) {
NanoVG.nvgTextBox(cx,x,y,breakLine,text);
}
public static float textBounds(float x, float y, CharSequence text, FloatBuffer bounds) {
return NanoVG.nvgTextBounds(cx,x,y,text,bounds);
}
public static void textBoxBounds(float x, float y, float breakRowWidth, CharSequence text, FloatBuffer bounds) {
NanoVG.nvgTextBoxBounds(cx,x,y,breakRowWidth,text,bounds);
}
public static int textGlyphPositions(float x, float y, CharSequence text, NVGGlyphPosition.Buffer positions) {
return NanoVG.nvgTextGlyphPositions(cx,x,y,text,positions);
}
public static void textMetrics(FloatBuffer ascend, FloatBuffer descend, FloatBuffer lineh) {
NanoVG.nvgTextMetrics(cx,ascend,descend,lineh);
}
public static int textBreakLines(CharSequence text, float breakRowWidth, NVGTextRow.Buffer rows) {
return NanoVG.nvgTextBreakLines(cx,text,breakRowWidth,rows);
}
}

View File

@ -0,0 +1,248 @@
package net.silentclient.client.nanovg;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.nanovg.NVGColor;
import org.lwjgl.nanovg.NVGPaint;
import org.lwjgl.nanovg.NanoVG;
import org.lwjgl.nanovg.NanoVGGL2;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.EXTFramebufferObject;
import org.lwjgl.opengl.EXTPackedDepthStencil;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.HashMap;
import java.util.function.Consumer;
import static net.silentclient.client.nanovg.NVGWrapper.*;
import static net.silentclient.client.nanovg.NVGHelper.*;
public class UI {
private static UI instancce;
private static boolean initialized = false;
public static HashMap<String, Integer> imagesmap = new HashMap<>();
private long context = -1;
ScaledResolution res = new ScaledResolution(Minecraft.getMinecraft());
public static void init() {
if(!initialized) {
new UI();
initialized = true;
}
}
public static UI get() {
return instancce;
}
private UI() {
instancce = this;
context = NanoVGGL2.nvgCreate(NanoVGGL2.NVG_ANTIALIAS | NanoVGGL2.NVG_STENCIL_STROKES);
NVGWrapper.cx = context;
initFont("icon", "icon.ttf");
}
public void render(Consumer<UI> renderer, float width, float height, float dpi) {
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GlStateManager.disableAlpha();
fixDepthStencil();
NVGWrapper.beginFrame(width,height,dpi);
renderer.accept(this);
NVGWrapper.endFrame();
GlStateManager.enableAlpha();
GL11.glPopAttrib();
}
private void fixDepthStencil() {
if(Minecraft.getMinecraft().getFramebuffer().depthBuffer > -1) {
EXTFramebufferObject.glDeleteRenderbuffersEXT(Minecraft.getMinecraft().getFramebuffer().depthBuffer);
int id = EXTFramebufferObject.glGenRenderbuffersEXT();
EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, id);
EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, EXTPackedDepthStencil.GL_DEPTH_STENCIL_EXT, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight);
EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, id);
EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, id);
Minecraft.getMinecraft().getFramebuffer().depthBuffer = -1;
}
}
public void rect(float x, float y, float width, float height, Color color) {
NVGColor col = nvgcolor(color);
path(() -> {
NVGWrapper.rect(x, y, width, height);
fillColor(col);
}, DRAW_FILL);
col.free();
}
public void rrect(float x, float y, float width, float height, float radius, Color color) {
NVGColor col = nvgcolor(color);
path(() -> {
NVGWrapper.rrect(x, y, width, height, radius);
fillColor(col);
}, DRAW_FILL);
col.free();
}
public void rrect(float x, float y, float width, float height, float rTL, float rTR, float rBL, float rBR, Color color) {
NVGColor col = nvgcolor(color);
path(() -> {
NVGWrapper.rrect(x, y, width, height, rTL,rTR,rBL,rBR);
fillColor(col);
}, DRAW_FILL);
col.free();
}
public void text(float x, float y, float size, String font, String string, Color color, float blur, Alignment alignment) {
render((vg) -> {
NVGColor col = nvgcolor(color);
path(() -> {
fontBlur(blur);
fontFace(font);
fontSize(size*res.getScaleFactor());
textAlign(alignment.alignment);
fillColor(col);
NVGWrapper.text(string,x*res.getScaleFactor(),y*res.getScaleFactor());
}, -1);
col.free();
}, Display.getWidth(), Display.getHeight(), 1f);
}
public void text(float x, float y, float size, String font, String string, Color color, Alignment alignment) {
text(x,y,size,font,string,color,0,alignment);
}
public void text(float x, float y, float size, String font, String string, Color color) {
text(x,y,size,font,string,color,0,Alignment.LEFT_TOP);
}
public void image(float x, float y, float w, float h, String id, float alpha, float rad) {
render((vg) -> {
NVGPaint paint = NVGPaint.calloc();
NanoVG.nvgImageSize(context, imagesmap.get(id), new int[]{(int)w},new int[]{(int)h});
path(() -> {
imagePattern(x,y,w,h,0,imagesmap.get(id), alpha, paint);
NVGWrapper.rrect(x,y,w,h,rad);
fillPaint(paint);
}, DRAW_FILL);
paint.free();
}, res.getScaledWidth(), res.getScaledHeight(), res.getScaleFactor());
}
public void line(float sx, float sy, float ex, float ey, float w, Color c1, Color c2) {
NVGColor nc1 = nvgcolor(c1);
NVGColor nc2 = nvgcolor(c2);
NVGPaint paint = NVGPaint.create();
linearGradient(sx,sy,ex,ey,nc1,nc2,paint);
path(sx,sy, ()->{
strokeWidth(w);
strokePaint(paint);
lineTo(ex,ey);
}, DRAW_STROKE);
nc1.free();
nc2.free();
}
public void line(float sx, float sy, float ex, float ey, float w, Color color) {
NVGColor nc1 = nvgcolor(color);
path(sx,sy, ()->{
strokeWidth(w);
strokeColor(nc1);
lineTo(ex,ey);
}, DRAW_STROKE);
nc1.free();
}
public void dropShadow(float x, float y, float w, float h, float radius, float spread, Color color) {
NVGColor nvg_color = nvgcolor(color);
NVGColor nvg_transparent = nvgcolor(new Color(0, 0, 0, 0));
NVGPaint shadowPaint = NVGPaint.calloc();
boxGradient(x,y,w,h,radius, spread, nvg_color,nvg_transparent,shadowPaint);
path(() -> {
NVGWrapper.rrect(x-spread,y-spread,w+spread*2,h+spread*2,radius*2);
NVGWrapper.rrect(x,y,w,h,radius);
NVGWrapper.pathWinding(2);
fillPaint(shadowPaint);
}, DRAW_FILL);
shadowPaint.free();
nvg_color.free();
nvg_transparent.free();
}
public void horizontalGrad(float x, float y, float w, float h, float radius, Color from, Color to) {
gradient(x,y,w,h,x,y,x+w,y,radius,from,to);
}
public void verticalGrad(float x, float y, float w, float h, float radius, Color from, Color to) {
gradient(x,y,w,h,x,y,x,y+h,radius,from,to);
}
public void gradient(float x, float y, float w, float h, float startX, float startY, float endX, float endY, float radius, Color from, Color to) {
NVGColor nc1 = nvgcolor(from);
NVGColor nc2 = nvgcolor(to);
NVGPaint paint = NVGPaint.calloc();
linearGradient(startX, startY, endX, endY, nc1, nc2, paint);
path(() -> {
NVGWrapper.rrect(x,y,w,h,radius);
fillPaint(paint);
}, DRAW_FILL);
nc1.free();
nc2.free();
paint.free();
}
public float textWidth(String text, String face, float size) {
float[] bounds = new float[4];
float f = 0;
save();
fontFace(face);
fontSize(size);
f = NanoVG.nvgTextBounds(cx, 0, 0, text, bounds);
restore();
return f;
}
public float textHeight(String face, float size) {
float[] ascender = new float[1];
float[] descender = new float[1];
float[] lineh = new float[1];
fontFace(face);
fontSize(size);
NanoVG.nvgTextMetrics(cx, ascender, descender, lineh);
return lineh[0];
}
public enum Alignment {
LEFT_TOP(NanoVG.NVG_ALIGN_LEFT | NanoVG.NVG_ALIGN_TOP),
CENTER_TOP(NanoVG.NVG_ALIGN_CENTER | NanoVG.NVG_ALIGN_TOP),
RIGHT_TOP(NanoVG.NVG_ALIGN_RIGHT | NanoVG.NVG_ALIGN_TOP),
LEFT_MIDDLE(NanoVG.NVG_ALIGN_LEFT | NanoVG.NVG_ALIGN_MIDDLE),
CENTER_MIDDLE(NanoVG.NVG_ALIGN_CENTER | NanoVG.NVG_ALIGN_MIDDLE),
RIGHT_MIDDLE(NanoVG.NVG_ALIGN_RIGHT | NanoVG.NVG_ALIGN_MIDDLE),
LEFT_BOTTOM(NanoVG.NVG_ALIGN_LEFT | NanoVG.NVG_ALIGN_BOTTOM),
CENTER_BOTTOM(NanoVG.NVG_ALIGN_CENTER | NanoVG.NVG_ALIGN_BOTTOM),
RIGHT_BOTTOM(NanoVG.NVG_ALIGN_RIGHT | NanoVG.NVG_ALIGN_BOTTOM);
private final int alignment;
Alignment(int alignment) {
this.alignment = alignment;
}
}
}

View File

@ -19,7 +19,7 @@ import net.silentclient.client.Client;
import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.ClientTickEvent;
import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
import net.silentclient.client.mods.render.CrosshairMod;
import net.silentclient.client.mods.render.crosshair.CrosshairMod;
import net.silentclient.client.mods.settings.FPSBoostMod;
import net.silentclient.client.mods.settings.RenderMod;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
package net.silentclient.client.utils;
import net.silentclient.client.utils.cursors.SystemCursors;
import org.apache.logging.log4j.LogManager;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
@ -69,6 +70,11 @@ public class MouseCursorHandler {
}
public boolean enableCursor(final CursorType cursorType) {
if(SystemCursors.isSupported()) {
SystemCursors.setCursor(cursorType.getCursor());
this.currentCursor = cursorType;
return true;
} else {
if (this.customCursorDisabled) {
return false;
}
@ -92,8 +98,13 @@ public class MouseCursorHandler {
}
return false;
}
}
public void disableCursor() {
if(SystemCursors.isSupported()) {
this.currentCursor = CursorType.NORMAL;
SystemCursors.setCursor(SystemCursors.ARROW);
} else {
if (this.customCursorDisabled) {
return;
}
@ -107,18 +118,29 @@ public class MouseCursorHandler {
}
}
}
}
public CursorType getCurrentCursor() {
return currentCursor;
return CursorType.NORMAL;
}
public enum CursorType
{
NORMAL,
NESW_RESIZE,
NWSE_RESIZE,
MOVE,
EDIT_TEXT,
POINTER;
NORMAL(SystemCursors.ARROW),
NESW_RESIZE(SystemCursors.RESIZE_NESW),
NWSE_RESIZE(SystemCursors.RESIZE_NWSE),
MOVE(SystemCursors.CROSSHAIR),
EDIT_TEXT(SystemCursors.IBEAM),
POINTER(SystemCursors.POINTING_HAND);
private final byte cursor;
CursorType(byte cursor) {
this.cursor = cursor;
}
public byte getCursor() {
return cursor;
}
}
}

View File

@ -19,6 +19,10 @@ public class RawInputHandler {
startThread();
}
public static void reload() {
controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();
}
public static void getMouse() {
for (int i = 0; i < controllers.length && mouse == null; i++) {
if (controllers[i].getType() == Controller.Type.MOUSE) {

View File

@ -0,0 +1,56 @@
package net.silentclient.client.utils.cursors;
import org.apache.logging.log4j.*;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.input.Mouse;
public class SystemCursors {
public static final byte ARROW = 0;
public static final byte IBEAM = 1;
public static final byte CROSSHAIR = 2;
public static final byte POINTING_HAND = 3;
public static final byte RESIZE_EW = 4;
public static final byte RESIZE_NS = 5;
public static final byte RESIZE_NWSE = 6;
public static final byte RESIZE_NESW = 7;
public static final byte ALL_CURSOR = 8;
public static final byte NOT_ALLOWED = 9;
public static final byte SIZE = size();
private static final Logger LOGGER = LogManager.getLogger();
private static boolean supported = true;
static void markUnsupported() {
supported = false;
}
public static void setCursor(byte cursor) {
if (!supported)
return;
try {
if (cursor == ARROW) {
Mouse.setNativeCursor(null);
return;
}
if (cursor < 0 || cursor >= SIZE)
throw new IllegalArgumentException(Byte.toString(cursor));
if (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_LINUX || LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX)
X11SystemCursors.setCursor(cursor);
else if (LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_WINDOWS)
Win32SystemCursors.setCursor(cursor);
} catch (Throwable error) {
LOGGER.error("Error occured; not trying again", error);
markUnsupported();
}
}
public static boolean isSupported() {
return supported;
}
private static byte size() {
return NOT_ALLOWED + 1;
}
}

View File

@ -0,0 +1,77 @@
package net.silentclient.client.utils.cursors;
import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.InputImplementation;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
public class Util {
private static final Logger LOGGER = LogManager.getLogger();
private static MethodHandle getInputImplementationMethod;
private static MethodHandle getDisplayImplementationMethod;
static {
try {
Method getInputImplementation = Mouse.class.getDeclaredMethod("getImplementation");
getInputImplementation.setAccessible(true);
getInputImplementationMethod = MethodHandles.lookup().unreflect(getInputImplementation);
Method getDisplayImplementation = Display.class.getDeclaredMethod("getImplementation");
getDisplayImplementation.setAccessible(true);
getDisplayImplementationMethod = MethodHandles.lookup().unreflect(getDisplayImplementation);
} catch (Throwable error) {
LOGGER.error("Could not perform reflection", error);
}
}
public static RuntimeException sneakyThrow(Throwable error) {
if (error instanceof Error)
throw (Error) error;
if (error instanceof RuntimeException)
throw (RuntimeException) error;
if (error instanceof IOException)
throw new UncheckedIOException((IOException) error);
throw new IllegalStateException(error);
}
public static boolean foundInputImplementationMethod() {
return getInputImplementationMethod != null;
}
public static InputImplementation getInputImplementation() {
try {
return (InputImplementation) getInputImplementationMethod.invokeExact();
} catch (Throwable error) {
throw sneakyThrow(error);
}
}
public static Object getDisplayImplementation() {
try {
return getDisplayImplementationMethod.invoke();
} catch (Throwable error) {
throw sneakyThrow(error);
}
}
public static void loadLibrary(String name) throws IOException {
String resourceName = System.mapLibraryName(name);
File file = File.createTempFile(resourceName, "");
file.deleteOnExit();
try (InputStream in = Util.class.getResourceAsStream('/' + resourceName)) {
FileUtils.copyInputStreamToFile(in, file);
}
System.load(file.getAbsolutePath());
}
}

View File

@ -0,0 +1,54 @@
package net.silentclient.client.utils.cursors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
public class Win32SystemCursors {
private static final Logger LOGGER = LogManager.getLogger();
private static final Long[] CACHE = new Long[SystemCursors.SIZE];
private static MethodHandle getHwndMethod;
static {
if (Util.foundInputImplementationMethod()) {
try {
Class<?> windowsDisplay = Class.forName("org.lwjgl.opengl.WindowsDisplay");
Method getHwnd = windowsDisplay.getDeclaredMethod("getHwnd");
getHwnd.setAccessible(true);
getHwndMethod = MethodHandles.lookup().unreflect(getHwnd);
Util.loadLibrary("lwjglLegacyCursorsWin32");
} catch (Throwable error) {
LOGGER.error("Could not perform reflection/load natives", error);
SystemCursors.markUnsupported();
}
} else
SystemCursors.markUnsupported();
}
public static void setCursor(byte cursor) {
nSetCursor(getHwnd(), getDefaultCursorHandle(cursor));
}
private static long getDefaultCursorHandle(byte cursor) {
if (CACHE[cursor] != null)
return CACHE[cursor];
return CACHE[cursor] = nGetDefaultCursorHandle(cursor);
}
private static long getHwnd() {
try {
return (long) getHwndMethod.invoke(Util.getDisplayImplementation());
} catch (Throwable error) {
throw Util.sneakyThrow(error);
}
}
private static native long nGetDefaultCursorHandle(byte cursor);
private static native void nSetCursor(long hwnd, long cursor);
}

View File

@ -0,0 +1,53 @@
package net.silentclient.client.utils.cursors;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.LWJGLException;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
public class X11SystemCursors {
private static final Logger LOGGER = LogManager.getLogger();
private static final Long[] CACHE = new Long[SystemCursors.SIZE];
private static MethodHandle getDisplayMethod;
static {
if (Util.foundInputImplementationMethod()) {
try {
Class<?> linuxDisplay = Class.forName("org.lwjgl.opengl.LinuxDisplay");
Method getDisplay = linuxDisplay.getDeclaredMethod("getDisplay");
getDisplay.setAccessible(true);
getDisplayMethod = MethodHandles.lookup().unreflect(getDisplay);
Util.loadLibrary("lwjglLegacyCursorsX11");
} catch (Throwable error) {
LOGGER.error("Could not perform reflection/load natives", error);
SystemCursors.markUnsupported();
}
} else
SystemCursors.markUnsupported();
}
public static void setCursor(byte cursor) throws LWJGLException {
Util.getInputImplementation().setNativeCursor(getDefaultCursorHandle(cursor));
}
private static long getDefaultCursorHandle(byte cursor) {
if (CACHE[cursor] != null)
return CACHE[cursor];
return CACHE[cursor] = nGetDefaultCursorHandle(getDisplay(), cursor);
}
private static long getDisplay() {
try {
return (long) getDisplayMethod.invokeExact();
} catch (Throwable error) {
throw Util.sneakyThrow(error);
}
}
private static native long nGetDefaultCursorHandle(long display, byte cursor);
}

View File

@ -0,0 +1,45 @@
package net.silentclient.client.utils.io;
import net.minecraft.client.Minecraft;
import net.minecraft.util.ResourceLocation;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import static org.lwjgl.BufferUtils.createByteBuffer;
import static org.lwjgl.system.MemoryUtil.memSlice;
public class BufferUtil {
private static BufferUtil instance = new BufferUtil();
public static BufferUtil get() {
return instance;
}
public ByteBuffer getResourceBytes(ResourceLocation resource, int bufferSize) throws IOException {
ByteBuffer buffer;
InputStream source = Minecraft.getMinecraft().getResourceManager().getResource(resource).getInputStream();
ReadableByteChannel rbc = Channels.newChannel(source);
buffer = createByteBuffer(bufferSize);
while (true) {
int bytes = rbc.read(buffer);
if (bytes == -1) {
break;
}
if (buffer.remaining() == 0) {
ByteBuffer newBuffer = createByteBuffer(buffer.capacity() * 3 / 2);
buffer.flip();
newBuffer.put(buffer);
buffer = newBuffer;
}
}
buffer.flip();
return memSlice(buffer);
}
}

View File

@ -0,0 +1,42 @@
package net.silentclient.client.utils.io;
import org.lwjgl.system.MemoryUtil;
import java.nio.Buffer;
public class LinkedStorage {
private static OBJ head;
public static void put(Object val) {
OBJ newObj = new OBJ(val);
OBJ it = tail(head);
if(it == null) head = newObj;
else it.next = newObj;
}
private static OBJ tail(OBJ head) {
OBJ it;
for (it = head; it != null && it.next != null; it = it.next);
return it;
}
public static void free() {
if(head != null) {
OBJ it;
for (it = head; it.next != null; it = it.next) {
if(it.value instanceof Buffer) {
MemoryUtil.memFree((Buffer) it.value);
}
}
head = null;
}
}
private static class OBJ {
OBJ next;
Object value;
OBJ(Object v) {
value = v;
}
}
}

View File

@ -0,0 +1,23 @@
#include <Xcursor/Xcursor.h>
#include <jni.h>
const char *LOOKUP[] = {
"default",
"text",
"crosshair",
"pointer",
"ew-resize",
"ns-resize",
"nwse-resize",
"nesw-resize",
"all-scroll",
"not-allowed"
};
JNIEXPORT jlong JNICALL Java_net_silentclient_client_utils_cursors_X11SystemCursors_nGetDefaultCursorHandle(
JNIEnv *env, jclass unused, jlong display, jbyte cursor) {
if (cursor < 0 || cursor >= sizeof(LOOKUP) / sizeof(*LOOKUP))
cursor = 0;
return XcursorLibraryLoadCursor((Display *) display, LOOKUP[cursor]);
}

Binary file not shown.

Binary file not shown.

View File

@ -119,6 +119,7 @@
"mixins.WorldClientMixin",
"mixins.WorldInfoMixin",
"mixins.WorldMixin",
"mixins.WorldRendererMixin"
"mixins.WorldRendererMixin",
"mixins.lwjgl.WindowsDisplayMixin"
]
}