diff --git a/src/main/java/net/silentclient/client/Client.java b/src/main/java/net/silentclient/client/Client.java index 851d39b..d4efe1b 100644 --- a/src/main/java/net/silentclient/client/Client.java +++ b/src/main/java/net/silentclient/client/Client.java @@ -42,7 +42,6 @@ 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; import net.silentclient.client.utils.*; import net.silentclient.client.utils.animations.AnimationHandler; import net.silentclient.client.utils.animations.SneakHandler; @@ -65,7 +64,7 @@ import java.util.List; public class Client { public static final Logger logger = LogManager.getLogger("SC"); - private final String version = "2.2.0"; + private final String version = "2.2.1"; private static final Client INSTANCE = new Client(); public static final Client getInstance() { @@ -104,7 +103,6 @@ public class Client { private AccountManager accountManager; public ServerData lastServerData; public TextUtils textUtils; - private SkillIssue skillIssue; private PlayerResponse.BanInfo banInfo; public static void memoryDebug(String paramString) { @@ -397,7 +395,6 @@ public class Client { this.textUtils = new TextUtils(Minecraft.getMinecraft().fontRendererObj); logger.info("STARTING > skillissue"); - this.skillIssue = new SkillIssue(); logger.info("-------------------------------------------------"); memoryDebug("CLIENT_POST_INIT"); } @@ -405,7 +402,6 @@ public class Client { public void shutdown() { logger.info("---------[ Silent Client Stopping ]--------------"); logger.info("STOPPING > silent-socket"); - skillIssue.sendDetections(); Players.unregister(); logger.info("-------------------------------------------------"); } diff --git a/src/main/java/net/silentclient/client/event/impl/ConnectToServerEvent.java b/src/main/java/net/silentclient/client/event/impl/ConnectToServerEvent.java index 011e951..8f6be2a 100644 --- a/src/main/java/net/silentclient/client/event/impl/ConnectToServerEvent.java +++ b/src/main/java/net/silentclient/client/event/impl/ConnectToServerEvent.java @@ -6,7 +6,6 @@ import net.silentclient.client.event.Event; public class ConnectToServerEvent extends Event { private final ServerData serverData; - public ConnectToServerEvent(ServerData serverData) { this.serverData = serverData; } diff --git a/src/main/java/net/silentclient/client/gui/GuiScreenServerListInGame.java b/src/main/java/net/silentclient/client/gui/GuiScreenServerListInGame.java deleted file mode 100644 index b519fee..0000000 --- a/src/main/java/net/silentclient/client/gui/GuiScreenServerListInGame.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.silentclient.client.gui; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiScreenServerList; -import net.minecraft.client.multiplayer.ServerData; - -import java.io.IOException; - -public class GuiScreenServerListInGame extends GuiScreenServerList { - public GuiScreenServerListInGame(GuiScreen p_i1031_1_, ServerData p_i1031_2_) { - super(p_i1031_1_, p_i1031_2_); - } - - @Override - protected void actionPerformed(GuiButton button) throws IOException { - if(button.id == 0) { - if(this.mc.theWorld != null) { - this.mc.theWorld.sendQuittingDisconnectingPacket(); - this.mc.loadWorld(null); - this.mc.displayGuiScreen(null); - } - } - - super.actionPerformed(button); - } -} diff --git a/src/main/java/net/silentclient/client/gui/SplashScreen.java b/src/main/java/net/silentclient/client/gui/SplashScreen.java deleted file mode 100644 index c368098..0000000 --- a/src/main/java/net/silentclient/client/gui/SplashScreen.java +++ /dev/null @@ -1,63 +0,0 @@ -package net.silentclient.client.gui; - -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.util.ResourceLocation; - -public class SplashScreen { - private static ResourceLocation SPLASH; - public static void update() { - if(Minecraft.getMinecraft() == null || Minecraft.getMinecraft().getLanguageManager() == null) { - return; - } - - drawSplash(Minecraft.getMinecraft().getTextureManager()); - } - - public static void setProgress(int givenProgress, String givenText) { - update(); - } - - public static void drawSplash(TextureManager tm) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - int scaleFactor = scaledResolution.getScaleFactor(); - - Framebuffer framebuffer = new Framebuffer(scaledResolution.getScaledWidth() * scaleFactor, scaledResolution.getScaledHeight() * scaleFactor, true); - framebuffer.bindFramebuffer(false); - - GlStateManager.matrixMode(GL11.GL_PROJECTION); - GlStateManager.loadIdentity(); - GlStateManager.ortho(0.0D, (double) scaledResolution.getScaledWidth(), (double) scaledResolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); - GlStateManager.matrixMode(GL11.GL_MODELVIEW); - GlStateManager.loadIdentity(); - GlStateManager.translate(0.0F, 0.0F, -2000.0F); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - GlStateManager.disableDepth(); - GlStateManager.enableTexture2D(); - - if(SPLASH == null) { - SPLASH = new ResourceLocation("silentclient/splash.png"); - } - - tm.bindTexture(SPLASH); - - GlStateManager.resetColor(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - - Gui.drawScaledCustomSizeModalRect(0, 0, 0, 0, 1920, 1080, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), 1920, 1080); - framebuffer.unbindFramebuffer(); - framebuffer.framebufferRender(scaledResolution.getScaledWidth() * scaleFactor, scaledResolution.getScaledHeight() * scaleFactor); - - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - - Minecraft.getMinecraft().updateDisplay(); - } - } diff --git a/src/main/java/net/silentclient/client/gui/lite/LiteMainMenu.java b/src/main/java/net/silentclient/client/gui/lite/LiteMainMenu.java index 4dece1a..3716197 100644 --- a/src/main/java/net/silentclient/client/gui/lite/LiteMainMenu.java +++ b/src/main/java/net/silentclient/client/gui/lite/LiteMainMenu.java @@ -83,7 +83,7 @@ public class LiteMainMenu extends SilentScreen } else { this.bannerAnimation.setAnimation(0, 30); } - RenderUtil.drawImage(PromoController.getResponse().getCurrentPanel().getImageLocation(), this.width - 74 + (-this.bannerAnimation.getValue()), this.height - 42 + (-this.bannerAnimation.getValue()), 71, 40, false); + RenderUtil.drawRoundTextured(this.width - 74 + (-this.bannerAnimation.getValue()), this.height - 42 + (-this.bannerAnimation.getValue()), 71, 40, 4, 1, PromoController.getResponse().getCurrentPanel().getImageLocation(), false); } else { PromoController.getResponse().getCurrentPanel().loadImage(); } diff --git a/src/main/java/net/silentclient/client/gui/util/RenderUtil.java b/src/main/java/net/silentclient/client/gui/util/RenderUtil.java index 8bcd615..e252efe 100644 --- a/src/main/java/net/silentclient/client/gui/util/RenderUtil.java +++ b/src/main/java/net/silentclient/client/gui/util/RenderUtil.java @@ -3,6 +3,7 @@ package net.silentclient.client.gui.util; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; @@ -13,14 +14,59 @@ import net.silentclient.client.Client; import net.silentclient.client.cosmetics.StaticResourceLocation; import net.silentclient.client.mixin.ducks.TextureManagerExt; import net.silentclient.client.utils.ColorUtils; +import net.silentclient.client.utils.ShaderUtils; import org.lwjgl.opengl.GL11; +import java.awt.*; + import static org.lwjgl.opengl.GL11.*; public class RenderUtil { final static Minecraft mc = Minecraft.getMinecraft(); final static FontRenderer fr = mc.fontRendererObj; + public static ShaderUtils roundedShader = new ShaderUtils("silentclient/shaders/roundedRect.frag"); + public static ShaderUtils roundedOutlineShader = new ShaderUtils("silentclient/shaders/roundRectOutline.frag"); + private static ShaderUtils roundedTexturedShader = new ShaderUtils("silentclient/shaders/roundRectTextured.frag"); + + public static void drawRound(float x, float y, float width, float height, float radius, Color color) { + ColorUtils.resetColor(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + roundedShader.init(); + + setupRoundedRectUniforms(x, y, width, height, radius, roundedShader); + roundedShader.setUniformf("color", color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f); + + ShaderUtils.drawQuads(x - 1, y - 1, width + 2, height + 2); + roundedShader.unload(); + GlStateManager.disableBlend(); + } + + public static void drawRoundTextured(float x, float y, float width, float height, float radius, float alpha, ResourceLocation image, boolean mipmapped) { + if(mipmapped) { + Client.getInstance().getTextureManager().bindTextureMipmapped(image); + } else { + Minecraft.getMinecraft().getTextureManager().bindTexture(image); + } + ColorUtils.resetColor(); + roundedTexturedShader.init(); + roundedTexturedShader.setUniformi("textureIn", 0); + setupRoundedRectUniforms(x, y, width, height, radius, roundedTexturedShader); + roundedTexturedShader.setUniformf("alpha", alpha); + ShaderUtils.drawQuads(x - 1, y - 1, width + 2, height + 2); + roundedTexturedShader.unload(); + GlStateManager.disableBlend(); + } + + private static void setupRoundedRectUniforms(float x, float y, float width, float height, float radius, ShaderUtils roundedTexturedShader) { + ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); + roundedTexturedShader.setUniformf("location", x * sr.getScaleFactor(), + (Minecraft.getMinecraft().displayHeight - (height * sr.getScaleFactor())) - (y * sr.getScaleFactor())); + roundedTexturedShader.setUniformf("rectSize", width * sr.getScaleFactor(), height * sr.getScaleFactor()); + roundedTexturedShader.setUniformf("radius", radius * sr.getScaleFactor()); + } + public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) { x1 = x + x1; y1 = y + y1; @@ -65,7 +111,7 @@ public class RenderUtil { glPopAttrib(); glLineWidth(1); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } + } public static void drawRoundedOutline(float x, float y, float x1, float y1, float radius,float lineWidth, int color) { x1 = x + x1; y1 = y + y1; @@ -83,13 +129,13 @@ public class RenderUtil { glBegin(GL_LINE_LOOP); int i; for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); + glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); for (i = 90; i <= 180; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); + glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); glEnd(); glEnable(GL_TEXTURE_2D); glDisable(GL_BLEND); @@ -100,7 +146,7 @@ public class RenderUtil { glPopAttrib(); glLineWidth(1); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } + } /* * diff --git a/src/main/java/net/silentclient/client/mods/HudMod.java b/src/main/java/net/silentclient/client/mods/HudMod.java index b55d8f5..f5806b5 100644 --- a/src/main/java/net/silentclient/client/mods/HudMod.java +++ b/src/main/java/net/silentclient/client/mods/HudMod.java @@ -35,6 +35,7 @@ public class HudMod extends ModDraggable { this.addBooleanSetting("Brackets", this, false); this.addBooleanSetting("Fancy Font", this, false); this.addBooleanSetting("Rounded Corners", this, false); + this.addSliderSetting("Rounding Strength", this, 3, 1, 6, true); } public String getText() { @@ -110,7 +111,7 @@ public class HudMod extends ModDraggable { preRender(); if(background) { if(roundedCorners) { - RenderUtil.drawRoundedRect(getX(), getY(), this.getRealWidth(), this.getHeight(), 6, backgroundColor.getRGB()); + RenderUtil.drawRound(getX(), getY(), this.getRealWidth(), this.getHeight(), Client.getInstance().getSettingsManager().getSettingByName(this, "Rounding Strength").getValInt(), backgroundColor); } else { RenderUtils.drawRect(getX(), getY(), this.getRealWidth(), this.getHeight(), backgroundColor.getRGB()); } diff --git a/src/main/java/net/silentclient/client/mods/hud/BlockInfoMod.java b/src/main/java/net/silentclient/client/mods/hud/BlockInfoMod.java index 36c57e7..56e0a48 100644 --- a/src/main/java/net/silentclient/client/mods/hud/BlockInfoMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/BlockInfoMod.java @@ -1,7 +1,5 @@ package net.silentclient.client.mods.hud; -import java.awt.Color; - import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -15,13 +13,16 @@ import net.minecraft.potion.Potion; import net.minecraft.util.BlockPos; import net.minecraft.util.MovingObjectPosition.MovingObjectType; import net.silentclient.client.Client; +import net.silentclient.client.gui.hud.ScreenPosition; import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; -import net.silentclient.client.gui.hud.ScreenPosition; +import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.CustomFontRenderer; import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.ModDraggable; +import java.awt.*; + public class BlockInfoMod extends ModDraggable { private BlockPos pos; private IBlockState state; @@ -43,6 +44,8 @@ public class BlockInfoMod extends ModDraggable { this.addColorSetting("Color", this, new Color(255, 255, 255)); this.addBooleanSetting("Font Shadow", this, true); this.addBooleanSetting("Fancy Font", this, false); + this.addBooleanSetting("Rounded Corners", this, false); + this.addSliderSetting("Rounding Strength", this, 3, 1, 6, true); } @Override @@ -70,6 +73,8 @@ public class BlockInfoMod extends ModDraggable { if(block != null && !block.equals(Blocks.portal) && !block.equals(Blocks.end_portal)) { String harvest = ""; boolean background = Client.getInstance().getSettingsManager().getSettingByName(this, "Background").getValBoolean(); + boolean roundedCorners = Client.getInstance().getSettingsManager().getSettingByName(this, "Rounded Corners").getValBoolean(); + Color backgroundColor = Client.getInstance().getSettingsManager().getSettingByName(this, "Background Color").getValColor(); boolean fontShadow = Client.getInstance().getSettingsManager().getSettingByName(this, "Font Shadow").getValBoolean(); Color color = Client.getInstance().getSettingsManager().getSettingByName(this, "Color").getValColor(); @@ -82,11 +87,15 @@ public class BlockInfoMod extends ModDraggable { float infoY = 4.5F; font.setRenderMode(fancyFont ? CustomFontRenderer.RenderMode.CUSTOM : CustomFontRenderer.RenderMode.DEFAULT); - + if(background) { - RenderUtils.drawRect(0, 0, getWidth(), getHeight(), backgroundColor.getRGB()); + if(roundedCorners) { + RenderUtil.drawRound(0, 0, getWidth(), getHeight(), Client.getInstance().getSettingsManager().getSettingByName(this, "Rounding Strength").getValInt(), backgroundColor); + } else { + RenderUtils.drawRect(0, 0, getWidth(), getHeight(), backgroundColor.getRGB()); + } } - + GlUtils.startScale(0, 0, 5, 50, 1.8F); RenderHelper.enableGUIStandardItemLighting(); mc.getRenderItem().renderItemAndEffectIntoGUI(new ItemStack(block), 0 + 5, 0 + (50 / 2) - 8); diff --git a/src/main/java/net/silentclient/client/mods/hud/CoordinatesMod.java b/src/main/java/net/silentclient/client/mods/hud/CoordinatesMod.java index f893f58..63040ce 100644 --- a/src/main/java/net/silentclient/client/mods/hud/CoordinatesMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/CoordinatesMod.java @@ -1,16 +1,17 @@ package net.silentclient.client.mods.hud; -import java.awt.Color; - import net.minecraft.util.BlockPos; import net.minecraft.world.chunk.Chunk; import net.silentclient.client.Client; -import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.hud.ScreenPosition; +import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; +import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.CustomFontRenderer; import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.ModDraggable; +import java.awt.*; + public class CoordinatesMod extends ModDraggable { int maxWidth = 0; @@ -27,6 +28,8 @@ public class CoordinatesMod extends ModDraggable { this.addBooleanSetting("Font Shadow", this, true); this.addBooleanSetting("Brackets", this, false); this.addBooleanSetting("Fancy Font", this, false); + this.addBooleanSetting("Rounded Corners", this, false); + this.addSliderSetting("Rounding Strength", this, 3, 1, 6, true); this.addBooleanSetting("Show Biome", this, true); } @@ -48,6 +51,7 @@ public class CoordinatesMod extends ModDraggable { CustomFontRenderer font = new CustomFontRenderer(); font.setRenderMode(fancyFont ? CustomFontRenderer.RenderMode.CUSTOM : CustomFontRenderer.RenderMode.DEFAULT); + boolean roundedCorners = Client.getInstance().getSettingsManager().getSettingByName(this, "Rounded Corners").getValBoolean(); boolean background = Client.getInstance().getSettingsManager().getSettingByName(this, "Background").getValBoolean(); Color backgroundColor = Client.getInstance().getSettingsManager().getSettingByName(this, "Background Color").getValColor(); boolean fontShadow = Client.getInstance().getSettingsManager().getSettingByName(this, "Font Shadow").getValBoolean(); @@ -67,7 +71,11 @@ public class CoordinatesMod extends ModDraggable { } if(background) { - RenderUtils.drawRect(0, 0, maxWidth, getHeight(), backgroundColor.getRGB()); + if(roundedCorners) { + RenderUtil.drawRound(0, 0, maxWidth, getHeight(), Client.getInstance().getSettingsManager().getSettingByName(this, "Rounding Strength").getValInt(), backgroundColor); + } else { + RenderUtils.drawRect(0, 0, maxWidth, getHeight(), backgroundColor.getRGB()); + } } font.drawString((!brackets ? "" : "[") + "X: " + (int) (mc.thePlayer.posX) + (!brackets ? "" : "]"), (int) (0 + 4.5F), (int) (0 + 4.5F), color.getRGB(), fontShadow); diff --git a/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java b/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java index e27e2f0..3422162 100644 --- a/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java @@ -38,6 +38,7 @@ public class KeystrokesMod extends ModDraggable { this.addBooleanSetting("Fancy Font", this, false); this.addBooleanSetting("Background", this, true); this.addBooleanSetting("Rounded Corners", this, false); + this.addSliderSetting("Rounding Strength", this, 3, 1, 6, true); this.addModeSetting("CPS Mode", this, "Small", cpsModes); this.addColorSetting("Color", this, new Color(255, 255, 255)); this.addColorSetting("Background Color", this, new Color(0, 0, 0), 127); @@ -205,13 +206,13 @@ public class KeystrokesMod extends ModDraggable { setAnimation(key.blue, key.isDown() ? clickedBackgroundColor.getBlue() : backgroundColor.getBlue(), fadeDelay); setAnimation(key.alpha, key.isDown() ? clickedBackgroundColor.getAlpha() : backgroundColor.getAlpha(), fadeDelay); if(roundedCorners) { - RenderUtil.drawRoundedRect( + RenderUtil.drawRound( key.getX(), key.getY(), key.getWidth(), key.getHeight(), - 6, - new Color((int) key.red.getValue(), (int) key.green.getValue(), (int) key.blue.getValue(), (int) key.alpha.getValue()).getRGB() + Client.getInstance().getSettingsManager().getSettingByName(this, "Rounding Strength").getValInt(), + new Color((int) key.red.getValue(), (int) key.green.getValue(), (int) key.blue.getValue(), (int) key.alpha.getValue()) ); } else { RenderUtils.drawRect( @@ -308,13 +309,13 @@ public class KeystrokesMod extends ModDraggable { setAnimation(Space.blue, Space.isDown() ? clickedBackgroundColor.getBlue() : backgroundColor.getBlue(), fadeDelay); setAnimation(Space.alpha, Space.isDown() ? clickedBackgroundColor.getAlpha() : backgroundColor.getAlpha(), fadeDelay); if(roundedCorners) { - RenderUtil.drawRoundedRect( + RenderUtil.drawRound( 0, 0 + mode.getHeight() + 2, mode.getWidth(), 10, - 6, - new Color((int) Space.red.getValue(), (int) Space.green.getValue(), (int) Space.blue.getValue(), (int) Space.alpha.getValue()).getRGB() + Client.getInstance().getSettingsManager().getSettingByName(this, "Rounding Strength").getValInt(), + new Color((int) Space.red.getValue(), (int) Space.green.getValue(), (int) Space.blue.getValue(), (int) Space.alpha.getValue()) ); } else { RenderUtils.drawRect( diff --git a/src/main/java/net/silentclient/client/mods/hypixel/QuickPlayMod.java b/src/main/java/net/silentclient/client/mods/hypixel/QuickPlayMod.java index fe62f56..4f48eb1 100644 --- a/src/main/java/net/silentclient/client/mods/hypixel/QuickPlayMod.java +++ b/src/main/java/net/silentclient/client/mods/hypixel/QuickPlayMod.java @@ -4,6 +4,7 @@ import com.google.common.reflect.TypeToken; import net.minecraft.client.Minecraft; import net.silentclient.client.Client; import net.silentclient.client.event.EventTarget; +import net.silentclient.client.event.impl.ConnectToServerEvent; import net.silentclient.client.event.impl.KeyEvent; import net.silentclient.client.gui.quickplay.QuickplayGui; import net.silentclient.client.mods.Mod; @@ -68,7 +69,12 @@ public class QuickPlayMod extends Mod { public void updateHashMap() { HashMap map = new HashMap<>(); for(Setting setting : Client.getInstance().getSettingsManager().getSettingByMod(this)) { - if (setting.isKeybind()) { + if(setting.getName().equals("Open Menu")) { + map.put(setting.getKeybind(), setting); + continue; + } + String[] args = setting.getName().split("&"); + if (((args[1].equals("Hypixel") && Server.isHypixel()) || (args[1].equals("RuHypixel") && Server.isRuHypixel())) && setting.isKeybind()) { map.put(setting.getKeybind(), setting); } } @@ -76,6 +82,11 @@ public class QuickPlayMod extends Mod { hashMap = map; } + @EventTarget + public void onServerJoin(ConnectToServerEvent event) { + updateHashMap(); + } + @Override public void onChangeSettingValue(Setting setting) { super.onChangeSettingValue(setting); @@ -133,7 +144,7 @@ public class QuickPlayMod extends Mod { if(setting != null) { if(setting.getName().equals("Open Menu")) { // Open Menu - if(setting.isKeyDown() && (Server.isHypixel() || Server.isRuHypixel())) { + if(Server.isHypixel() || Server.isRuHypixel()) { mc.displayGuiScreen(new QuickplayGui()); } } else { @@ -141,9 +152,7 @@ public class QuickPlayMod extends Mod { return; } String[] args = setting.getName().split("&"); - if(((args[1].equals("Hypixel") && Server.isHypixel()) || (args[1].equals("RuHypixel") && Server.isRuHypixel())) && setting.isKeyDown()) { - runCommand(args[2]); - } + runCommand(args[2]); } } } diff --git a/src/main/java/net/silentclient/client/mods/render/ChatMod.java b/src/main/java/net/silentclient/client/mods/render/ChatMod.java index 41e0cc9..e6bcea6 100644 --- a/src/main/java/net/silentclient/client/mods/render/ChatMod.java +++ b/src/main/java/net/silentclient/client/mods/render/ChatMod.java @@ -1,8 +1,13 @@ package net.silentclient.client.mods.render; import net.minecraft.client.gui.GuiNewChat; +import net.minecraft.event.ClickEvent; +import net.minecraft.event.HoverEvent; import net.minecraft.network.play.server.S02PacketChat; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.ChatStyle; import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StringUtils; import net.silentclient.client.Client; import net.silentclient.client.event.EventTarget; import net.silentclient.client.event.impl.EventReceivePacket; @@ -24,6 +29,7 @@ public class ChatMod extends Mod { this.addBooleanSetting("Smooth", this, false); this.addSliderSetting("Smooth Speed", this, 4, 1, 10, false); this.addBooleanSetting("Disable Background", this, true); + this.addBooleanSetting("Copy Message Button", this, false); this.addBooleanSetting("Anti-Spam", this, false); } @@ -31,7 +37,23 @@ public class ChatMod extends Mod { public void chat(EventReceivePacket event) { if(event.getPacket() instanceof S02PacketChat && !event.isCancelable()) { final S02PacketChat chatPacket = (S02PacketChat)event.getPacket(); - if (Client.getInstance().getSettingsManager().getSettingByName(this, "Anti-Spam").getValBoolean() && chatPacket.getType() == 0) { + if(chatPacket.getType() == 2) return; + + if (Client.getInstance().getSettingsManager().getSettingByName(this, "Copy Message Button").getValBoolean()) { + String unformattedText = StringUtils.stripControlCodes(chatPacket.getChatComponent().getUnformattedText()); + if (!unformattedText.replace(" ", "").isEmpty()) { + ChatComponentText copyText = new ChatComponentText(EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "[COPY]"); + ChatStyle style = new ChatStyle() + .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.GRAY + "Copy message"))) + .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/slc$copy " + unformattedText)); + copyText.setChatStyle(style); + + chatPacket.getChatComponent().appendSibling(new ChatComponentText(EnumChatFormatting.RESET + " ")); + chatPacket.getChatComponent().appendSibling(copyText); + } + } + + if (Client.getInstance().getSettingsManager().getSettingByName(this, "Anti-Spam").getValBoolean()) { GuiNewChat guiNewChat = mc.ingameGUI.getChatGUI(); if (lastMessage.equals(chatPacket.getChatComponent().getUnformattedText())) { guiNewChat.deleteChatLine(line); diff --git a/src/main/java/net/silentclient/client/mods/render/skins/Direction.java b/src/main/java/net/silentclient/client/mods/render/skins/Direction.java index 340f729..f857399 100644 --- a/src/main/java/net/silentclient/client/mods/render/skins/Direction.java +++ b/src/main/java/net/silentclient/client/mods/render/skins/Direction.java @@ -8,7 +8,7 @@ public enum Direction { DOWN(new Vec3i(0, -1, 0)), UP(new Vec3i(0, 1, 0)), NORTH(new Vec3i(0, 0, -1)), SOUTH(new Vec3i(0, 0, 1)), WEST(new Vec3i(-1, 0, 0)), EAST(new Vec3i(1, 0, 0)); - private Direction(Vec3i normal) { + Direction(Vec3i normal) { this.normal = normal; } diff --git a/src/main/java/net/silentclient/client/mods/render/skins/SkullRendererCache.java b/src/main/java/net/silentclient/client/mods/render/skins/SkullRendererCache.java deleted file mode 100644 index c88e439..0000000 --- a/src/main/java/net/silentclient/client/mods/render/skins/SkullRendererCache.java +++ /dev/null @@ -1,31 +0,0 @@ -package net.silentclient.client.mods.render.skins; - -import net.minecraft.item.ItemStack; -import net.silentclient.client.mixin.accessors.skins.SkullSettings; -import net.silentclient.client.mods.render.skins.render.CustomizableModelPart; - -import java.util.WeakHashMap; - -public class SkullRendererCache { - - public static boolean renderNext = false; - public static SkullSettings lastSkull = null; - public static WeakHashMap itemCache = new WeakHashMap<>(); - - public static class ItemSettings implements SkullSettings { - - private CustomizableModelPart hatModel = null; - - @Override - public CustomizableModelPart getHeadLayers() { - return hatModel; - } - - @Override - public void setupHeadLayers(CustomizableModelPart box) { - this.hatModel = box; - } - - } - -} diff --git a/src/main/java/net/silentclient/client/mods/render/skins/renderlayers/BodyLayerFeatureRenderer.java b/src/main/java/net/silentclient/client/mods/render/skins/renderlayers/BodyLayerFeatureRenderer.java index 325910c..a37e8ac 100644 --- a/src/main/java/net/silentclient/client/mods/render/skins/renderlayers/BodyLayerFeatureRenderer.java +++ b/src/main/java/net/silentclient/client/mods/render/skins/renderlayers/BodyLayerFeatureRenderer.java @@ -21,13 +21,11 @@ import java.util.function.Supplier; public class BodyLayerFeatureRenderer implements LayerRenderer { - private RenderPlayer playerRenderer; private final boolean thinArms; private static final Minecraft mc = Minecraft.getMinecraft(); public BodyLayerFeatureRenderer( RenderPlayer playerRenderer) { - this.playerRenderer = playerRenderer; thinArms = ((PlayerEntityModelAccessor)playerRenderer).client$hasThinArms(); bodyLayers.add(new Layer(0, false, EnumPlayerModelParts.LEFT_PANTS_LEG, Shape.LEGS, () -> playerRenderer.getMainModel().bipedLeftLeg, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Left Leg").getValBoolean())); bodyLayers.add(new Layer(1, false, EnumPlayerModelParts.RIGHT_PANTS_LEG, Shape.LEGS, () -> playerRenderer.getMainModel().bipedRightLeg, () -> Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Right Leg").getValBoolean())); diff --git a/src/main/java/net/silentclient/client/mods/render/skins/renderlayers/HeadLayerFeatureRenderer.java b/src/main/java/net/silentclient/client/mods/render/skins/renderlayers/HeadLayerFeatureRenderer.java index 74d831f..5a4b7d0 100644 --- a/src/main/java/net/silentclient/client/mods/render/skins/renderlayers/HeadLayerFeatureRenderer.java +++ b/src/main/java/net/silentclient/client/mods/render/skins/renderlayers/HeadLayerFeatureRenderer.java @@ -37,7 +37,7 @@ public class HeadLayerFeatureRenderer implements LayerRenderer Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt()*Client.getInstance().getSettingsManager().getSettingByClass(SkinsMod.class, "Level Of Detail Distance").getValInt())return; - ItemStack itemStack = player.getEquipmentInSlot(1); //TODO + ItemStack itemStack = player.getEquipmentInSlot(1); if (itemStack != null && hideHeadLayers.contains(itemStack.getItem())) { return; } diff --git a/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java b/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java index d9a9a88..ce3ea50 100644 --- a/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java +++ b/src/main/java/net/silentclient/client/mods/settings/GeneralMod.java @@ -17,9 +17,7 @@ public class GeneralMod extends Mod { public boolean isEnabled() { return true; } - - boolean lastFullscreen = false; - + public GeneralMod() { super("General", ModCategory.SETTINGS, "silentclient/icons/settings/general.png"); } diff --git a/src/main/java/net/silentclient/client/mods/settings/RenderMod.java b/src/main/java/net/silentclient/client/mods/settings/RenderMod.java index 8bd4a76..f83f6e0 100644 --- a/src/main/java/net/silentclient/client/mods/settings/RenderMod.java +++ b/src/main/java/net/silentclient/client/mods/settings/RenderMod.java @@ -9,7 +9,6 @@ public class RenderMod extends Mod { public boolean isEnabled() { return true; } - public RenderMod() { super("Render", ModCategory.SETTINGS, "silentclient/icons/settings/render.png"); diff --git a/src/main/java/net/silentclient/client/mods/staff/RadmirMod.java b/src/main/java/net/silentclient/client/mods/staff/RadmirMod.java deleted file mode 100644 index d9afe9f..0000000 --- a/src/main/java/net/silentclient/client/mods/staff/RadmirMod.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.silentclient.client.mods.staff; - -import net.silentclient.client.event.EventTarget; -import net.silentclient.client.event.impl.EventText; -import net.silentclient.client.mods.Mod; -import net.silentclient.client.mods.ModCategory; - -public class RadmirMod extends Mod { - public RadmirMod() { - super("Radmir Mod", ModCategory.MODS, "silentclient/mods/radmir/radmir.png"); - } - - @EventTarget - public void onText(EventText event) { - event.setOutputText(this.replaceWords(event.getText(), "Radmir (курица)")); - } - - private String replaceWords(String input, String replacement) { - String[] words = input.split("\\s+"); - - for (int i = 0; i < words.length; i++) { - words[i] = replacement; - } - - return String.join(" ", words); - } -} diff --git a/src/main/java/net/silentclient/client/mods/util/Server.java b/src/main/java/net/silentclient/client/mods/util/Server.java index 1f47cd2..ada6e81 100644 --- a/src/main/java/net/silentclient/client/mods/util/Server.java +++ b/src/main/java/net/silentclient/client/mods/util/Server.java @@ -11,7 +11,6 @@ public class Server { public static boolean isHypixel() { return hypixel; } - public static void setHypixel(boolean hypixel) { Server.hypixel = hypixel; } @@ -19,7 +18,6 @@ public class Server { public static boolean isRuHypixel() { return ruHypixel; } - public static void setRuHypixel(boolean ruHypixel) { Server.ruHypixel = ruHypixel; } diff --git a/src/main/java/net/silentclient/client/mods/world/WeatherChangerMod.java b/src/main/java/net/silentclient/client/mods/world/WeatherChangerMod.java index 3ca1c4e..483a2fc 100644 --- a/src/main/java/net/silentclient/client/mods/world/WeatherChangerMod.java +++ b/src/main/java/net/silentclient/client/mods/world/WeatherChangerMod.java @@ -1,7 +1,5 @@ package net.silentclient.client.mods.world; -import java.util.ArrayList; - import net.minecraft.network.play.server.S2BPacketChangeGameState; import net.silentclient.client.Client; import net.silentclient.client.event.EventTarget; @@ -11,6 +9,8 @@ import net.silentclient.client.event.impl.EventReceivePacket; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; +import java.util.ArrayList; + public class WeatherChangerMod extends Mod { public WeatherChangerMod() { super("Weather", ModCategory.MODS, "silentclient/icons/mods/weatherchanger.png"); @@ -68,6 +68,4 @@ public class WeatherChangerMod extends Mod { event.setCancelled(true); } } - - } diff --git a/src/main/java/net/silentclient/client/premium/PremiumCosmeticsGui.java b/src/main/java/net/silentclient/client/premium/PremiumCosmeticsGui.java index 0bd2577..9314ff7 100644 --- a/src/main/java/net/silentclient/client/premium/PremiumCosmeticsGui.java +++ b/src/main/java/net/silentclient/client/premium/PremiumCosmeticsGui.java @@ -85,7 +85,7 @@ public class PremiumCosmeticsGui extends SilentScreen { } Client.getInstance().getSilentFontRenderer().drawString((scaledResolution.getScaledWidth() / 2) - (Client.getInstance().getSilentFontRenderer().getStringWidth(month, 18, FontType.HEADER) / 2), 10, month, 18, FontType.HEADER); - RenderUtil.drawImage(new ResourceLocation(Client.getInstance().getAccount().isPremiumPlus() ? "silentclient/premium/premium_plus.png" : "silentclient/premium/premium.png"), (scaledResolution.getScaledWidth() / 2) - 44.5F, 30, 89, Client.getInstance().getAccount().isPremiumPlus() ? 19 : 21); + RenderUtil.drawImage(new ResourceLocation(Client.getInstance().getAccount().isPremiumPlus() ? "silentclient/premium/premium_plus.png" : "silentclient/premium/premium.png"), (scaledResolution.getScaledWidth() / 2) - 44.5F, 30, 89, Client.getInstance().getAccount().isPremiumPlus() ? 19.3F : 21.34F); Client.getInstance().getSilentFontRenderer().drawCenteredString("Hey " + Minecraft.getMinecraft().getSession().getUsername() + "! Thanks for being awesome and continuing", (scaledResolution.getScaledWidth() / 2), 50, 8, FontType.HEADER); Client.getInstance().getSilentFontRenderer().drawCenteredString("your Premium" + (Client.getInstance().getAccount().isPremiumPlus() ? "+" : "") + " subscription. New Exclusive cosmetic items", (scaledResolution.getScaledWidth() / 2), 60, 8, FontType.HEADER); Client.getInstance().getSilentFontRenderer().drawCenteredString("are available to you. You can access using the cosmetics menu", (scaledResolution.getScaledWidth() / 2), 70, 8, FontType.HEADER); diff --git a/src/main/java/net/silentclient/client/skillissue/SkillIssue.java b/src/main/java/net/silentclient/client/skillissue/SkillIssue.java deleted file mode 100644 index fc1d27a..0000000 --- a/src/main/java/net/silentclient/client/skillissue/SkillIssue.java +++ /dev/null @@ -1,60 +0,0 @@ -package net.silentclient.client.skillissue; - -import net.minecraft.client.Minecraft; -import net.silentclient.client.Client; -import net.silentclient.client.event.EventManager; -import net.silentclient.client.event.EventTarget; -import net.silentclient.client.event.impl.ClientTickEvent; -import net.silentclient.client.skillissue.detections.Detection; -import net.silentclient.client.utils.Requests; -import net.silentclient.client.utils.TimerUtils; -import org.json.JSONArray; -import org.json.JSONObject; - -import java.util.ArrayList; - -public class SkillIssue { - public static final String VERSION = "1.0.0-beta.1"; - private final ArrayList detections = new ArrayList<>(); - private TimerUtils timer; - - public SkillIssue() { - EventManager.register(this); - Client.logger.info(String.format("[SkillIssue]: Initialising (v%s)", VERSION)); -// detections.add(new Reach(this)); -// detections.add(new AutoClicker(this)); - timer = new TimerUtils(); - } - - @EventTarget - public void tickEvent(ClientTickEvent event) { - if(timer.delay(30000)) { - timer.reset(); - (new Thread(this::sendDetections)).start(); - } - } - - public void sendDetections() { - JSONArray jsonArray = new JSONArray(); - for(Detection detection : detections) { - for(String detectReason : detection.getDetections()) { - jsonArray.put(new JSONObject().put("type", detection.getName().toLowerCase()).put("message", detectReason)); - } - detection.getDetections().clear(); - } - if(jsonArray.isEmpty()) { - return; - } - JSONObject jsonObject = new JSONObject().put("detects", jsonArray); - - Requests.post("https://api.silentclient.net/anticheat/detect", jsonObject.toString()); - - if(Minecraft.getMinecraft().theWorld != null) { - Client.getInstance().updateUserInformation(); - } - } - - public ArrayList getDetections() { - return detections; - } -} diff --git a/src/main/java/net/silentclient/client/skillissue/detections/AutoClicker.java b/src/main/java/net/silentclient/client/skillissue/detections/AutoClicker.java deleted file mode 100644 index 736ca65..0000000 --- a/src/main/java/net/silentclient/client/skillissue/detections/AutoClicker.java +++ /dev/null @@ -1,27 +0,0 @@ -package net.silentclient.client.skillissue.detections; - -import net.silentclient.client.Client; -import net.silentclient.client.event.EventTarget; -import net.silentclient.client.event.impl.EntityAttackEvent; -import net.silentclient.client.skillissue.SkillIssue; -import net.silentclient.client.utils.PlayerUtils; -import org.lwjgl.input.Mouse; - -public class AutoClicker extends Detection { - private long lastHit = 0; - - public AutoClicker(SkillIssue skillIssue) { - super(skillIssue, "AutoClicker"); - } - - @EventTarget - public void onHit(EntityAttackEvent event) { - if(System.currentTimeMillis() - lastHit < 500 || !PlayerUtils.isSurvival()) { - return; - } - this.lastHit = System.currentTimeMillis(); - if(!Mouse.isButtonDown(0) && Client.getInstance().getCPSTracker().getLCPS() > 10) { - this.detect(String.format("lmb is not pressed when hitting, %s cps", Client.getInstance().getCPSTracker().getLCPS())); - } - } -} diff --git a/src/main/java/net/silentclient/client/skillissue/detections/Detection.java b/src/main/java/net/silentclient/client/skillissue/detections/Detection.java deleted file mode 100644 index 2ddabf7..0000000 --- a/src/main/java/net/silentclient/client/skillissue/detections/Detection.java +++ /dev/null @@ -1,34 +0,0 @@ -package net.silentclient.client.skillissue.detections; - -import net.minecraft.client.Minecraft; -import net.silentclient.client.Client; -import net.silentclient.client.event.EventManager; -import net.silentclient.client.skillissue.SkillIssue; - -import java.util.ArrayList; - -public class Detection { - protected Minecraft mc = Minecraft.getMinecraft(); - protected SkillIssue skillIssue; - private final String name; - protected ArrayList detections = new ArrayList<>(); - - public Detection(SkillIssue skillIssue, String name) { - this.skillIssue = skillIssue; - this.name = name; - EventManager.register(this); - } - - public void detect(String data) { - this.detections.add(data); - Client.logger.warn(String.format("[SkillIssue]: %s Detection: %s (vl: %s)", name, data, detections.size())); - } - - public ArrayList getDetections() { - return detections; - } - - public String getName() { - return name; - } -} diff --git a/src/main/java/net/silentclient/client/skillissue/detections/Reach.java b/src/main/java/net/silentclient/client/skillissue/detections/Reach.java deleted file mode 100644 index bee6940..0000000 --- a/src/main/java/net/silentclient/client/skillissue/detections/Reach.java +++ /dev/null @@ -1,29 +0,0 @@ -package net.silentclient.client.skillissue.detections; - -import net.silentclient.client.event.EventTarget; -import net.silentclient.client.event.impl.EntityAttackEvent; -import net.silentclient.client.mods.hud.ReachDisplayMod; -import net.silentclient.client.skillissue.SkillIssue; -import net.silentclient.client.utils.PlayerUtils; - -public class Reach extends Detection { - private long lastHit = 0; - - public Reach(SkillIssue skillIssue) { - super(skillIssue, "Reach"); - } - - @EventTarget - public void totallyNoReachHax(EntityAttackEvent event) { - if(System.currentTimeMillis() - lastHit < 500 || !PlayerUtils.isSurvival() || mc.isSingleplayer()) { - return; - } - if(mc.objectMouseOver != null && mc.objectMouseOver.hitVec != null) { - this.lastHit = System.currentTimeMillis(); - double distance = mc.objectMouseOver.hitVec.distanceTo(mc.thePlayer.getPositionEyes(1.0F)); - if(distance > 3) { - this.detect("distance: " + ReachDisplayMod.FORMAT.format(distance)); - } - } - } -} diff --git a/src/main/java/net/silentclient/client/utils/ScreenshotManager.java b/src/main/java/net/silentclient/client/utils/ScreenshotManager.java index 602507e..aa14f64 100644 --- a/src/main/java/net/silentclient/client/utils/ScreenshotManager.java +++ b/src/main/java/net/silentclient/client/utils/ScreenshotManager.java @@ -1,23 +1,20 @@ package net.silentclient.client.utils; -import java.awt.HeadlessException; -import java.awt.Toolkit; +import net.minecraft.client.Minecraft; +import net.minecraft.util.Util; +import net.silentclient.client.Client; +import net.silentclient.client.event.EventTarget; +import net.silentclient.client.event.impl.RunCommandEvent; +import net.silentclient.client.utils.AsyncScreenshots.ImageSelection; +import org.lwjgl.Sys; + +import java.awt.*; +import java.awt.datatransfer.StringSelection; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URI; -import net.silentclient.client.event.EventTarget; -import net.silentclient.client.event.impl.RunCommandEvent; -import org.lwjgl.Sys; - -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.Util; -import net.silentclient.client.Client; -import net.silentclient.client.utils.AsyncScreenshots.ImageSelection; - public class ScreenshotManager { private File screenshot; private BufferedImage image; @@ -46,6 +43,12 @@ public class ScreenshotManager { @EventTarget() public void command(RunCommandEvent event) { + if(event.getCommand().startsWith("/slc$copy ")) { + String message = event.getCommand().replace("/slc$copy ", ""); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(message), null); + event.setCancelled(true); + return; + } switch(event.getCommand()) { case "/$openfolder": File file1 = new File(mc.mcDataDir, "screenshots"); diff --git a/src/main/java/net/silentclient/client/utils/ShaderUtils.java b/src/main/java/net/silentclient/client/utils/ShaderUtils.java new file mode 100644 index 0000000..9bbed51 --- /dev/null +++ b/src/main/java/net/silentclient/client/utils/ShaderUtils.java @@ -0,0 +1,123 @@ +package net.silentclient.client.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.util.ResourceLocation; + +import java.io.IOException; +import java.io.InputStream; + +import static org.lwjgl.opengl.GL11.*; +import static org.lwjgl.opengl.GL20.*; + +public class ShaderUtils { + + private static Minecraft mc = Minecraft.getMinecraft(); + private final int programID; + + public ShaderUtils(String fragmentShaderLoc, String vertexShaderLoc) { + int program = glCreateProgram(); + try { + int fragmentShaderID = createShader(mc.getResourceManager().getResource(new ResourceLocation(fragmentShaderLoc)).getInputStream(), GL_FRAGMENT_SHADER);; + glAttachShader(program, fragmentShaderID); + + int vertexShaderID = createShader(mc.getResourceManager().getResource(new ResourceLocation(vertexShaderLoc)).getInputStream(), GL_VERTEX_SHADER); + glAttachShader(program, vertexShaderID); + } catch (IOException e) { + e.printStackTrace(); + } + + glLinkProgram(program); + int status = glGetProgrami(program, GL_LINK_STATUS); + + if (status == 0) { + throw new IllegalStateException("Shader failed to link!"); + } + this.programID = program; + } + + public ShaderUtils(String fragmentShaderLoc) { + this(fragmentShaderLoc, "silentclient/shaders/vertex.vsh"); + } + + + public void init() { + glUseProgram(programID); + } + + public void unload() { + glUseProgram(0); + } + + public int getUniform(String name) { + return glGetUniformLocation(programID, name); + } + + + public void setUniformf(String name, float... args) { + int loc = glGetUniformLocation(programID, name); + switch (args.length) { + case 1: + glUniform1f(loc, args[0]); + break; + case 2: + glUniform2f(loc, args[0], args[1]); + break; + case 3: + glUniform3f(loc, args[0], args[1], args[2]); + break; + case 4: + glUniform4f(loc, args[0], args[1], args[2], args[3]); + break; + } + } + + public void setUniformi(String name, int... args) { + int loc = glGetUniformLocation(programID, name); + if (args.length > 1) glUniform2i(loc, args[0], args[1]); + else glUniform1i(loc, args[0]); + } + + public static void drawQuads(float x, float y, float width, float height) { + glBegin(GL_QUADS); + glTexCoord2f(0, 0); + glVertex2f(x, y); + glTexCoord2f(0, 1); + glVertex2f(x, y + height); + glTexCoord2f(1, 1); + glVertex2f(x + width, y + height); + glTexCoord2f(1, 0); + glVertex2f(x + width, y); + glEnd(); + } + + public static void drawQuads() { + ScaledResolution sr = new ScaledResolution(mc); + float width = (float) sr.getScaledWidth_double(); + float height = (float) sr.getScaledHeight_double(); + glBegin(GL_QUADS); + glTexCoord2f(0, 1); + glVertex2f(0, 0); + glTexCoord2f(0, 0); + glVertex2f(0, height); + glTexCoord2f(1, 0); + glVertex2f(width, height); + glTexCoord2f(1, 1); + glVertex2f(width, 0); + glEnd(); + } + + private int createShader(InputStream inputStream, int shaderType) { + int shader = glCreateShader(shaderType); + glShaderSource(shader, FileUtils.readInputStream(inputStream)); + glCompileShader(shader); + + + if (glGetShaderi(shader, GL_COMPILE_STATUS) == 0) { + System.out.println(glGetShaderInfoLog(shader, 4096)); + throw new IllegalStateException(String.format("Shader failed to compile!", shaderType)); + } + + return shader; + } +} diff --git a/src/main/resources/assets/minecraft/silentclient/premium/premium.png b/src/main/resources/assets/minecraft/silentclient/premium/premium.png index 412764c..878fb48 100644 Binary files a/src/main/resources/assets/minecraft/silentclient/premium/premium.png and b/src/main/resources/assets/minecraft/silentclient/premium/premium.png differ diff --git a/src/main/resources/assets/minecraft/silentclient/premium/premium_plus.png b/src/main/resources/assets/minecraft/silentclient/premium/premium_plus.png index 8ac0286..b978d96 100644 Binary files a/src/main/resources/assets/minecraft/silentclient/premium/premium_plus.png and b/src/main/resources/assets/minecraft/silentclient/premium/premium_plus.png differ diff --git a/src/main/resources/assets/minecraft/silentclient/premium/promo.png b/src/main/resources/assets/minecraft/silentclient/premium/promo.png index 3c48a5e..e4997cc 100644 Binary files a/src/main/resources/assets/minecraft/silentclient/premium/promo.png and b/src/main/resources/assets/minecraft/silentclient/premium/promo.png differ diff --git a/src/main/resources/assets/minecraft/silentclient/shaders/roundRectOutline.frag b/src/main/resources/assets/minecraft/silentclient/shaders/roundRectOutline.frag new file mode 100644 index 0000000..0481bbe --- /dev/null +++ b/src/main/resources/assets/minecraft/silentclient/shaders/roundRectOutline.frag @@ -0,0 +1,19 @@ +#version 120 + +uniform vec2 location, rectSize; +uniform vec4 color, outlineColor; +uniform float radius, outlineThickness; + +float roundedSDF(vec2 centerPos, vec2 size, float radius) { + return length(max(abs(centerPos) - size + radius, 0.0)) - radius; +} + +void main() { + float distance = roundedSDF(gl_FragCoord.xy - location - (rectSize * .5), (rectSize * .5) + (outlineThickness *.5) - 1.0, radius); + + float blendAmount = smoothstep(0., 2., abs(distance) - (outlineThickness * .5)); + + vec4 insideColor = (distance < 0.) ? color : vec4(outlineColor.rgb, 0.0); + gl_FragColor = mix(outlineColor, insideColor, blendAmount); + +} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/silentclient/shaders/roundRectTextured.frag b/src/main/resources/assets/minecraft/silentclient/shaders/roundRectTextured.frag new file mode 100644 index 0000000..fc89337 --- /dev/null +++ b/src/main/resources/assets/minecraft/silentclient/shaders/roundRectTextured.frag @@ -0,0 +1,16 @@ +#version 120 + +uniform vec2 location, rectSize; +uniform sampler2D textureIn; +uniform float radius, alpha; + +float roundedBoxSDF(vec2 centerPos, vec2 size, float radius) { + return length(max(abs(centerPos) -size, 0.)) - radius; +} + + +void main() { + float distance = roundedBoxSDF((rectSize * .5) - (gl_TexCoord[0].st * rectSize), (rectSize * .5) - radius - 1., radius); + float smoothedAlpha = (1.0-smoothstep(0.0, 2.0, distance)) * alpha; + gl_FragColor = vec4(texture2D(textureIn, gl_TexCoord[0].st).rgb, smoothedAlpha); +} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/silentclient/shaders/roundTextured.frag b/src/main/resources/assets/minecraft/silentclient/shaders/roundTextured.frag new file mode 100644 index 0000000..e21b58f --- /dev/null +++ b/src/main/resources/assets/minecraft/silentclient/shaders/roundTextured.frag @@ -0,0 +1,15 @@ +#version 120 + +uniform vec2 rectSize; +uniform sampler2D textureIn; +uniform float radius, alpha; + +float roundedBoxSDF(vec2 centerPos, vec2 size, float radius) { + return length(max(abs(centerPos) -size, 0.)) - radius; +} + +void main() { + float distance = roundedBoxSDF((rectSize * .5) - (gl_TexCoord[0].st * rectSize), (rectSize * .5) - radius - 1., radius); + float smoothedAlpha = (1.0-smoothstep(0.0, 2.0, distance)) * alpha; + gl_FragColor = vec4(texture2D(textureIn, gl_TexCoord[0].st).rgb, smoothedAlpha); +} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/silentclient/shaders/roundedRect.frag b/src/main/resources/assets/minecraft/silentclient/shaders/roundedRect.frag new file mode 100644 index 0000000..45c7029 --- /dev/null +++ b/src/main/resources/assets/minecraft/silentclient/shaders/roundedRect.frag @@ -0,0 +1,17 @@ +#version 120 + +uniform vec2 location, rectSize; +uniform vec4 color; +uniform float radius; +uniform bool blur; + +float roundSDF(vec2 p, vec2 b, float r) { + return length(max(abs(p) - b, 0.0)) - r; +} + +void main() { + vec2 rectHalf = rectSize * .5; + float smoothedAlpha = (1.0-smoothstep(0.0, 1.0, roundSDF(rectHalf - (gl_TexCoord[0].st * rectSize), rectHalf - radius - 1., radius))) * color.a; + + gl_FragColor = vec4(color.rgb, smoothedAlpha); +} \ No newline at end of file