From 40e6a164eafcdca3ab2f17df91035fd4ef6dc44b Mon Sep 17 00:00:00 2001 From: Ukiyograin Date: Sat, 30 May 2026 11:02:21 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=E4=BA=AE=E8=89=B2=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E3=80=81=E7=BC=A9=E6=94=BE=E8=AE=BE=E7=BD=AE=E3=80=81?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=B7=B2=E7=9F=A5=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/wrapper/gradle-wrapper.properties | 5 +- gradlew.bat | 57 +++++- .../impl/interfaces/ClientSettings.java | 10 +- .../features/impl/utility/AutoGG.java | 46 +++-- .../features/impl/utility/LevelTag.java | 170 ++++++++++++++---- .../fpsmaster/forge/mixin/MixinGuiScreen.java | 3 +- .../fpsmaster/ui/click/CategoryComponent.java | 4 +- .../top/fpsmaster/ui/click/ClickGuiTheme.java | 156 ++++++++++++++++ .../top/fpsmaster/ui/click/MainPanel.java | 70 +++++++- .../ui/click/component/ScrollContainer.java | 3 +- .../ui/click/modules/ModuleRenderer.java | 15 +- .../click/modules/impl/BindSettingRender.java | 7 +- .../modules/impl/BooleanSettingRender.java | 5 +- .../modules/impl/ColorSettingRender.java | 19 +- .../click/modules/impl/ModeSettingRender.java | 15 +- .../impl/MultipleItemSettingRender.java | 23 +-- .../modules/impl/NumberSettingRender.java | 9 +- .../click/modules/impl/TextSettingRender.java | 9 +- .../utils/input/raw/RawInputMod.java | 130 ++++++++++++-- .../assets/minecraft/client/lang/en_us.lang | 8 +- .../assets/minecraft/client/lang/zh_cn.lang | 8 +- 21 files changed, 639 insertions(+), 133 deletions(-) create mode 100644 src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1136ef8b..451ec262 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,9 +1,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip -networkTimeout=10000 +distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.6-bin.zip +networkTimeout=30000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists org.gradle.jvmargs=-Xmx2G --add-opens java.base/java.io=ALL-UNNAMED - diff --git a/gradlew.bat b/gradlew.bat index 93e3f59f..2e227e0d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -33,7 +33,7 @@ set APP_HOME=%DIRNAME% @rem Resolve any "." and ".." in APP_HOME to make it shorter. for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +@rem Add default JVM options here. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe @@ -70,7 +70,10 @@ goto fail set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +@rem Download gradle-wrapper.jar if not present +if not exist "%CLASSPATH%" goto download +:run @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* @@ -90,3 +93,55 @@ exit /b %EXIT_CODE% if "%OS%"=="Windows_NT" endlocal :omega + +goto :EOF + +@rem -------------------------------------------------------------------------- +@rem Download gradle-wrapper.jar using PowerShell (bypasses SSL certificate errors) +@rem -------------------------------------------------------------------------- +:download +echo. +echo gradle-wrapper.jar not found, downloading... +echo. + +set GRADLE_VERSION=8.6 +set WRAPPER_JAR_URL=https://raw.githubusercontent.com/gradle/gradle/v%GRADLE_VERSION%/gradle/wrapper/gradle-wrapper.jar +set WRAPPER_JAR_DIR=%APP_HOME%\gradle\wrapper + +echo Attempting to download gradle-wrapper.jar... +echo. + +REM Try PowerShell with SSL callback bypass (handles certificate errors in China) +PowerShell -NoProfile -ExecutionPolicy Bypass -Command ^ + "[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true};" ^ + "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;" ^ + "try { " ^ + "$wc = New-Object System.Net.WebClient;" ^ + "$wc.DownloadFile('%WRAPPER_JAR_URL%', '%CLASSPATH%');" ^ + "Write-Host 'Downloaded gradle-wrapper.jar successfully'; " ^ + "exit 0; " ^ + "} catch { " ^ + "Write-Host 'Failed to download gradle-wrapper.jar: ' + $_.Exception.Message; " ^ + "Write-Host 'You may need to manually place gradle-wrapper.jar in %WRAPPER_JAR_DIR%'; " ^ + "exit 1; " ^ + "}" + +if %ERRORLEVEL% neq 0 ( + echo. + echo WARNING: Could not download gradle-wrapper.jar due to SSL/network issues. + echo You can manually download it from: + echo https://github.com/gradle/gradle/raw/v%GRADLE_VERSION%/gradle/wrapper/gradle-wrapper.jar + echo And place it in: %WRAPPER_JAR_DIR% + echo. + echo Alternatively, run this script again after setting JAVA_HOME properly, + echo or use a VPN/proxy if you are behind a restricted network. + goto fail +) + +if exist "%CLASSPATH%" ( + echo gradle-wrapper.jar is ready. + goto run +) else ( + echo Failed to download gradle-wrapper.jar. + goto fail +) diff --git a/src/main/java/top/fpsmaster/features/impl/interfaces/ClientSettings.java b/src/main/java/top/fpsmaster/features/impl/interfaces/ClientSettings.java index 33a34466..946723b7 100644 --- a/src/main/java/top/fpsmaster/features/impl/interfaces/ClientSettings.java +++ b/src/main/java/top/fpsmaster/features/impl/interfaces/ClientSettings.java @@ -7,8 +7,8 @@ import top.fpsmaster.event.Subscribe; import top.fpsmaster.event.events.EventValueChange; import top.fpsmaster.exception.FileException; -import top.fpsmaster.features.impl.InterfaceModule; import top.fpsmaster.features.manager.Category; +import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.BindSetting; import top.fpsmaster.features.settings.impl.BooleanSetting; import top.fpsmaster.features.settings.impl.ModeSetting; @@ -20,7 +20,7 @@ import static top.fpsmaster.utils.core.Utility.mc; -public class ClientSettings extends InterfaceModule { +public class ClientSettings extends Module { public static ModeSetting language = new ModeSetting("Language", 1, "English", "Chinese"); public static BooleanSetting blur = new BooleanSetting("blur", false); public static BindSetting keyBind = new BindSetting("ClickGuiKey", Keyboard.KEY_RSHIFT); @@ -33,8 +33,10 @@ public class ClientSettings extends InterfaceModule { 2, "0.5x", "0.75x", "1x", "1.25x", "1.5x", "2x", "2.5x", "3x" ); + public static ModeSetting theme = new ModeSetting("Theme", 0, "Dark", "Light"); public static BooleanSetting clientCommand = new BooleanSetting("Command", true); - public static final TextSetting prefix = new TextSetting("prefix", "#", () -> clientCommand.getValue()); + public static BindSetting zoomBind = new BindSetting("ZoomBind", Keyboard.KEY_LCONTROL); + public static final TextSetting prefix = new TextSetting("prefix", ".", () -> clientCommand.getValue()); public static boolean isFollowGameScaleEnabled() { return followGameScale.getValue(); @@ -68,7 +70,7 @@ public static float getUiRenderScale() { public ClientSettings() { super("ClientSettings", Category.Utility); - addSettings(language, keyBind, followGameScale, fixedScale, blur, clientCommand, prefix); + addSettings(language, keyBind, followGameScale, fixedScale, blur, theme, zoomBind, clientCommand, prefix); EventDispatcher.registerListener(this); // get system language Locale locale = Locale.getDefault(); diff --git a/src/main/java/top/fpsmaster/features/impl/utility/AutoGG.java b/src/main/java/top/fpsmaster/features/impl/utility/AutoGG.java index fe98dc75..059812a0 100644 --- a/src/main/java/top/fpsmaster/features/impl/utility/AutoGG.java +++ b/src/main/java/top/fpsmaster/features/impl/utility/AutoGG.java @@ -20,9 +20,24 @@ public class AutoGG extends Module { private final BooleanSetting autoPlay = new BooleanSetting("AutoPlay", false); private final NumberSetting delay = new NumberSetting("DelayToPlay", 5, 0, 10, 1, autoPlay::getValue); private final TextSetting message = new TextSetting("Message", "gg"); - private final ModeSetting servers = new ModeSetting("Servers", 0, "hypixel", "kkcraft"); - private final String[] hypixelTrigger = new String[]{"Reward Summary", "1st Killer", "Damage Dealt", "奖励总览", "击杀数第一名", "造成伤害"}; - private final String[] kkcraftTrigger = new String[]{"获胜者", "第一名杀手", "击杀第一名"}; + + private final ModeSetting servers = new ModeSetting("Servers", 0, "hypixel", "普通"); + + private final String[] hypixelTrigger = new String[]{ + "Reward Summary", + "1st Killer", + "Damage Dealt", + "奖励总览", + "击杀数第一名", + "造成伤害" + }; + + private final String[] normalTrigger = new String[]{ + "获胜者", + "第一名杀手", + "击杀第一名" + }; + private final MathTimer timer = new MathTimer(); public AutoGG() { @@ -36,6 +51,7 @@ public void onPacket(EventPacket event) { S02PacketChat packet = (S02PacketChat) event.packet; IChatComponent componentValue = packet.getChatComponent(); String chatMessage = componentValue.getUnformattedText(); + switch (servers.getValue()) { case 0: if (timer.delay(10000)) { @@ -47,12 +63,18 @@ public void onPacket(EventPacket event) { } } } + if (autoPlay.getValue()) { for (IChatComponent chatComponent : componentValue.getSiblings()) { ClickEvent clickEvent = chatComponent.getChatStyle().getChatClickEvent(); - if (clickEvent != null && clickEvent.getAction().equals(ClickEvent.Action.RUN_COMMAND) && clickEvent.getValue().trim().toLowerCase().startsWith("/play ")) { + + if (clickEvent != null + && clickEvent.getAction().equals(ClickEvent.Action.RUN_COMMAND) + && clickEvent.getValue().trim().toLowerCase().startsWith("/play ")) { + if (delay.getValue().doubleValue() > 0) { Utility.sendClientNotify("Sending you to the next game in " + delay.getValue().intValue() + " seconds"); + FPSMaster.async.runnable(() -> { try { Thread.sleep(delay.getValue().longValue() * 1000); @@ -68,25 +90,27 @@ public void onPacket(EventPacket event) { } } break; + case 1: if (timer.delay(10000)) { - for (String s : kkcraftTrigger) { + for (String s : normalTrigger) { if (StringUtils.stripControlCodes(chatMessage).contains(s)) { Utility.sendChatMessage(message.getValue()); timer.reset(); + if (autoPlay.getValue()) { - Utility.sendClientNotify("AutoPlay is not supported in KKCraft yet"); + Utility.sendClientNotify("AutoPlay is not supported in normal mode yet"); } + + break; } } } break; - default: + default: + break; } } } -} - - - +} \ No newline at end of file diff --git a/src/main/java/top/fpsmaster/features/impl/utility/LevelTag.java b/src/main/java/top/fpsmaster/features/impl/utility/LevelTag.java index e047f74f..5abbb38c 100644 --- a/src/main/java/top/fpsmaster/features/impl/utility/LevelTag.java +++ b/src/main/java/top/fpsmaster/features/impl/utility/LevelTag.java @@ -1,6 +1,5 @@ package top.fpsmaster.features.impl.utility; -import top.fpsmaster.features.settings.Setting; import top.fpsmaster.features.settings.impl.ColorSetting; import top.fpsmaster.utils.render.draw.Images; @@ -31,28 +30,38 @@ public class LevelTag extends Module { public LevelTag() { super("Nametags", Category.Utility); - addSettings(showSelf, health,diableBackground, backgroundColor); + addSettings(showSelf, health, diableBackground, backgroundColor); } public static void renderHealth(Entity entityIn, String str, double x, double y, double z, int maxDistance) { - if (!using) + if (!using) { return; - if(!str.contains(entityIn.getName()) || !(entityIn instanceof EntityPlayer)) + } + + if (!str.contains(entityIn.getName()) || !(entityIn instanceof EntityPlayer)) { return; - if (str.contains("[NPC]")) + } + + if (str.contains("[NPC]")) { return; + } + double d = entityIn.getDistanceSqToEntity(mc.getRenderManager().livingPlayer); + if (d < 100) { float f = 1.6F; float g = 0.016666668F * f; + GlStateManager.pushMatrix(); GlStateManager.translate((float) x + 0.0F, (float) y + entityIn.height + 0.5F, (float) z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); + + /* + * Nametag billboard rotation. + * Make the tag always face the current camera. + */ GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - if (mc.gameSettings.thirdPersonView == 2) - GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - else if (mc.gameSettings.thirdPersonView == 1) - GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-g, -g, g); GlStateManager.disableLighting(); @@ -60,8 +69,10 @@ else if (mc.gameSettings.thirdPersonView == 1) GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + GlStateManager.disableTexture2D(); GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -70,21 +81,33 @@ else if (mc.gameSettings.thirdPersonView == 1) } public static void renderName(Entity entityIn, String str, double x, double y, double z, int maxDistance) { - if ((!using || !showSelf.getValue()) && entityIn == mc.thePlayer) + if ((!using || !showSelf.getValue()) && entityIn == mc.thePlayer) { return; + } + double d = entityIn.getDistanceSqToEntity(mc.getRenderManager().livingPlayer); - if (!(d > (double)(maxDistance * maxDistance))) { + + if (!(d > (double) (maxDistance * maxDistance))) { FontRenderer fontRenderer = mc.fontRendererObj; + float f = 1.6F; float g = 0.016666668F * f; + GlStateManager.pushMatrix(); - GlStateManager.translate((float)x + 0.0F, (float)y + entityIn.height + 0.5F, (float)z); + GlStateManager.translate((float) x + 0.0F, (float) y + entityIn.height + 0.5F, (float) z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); + + /* + * 原版 1.8.9 nametag 朝向逻辑: + * + * playerViewY 控制左右方向,前面需要负号; + * playerViewX 控制上下俯仰方向,直接使用正值; + * + * 不要根据 first person / third person 分支处理, + * RenderManager.playerViewX / playerViewY 本身就应该代表当前相机方向。 + */ GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - if (mc.gameSettings.thirdPersonView == 2) - GlStateManager.rotate(-mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - else if (mc.gameSettings.thirdPersonView == 1) - GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); GlStateManager.scale(-g, -g, g); GlStateManager.disableLighting(); @@ -92,9 +115,12 @@ else if (mc.gameSettings.thirdPersonView == 1) GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + int i = 0; + if (str.equals("deadmau5")) { i = -10; } @@ -107,32 +133,108 @@ else if (mc.gameSettings.thirdPersonView == 1) j += 6; } - - - if(!diableBackground.getValue()) { + if (!diableBackground.getValue()) { GlStateManager.disableTexture2D(); + worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - worldRenderer.pos(-j - 1, -1 + i, 0.0F).color(backgroundColor.getColor().getRed() / 255f, backgroundColor.getColor().getGreen() / 255f, backgroundColor.getColor().getBlue() / 255f, backgroundColor.getColor().getAlpha() / 255f).endVertex(); - worldRenderer.pos(-j - 1, 8 + i, 0.0F).color(backgroundColor.getColor().getRed() / 255f, backgroundColor.getColor().getGreen() / 255f, backgroundColor.getColor().getBlue() / 255f, backgroundColor.getColor().getAlpha() / 255f).endVertex(); - worldRenderer.pos(j + 1, 8 + i, 0.0F).color(backgroundColor.getColor().getRed() / 255f, backgroundColor.getColor().getGreen() / 255f, backgroundColor.getColor().getBlue() / 255f, backgroundColor.getColor().getAlpha() / 255f).endVertex(); - worldRenderer.pos(j + 1, -1 + i, 0.0F).color(backgroundColor.getColor().getRed() / 255f, backgroundColor.getColor().getGreen() / 255f, backgroundColor.getColor().getBlue() / 255f, backgroundColor.getColor().getAlpha() / 255f).endVertex(); + + worldRenderer + .pos(-j - 1, -1 + i, 0.0F) + .color( + backgroundColor.getColor().getRed() / 255f, + backgroundColor.getColor().getGreen() / 255f, + backgroundColor.getColor().getBlue() / 255f, + backgroundColor.getColor().getAlpha() / 255f + ) + .endVertex(); + + worldRenderer + .pos(-j - 1, 8 + i, 0.0F) + .color( + backgroundColor.getColor().getRed() / 255f, + backgroundColor.getColor().getGreen() / 255f, + backgroundColor.getColor().getBlue() / 255f, + backgroundColor.getColor().getAlpha() / 255f + ) + .endVertex(); + + worldRenderer + .pos(j + 1, 8 + i, 0.0F) + .color( + backgroundColor.getColor().getRed() / 255f, + backgroundColor.getColor().getGreen() / 255f, + backgroundColor.getColor().getBlue() / 255f, + backgroundColor.getColor().getAlpha() / 255f + ) + .endVertex(); + + worldRenderer + .pos(j + 1, -1 + i, 0.0F) + .color( + backgroundColor.getColor().getRed() / 255f, + backgroundColor.getColor().getGreen() / 255f, + backgroundColor.getColor().getBlue() / 255f, + backgroundColor.getColor().getAlpha() / 255f + ) + .endVertex(); + tessellator.draw(); } - GL11.glColor4f(1,1,1,1); + + GL11.glColor4f(1, 1, 1, 1); GlStateManager.enableTexture2D(); + + /* + * 第一遍绘制:关闭深度时绘制暗色文字。 + */ if (isMate) { - Images.draw(new ResourceLocation("client/textures/mate.png"), -fontRenderer.getStringWidth(str) / 2f - 4f, i - 1, 8, 8, -1, true); - fontRenderer.drawString(str, -fontRenderer.getStringWidth(str) / 2 + 6, i, 553648127); - }else{ - fontRenderer.drawString(str, -fontRenderer.getStringWidth(str) / 2, i, 553648127); + Images.draw( + new ResourceLocation("client/textures/mate.png"), + -fontRenderer.getStringWidth(str) / 2f - 4f, + i - 1, + 8, + 8, + -1, + true + ); + + fontRenderer.drawString( + str, + -fontRenderer.getStringWidth(str) / 2 + 6, + i, + 553648127 + ); + } else { + fontRenderer.drawString( + str, + -fontRenderer.getStringWidth(str) / 2, + i, + 553648127 + ); } + + /* + * 第二遍绘制:开启深度后绘制正常白色文字。 + */ GlStateManager.enableDepth(); GlStateManager.depthMask(true); + if (isMate) { - fontRenderer.drawString(str, -fontRenderer.getStringWidth(str) / 2 + 6, i, -1); - }else{ - fontRenderer.drawString(str, -fontRenderer.getStringWidth(str) / 2, i, -1); + fontRenderer.drawString( + str, + -fontRenderer.getStringWidth(str) / 2 + 6, + i, + -1 + ); + } else { + fontRenderer.drawString( + str, + -fontRenderer.getStringWidth(str) / 2, + i, + -1 + ); } + GlStateManager.enableLighting(); GlStateManager.disableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); @@ -155,8 +257,4 @@ public void onDisable() { public static boolean isUsing() { return using; } -} - - - - +} \ No newline at end of file diff --git a/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java b/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java index a51299fb..75ccdafb 100644 --- a/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java +++ b/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java @@ -18,6 +18,7 @@ import top.fpsmaster.features.impl.interfaces.BetterScreen; import top.fpsmaster.utils.math.anim.AnimMath; import top.fpsmaster.utils.render.effects.Blur; +import top.fpsmaster.utils.system.OptifineUtil; import java.awt.*; import java.io.IOException; @@ -79,7 +80,7 @@ public void drawWorldBackground(int tint) { GlStateManager.enableAlpha(); GlStateManager.enableTexture2D(); } - if (BetterScreen.blur.getValue()) { + if (BetterScreen.blur.getValue() && !OptifineUtil.isFastRender()) { v1_8_9$iteration = Math.min(++v1_8_9$iteration, 3); Blur.area(0, 0, width, height, 1, new Color(255, 255, 255), v1_8_9$iteration, v1_8_9$iteration); } diff --git a/src/main/java/top/fpsmaster/ui/click/CategoryComponent.java b/src/main/java/top/fpsmaster/ui/click/CategoryComponent.java index 35659e57..f2c206f8 100644 --- a/src/main/java/top/fpsmaster/ui/click/CategoryComponent.java +++ b/src/main/java/top/fpsmaster/ui/click/CategoryComponent.java @@ -18,12 +18,12 @@ public class CategoryComponent { public CategoryComponent(Category category) { this.category = category; - animationName.set(new Color(234, 234, 234)); + animationName.set(ClickGuiTheme.categoryTextUnselected()); } public void render(float x, float y, float width, float height, float mouseX, float mouseY, boolean selected, double dt) { animationName.animateTo( - selected ? new Color(0, 0, 0) : new Color(255, 255, 255), + selected ? ClickGuiTheme.categoryTextSelected() : ClickGuiTheme.categoryTextUnselected(), 0.2f, Easings.QUAD_IN_OUT ); diff --git a/src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java b/src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java new file mode 100644 index 00000000..ad85acf7 --- /dev/null +++ b/src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java @@ -0,0 +1,156 @@ +package top.fpsmaster.ui.click; + +import top.fpsmaster.features.impl.interfaces.ClientSettings; + +import java.awt.*; + +public class ClickGuiTheme { + public static boolean isLight() { + return ClientSettings.theme.getValue() == 1; + } + + // ClickGuiTheme author:Ukiyograin + public static Color textPrimary() { + return isLight() ? new Color(30, 30, 30) : new Color(234, 234, 234); + } + + public static Color textSecondary() { + return isLight() ? new Color(100, 100, 100) : new Color(162, 162, 162); + } + + public static Color textDescription() { + return isLight() ? new Color(70, 70, 70) : new Color(162, 162, 162); + } + + public static Color textDisabled() { + return isLight() ? new Color(140, 140, 140) : new Color(156, 156, 156); + } + + public static Color categoryTextSelected() { + return isLight() ? new Color(255, 255, 255) : new Color(0, 0, 0); + } + + public static Color categoryTextUnselected() { + return isLight() ? new Color(30, 30, 30) : new Color(255, 255, 255); + } + + public static Color categoryHover() { + return isLight() ? new Color(200, 200, 200) : new Color(70, 70, 70); + } + + public static Color categoryBg() { + return isLight() ? new Color(255, 255, 255, 200) : new Color(0, 0, 0, 200); + } + + public static Color panelBg() { + return isLight() ? new Color(235, 238, 248, 180) : new Color(0, 0, 0, 0); + } + + public static Color moduleHeaderBg() { + return isLight() ? new Color(0, 0, 0, 0) : new Color(0, 0, 0, 0); + } + + public static Color categorySelection() { + return isLight() ? new Color(40, 40, 40) : new Color(255, 255, 255); + } + + public static Color settingsBg() { + return isLight() ? new Color(195, 200, 220, 160) : new Color(100, 100, 100, 60); + } + + public static Color moduleContentEnabled() { + return isLight() ? new Color(40, 80, 220) : new Color(255, 255, 255); + } + + public static Color moduleContentDisabled() { + return isLight() ? new Color(200, 200, 200) : new Color(156, 156, 156); + } + + public static Color toggleEnabled() { + return new Color(89, 101, 241); + } + + public static Color toggleDisabled() { + return isLight() ? new Color(40, 40, 40) : new Color(255, 255, 255); + } + + public static Color inputBg() { + return isLight() ? new Color(200, 200, 200, 80) : new Color(0, 0, 0, 80); + } + + public static Color sliderFill() { + return isLight() ? new Color(89, 101, 241) : new Color(255, 255, 255); + } + + public static Color modeBg() { + return isLight() ? new Color(220, 220, 220) : new Color(52, 52, 52); + } + + public static Color modeBorder() { + return isLight() ? new Color(0, 0, 0, 50) : new Color(255, 255, 255, 50); + } + + public static Color modeText() { + return isLight() ? new Color(30, 30, 30) : new Color(234, 234, 234); + } + + public static Color scrollbar() { + return isLight() ? new Color(0, 0, 0, 100) : new Color(255, 255, 255, 100); + } + + public static Color mask(int alpha) { + return new Color(0, 0, 0, alpha); + } + + public static Color pickerBg() { + return isLight() ? new Color(180, 180, 180) : new Color(39, 39, 39); + } + + public static Color hexText() { + return isLight() ? new Color(30, 30, 30) : new Color(234, 234, 234); + } + + public static Color bindBgActive() { + return isLight() ? new Color(180, 180, 180, 80) : new Color(255, 255, 255, 80); + } + + public static Color bindBgInactive() { + return isLight() ? new Color(200, 200, 200, 80) : new Color(0, 0, 0, 80); + } + + public static Color textFieldBg() { + return isLight() ? new Color(200, 200, 200) : new Color(58, 58, 58); + } + + public static Color textFieldText() { + return isLight() ? new Color(30, 30, 30) : new Color(234, 234, 234); + } + + public static Color itemBg() { + return isLight() ? new Color(180, 180, 180, 120) : new Color(50, 50, 50, 120); + } + + public static Color itemContainerBg() { + return isLight() ? new Color(160, 160, 160, 160) : new Color(80, 80, 80, 160); + } + + public static Color buttonBg() { + return isLight() ? new Color(160, 160, 160, 140) : new Color(70, 70, 70, 140); + } + + public static Color buttonHoverBg() { + return isLight() ? new Color(130, 130, 130, 140) : new Color(120, 120, 120, 140); + } + + public static Color themeBtnBg() { + return isLight() ? new Color(255, 255, 255, 180) : new Color(0, 0, 0, 150); + } + + public static Color themeBtnText() { + return isLight() ? new Color(30, 30, 30) : new Color(200, 200, 200); + } + + public static Color modeSelectBg() { + return isLight() ? new Color(40, 40, 40) : new Color(52, 52, 52); + } +} diff --git a/src/main/java/top/fpsmaster/ui/click/MainPanel.java b/src/main/java/top/fpsmaster/ui/click/MainPanel.java index 41961d1f..8af08c47 100644 --- a/src/main/java/top/fpsmaster/ui/click/MainPanel.java +++ b/src/main/java/top/fpsmaster/ui/click/MainPanel.java @@ -10,6 +10,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; +import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import top.fpsmaster.FPSMaster; @@ -24,6 +25,7 @@ import top.fpsmaster.utils.math.anim.Animator; import top.fpsmaster.utils.math.anim.BezierEasing; import top.fpsmaster.utils.math.anim.Easings; +import top.fpsmaster.features.impl.interfaces.ClientSettings; import top.fpsmaster.utils.render.gui.ScaledGuiScreen; import top.fpsmaster.utils.render.gui.Scissor; @@ -39,6 +41,7 @@ public class MainPanel extends ScaledGuiScreen { LinkedList categories = new LinkedList<>(); float modsWheel = 0f; float wheelTemp = 0f; + private boolean zoomModifierHeld = false; private final Animator scaleAnimation = new Animator(); private final Animator alphaAnimation = new Animator(); @@ -93,6 +96,7 @@ private float getCategoryStartY() { @Override public void render(int mouseX, int mouseY, float partialTicks) { + updateZoomModifierState(); //aiChatPanel.render(mouseX, mouseY, scaleFactor); x = (int) ( guiWidth - width) / 2; y = (int) (guiHeight - height) / 2; @@ -122,7 +126,7 @@ public void render(int mouseX, int mouseY, float partialTicks) { alphaAnimation.update(dt); maskAlpha.update(dt); Alpha.set(1f); - Rects.fill(0f, 0f, guiWidth, guiHeight, new Color(0, 0, 0, (int) maskAlpha.get())); + Rects.fill(0f, 0f, guiWidth, guiHeight, ClickGuiTheme.mask((int) maskAlpha.get())); Alpha.set((float) alphaAnimation.get() / 255f); GlStateManager.translate(guiWidth / 2.0, guiHeight / 2.0, 0.0); @@ -138,6 +142,12 @@ public void render(int mouseX, int mouseY, float partialTicks) { -1 ); + if (ClickGuiTheme.isLight()) { + Rects.rounded(Math.round(x + leftWidth - 8), Math.round(y - 2), + Math.round(width - leftWidth + 16), Math.round(height + 12), + 8, ClickGuiTheme.panelBg()); + } + moduleListAlpha = (float) AnimMath.base(moduleListAlpha, 255.0, 0.1f); float scale = (float) scaleAnimation.get(); @@ -199,7 +209,7 @@ public void render(int mouseX, int mouseY, float partialTicks) { Math.round(categoryAnimation), Math.round(categoryBgHeight), 10, - new Color(0, 0, 0, 200) + ClickGuiTheme.categoryBg() ); float my = categoryStartY; @@ -209,7 +219,7 @@ public void render(int mouseX, int mouseY, float partialTicks) { Math.round(categoryAnimation - 8), 22, 10, - new Color(255, 255, 255) + ClickGuiTheme.categorySelection() ); @@ -225,9 +235,9 @@ public void render(int mouseX, int mouseY, float partialTicks) { for (CategoryComponent m : categories) { if (Hover.is(x, my - 6, leftWidth - 10, 20f, mouseX, mouseY)) { - m.categorySelectionColor.animateTo(new Color(70, 70, 70), 0.15f, Easings.QUAD_OUT); + m.categorySelectionColor.animateTo(ClickGuiTheme.categoryHover(), 0.15f, Easings.QUAD_OUT); } else { - m.categorySelectionColor.animateTo(Colors.alpha(new Color(70, 70, 70), 0), 0.15f, Easings.QUAD_OUT); + m.categorySelectionColor.animateTo(Colors.alpha(ClickGuiTheme.categoryHover(), 0), 0.15f, Easings.QUAD_OUT); } m.categorySelectionColor.update(dt); @@ -250,6 +260,27 @@ public void render(int mouseX, int mouseY, float partialTicks) { my += 27f; } GL11.glDisable(GL11.GL_SCISSOR_TEST); + + // Theme toggle button (bottom-left) + float themeBtnX = x + 4 + categoryAnimation / 50f; + float themeBtnY = y + height - 18; + float themeBtnW = categoryAnimation - 8; + float themeBtnH = 14; + boolean isLightTheme = ClickGuiTheme.isLight(); + Rects.rounded(Math.round(themeBtnX), Math.round(themeBtnY), + Math.round(themeBtnW), Math.round(themeBtnH), 4, + ClickGuiTheme.themeBtnBg().getRGB()); + FPSMaster.fontManager.s14.drawString( + FPSMaster.i18n.get(isLightTheme ? "theme.light" : "theme.dark"), + themeBtnX + (themeBtnW - FPSMaster.fontManager.s14.getStringWidth( + FPSMaster.i18n.get(isLightTheme ? "theme.light" : "theme.dark"))) / 2f, + themeBtnY + 3, + ClickGuiTheme.themeBtnText().getRGB() + ); + if (consumePressInBounds(themeBtnX, themeBtnY, themeBtnW, themeBtnH) != null) { + ClientSettings.theme.setValue(isLightTheme ? 0 : 1); + } + Alpha.set(1f); handlePointerPress(); @@ -352,6 +383,35 @@ private void handlePointerPress() { } } + private void updateZoomModifierState() { + int zoomKey = ClientSettings.zoomBind.getValue(); + if (zoomKey != 0) { + zoomModifierHeld = Keyboard.isKeyDown(zoomKey); + if (!zoomModifierHeld) { + if (zoomKey == Keyboard.KEY_LCONTROL || zoomKey == Keyboard.KEY_RCONTROL) + zoomModifierHeld = Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL); + else if (zoomKey == Keyboard.KEY_LSHIFT || zoomKey == Keyboard.KEY_RSHIFT) + zoomModifierHeld = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); + else if (zoomKey == Keyboard.KEY_LMENU || zoomKey == Keyboard.KEY_RMENU) + zoomModifierHeld = Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU); + } + } else { + zoomModifierHeld = false; + } + } + + @Override + protected void mouseScrolled(int mouseX, int mouseY, int wheelDelta) { + super.mouseScrolled(mouseX, mouseY, wheelDelta); + if (zoomModifierHeld) { + if (wheelDelta > 0) { + ClientSettings.fixedScale.setValue(ClientSettings.fixedScale.getValue() + 1); + } else if (wheelDelta < 0) { + ClientSettings.fixedScale.setValue(ClientSettings.fixedScale.getValue() - 1); + } + } + } + private void requestClose() { saveConfigOnClose(); close = true; diff --git a/src/main/java/top/fpsmaster/ui/click/component/ScrollContainer.java b/src/main/java/top/fpsmaster/ui/click/component/ScrollContainer.java index 721efee8..16a9512a 100644 --- a/src/main/java/top/fpsmaster/ui/click/component/ScrollContainer.java +++ b/src/main/java/top/fpsmaster/ui/click/component/ScrollContainer.java @@ -2,6 +2,7 @@ import lombok.Getter; import lombok.Setter; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.utils.math.anim.AnimClock; import top.fpsmaster.utils.math.anim.Animator; import top.fpsmaster.utils.math.anim.Easings; @@ -66,7 +67,7 @@ public void draw(ScaledGuiScreen screen, float x, float y, float width, float he Math.round(1f + (float) scrollExpand), Math.round(trackHeight), 1, - new Color(255, 255, 255, 100).getRGB() + ClickGuiTheme.scrollbar().getRGB() ); if (Hover.is(trackX - 1, trackY, 2f + (float) scrollExpand, trackHeight, mouseX, mouseY)) { diff --git a/src/main/java/top/fpsmaster/ui/click/modules/ModuleRenderer.java b/src/main/java/top/fpsmaster/ui/click/modules/ModuleRenderer.java index 84b47006..ef16b954 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/ModuleRenderer.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/ModuleRenderer.java @@ -11,6 +11,7 @@ import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.*; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.ui.click.MainPanel; import top.fpsmaster.ui.click.modules.impl.*; import top.fpsmaster.utils.math.anim.AnimMath; @@ -34,7 +35,7 @@ public class ModuleRenderer extends ValueRender { public ModuleRenderer(Module module) { this.mod = module; - content = new ColorAnimator(module.isEnabled() ? new Color(66, 66, 66) : new Color(40, 40, 40)); + content = new ColorAnimator(module.isEnabled() ? ClickGuiTheme.moduleContentEnabled() : ClickGuiTheme.moduleContentDisabled()); module.settings.forEach(setting -> { if (setting instanceof BooleanSetting) { settingsRenderers.add(new BooleanSettingRender(module, (BooleanSetting) setting)); @@ -64,12 +65,12 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float option.update(); if (mod.isEnabled()) { - content.animateTo(new Color(255, 255, 255), 0.2f, Easings.QUAD_IN_OUT); - option.animateTo(new Color(89, 101, 241), 0.2f, Easings.QUAD_IN_OUT); + content.animateTo(ClickGuiTheme.moduleContentEnabled(), 0.2f, Easings.QUAD_IN_OUT); + option.animateTo(ClickGuiTheme.toggleEnabled(), 0.2f, Easings.QUAD_IN_OUT); optionX = (float) AnimMath.base(optionX, 10, 0.2f); } else { - content.animateTo(new Color(156, 156, 156), 0.2f, Easings.QUAD_IN_OUT); - option.animateTo(new Color(255, 255, 255), 0.2f, Easings.QUAD_IN_OUT); + content.animateTo(ClickGuiTheme.moduleContentDisabled(), 0.2f, Easings.QUAD_IN_OUT); + option.animateTo(ClickGuiTheme.toggleDisabled(), 0.2f, Easings.QUAD_IN_OUT); optionX = (float) AnimMath.base(optionX, 0, 0.2f); } @@ -89,7 +90,7 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float Math.round(width - 10), Math.round(settingHeight), 10, - new Color(100, 100, 100, 60).getRGB() + ClickGuiTheme.settingsBg().getRGB() ); // Rects.roundedBorder( @@ -146,7 +147,7 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float FPSMaster.i18n.get(mod.name.toLowerCase(Locale.getDefault()) + ".desc"), x + 40, y + 20, - new Color(162, 162, 162).getRGB() + ClickGuiTheme.textDescription().getRGB() ); float settingsHeight = 0f; diff --git a/src/main/java/top/fpsmaster/ui/click/modules/impl/BindSettingRender.java b/src/main/java/top/fpsmaster/ui/click/modules/impl/BindSettingRender.java index 68fe6cc5..9da7e1a8 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/impl/BindSettingRender.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/impl/BindSettingRender.java @@ -6,6 +6,7 @@ import org.lwjgl.input.Keyboard; import top.fpsmaster.FPSMaster; import top.fpsmaster.features.manager.Module; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.features.settings.impl.BindSetting; import top.fpsmaster.font.impl.UFontRenderer; import top.fpsmaster.ui.click.MainPanel; @@ -31,7 +32,7 @@ public BindSettingRender(Module module, BindSetting setting) { public void render(ScaledGuiScreen screen, float x, float y, float width, float height, float mouseX, float mouseY, boolean custom) { float fw = FPSMaster.fontManager.s16.drawString( FPSMaster.i18n.get((mod.name + "." + setting.name).toLowerCase(Locale.getDefault())), - x + 10, y + 2, new Color(234, 234, 234).getRGB() + x + 10, y + 2, ClickGuiTheme.textPrimary().getRGB() ); String keyName = Keyboard.getKeyName(binding.get()); UFontRenderer s16b = FPSMaster.fontManager.s16; @@ -42,11 +43,11 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float Math.round(y - 0.5f), Math.round(width1 + 1), 13, - new Color(0,0,0,80) + ClickGuiTheme.bindBgInactive().getRGB() ); } Rects.rounded(Math.round(x + 15 + fw), Math.round(y), Math.round(width1), 12, colorAnimation.getColor()); - s16b.drawString(keyName, x + 18 + fw, y + 2, new Color(234, 234, 234).getRGB()); + s16b.drawString(keyName, x + 18 + fw, y + 2, ClickGuiTheme.textPrimary().getRGB()); if (MainPanel.bindLock.equals(setting.name)) { colorAnimation.base(new Color(255,255,255,80)); } else { diff --git a/src/main/java/top/fpsmaster/ui/click/modules/impl/BooleanSettingRender.java b/src/main/java/top/fpsmaster/ui/click/modules/impl/BooleanSettingRender.java index 73a0b265..2b735e3b 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/impl/BooleanSettingRender.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/impl/BooleanSettingRender.java @@ -5,6 +5,7 @@ import top.fpsmaster.FPSMaster; import top.fpsmaster.features.manager.Module; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.features.settings.impl.BooleanSetting; import top.fpsmaster.ui.click.modules.SettingRender; import top.fpsmaster.ui.common.binding.SettingBinding; @@ -30,14 +31,14 @@ public BooleanSettingRender(Module mod, BooleanSetting setting) { public void render(ScaledGuiScreen screen, float x, float y, float width, float height, float mouseX, float mouseY, boolean custom) { box.update(); if (binding.get()) { - box.animateTo(new Color(255, 255, 255), 0.2f, Easings.QUAD_IN_OUT); + box.animateTo(ClickGuiTheme.toggleEnabled(), 0.2f, Easings.QUAD_IN_OUT); } else { box.animateTo(new Color(129, 129, 129), 0.2f, Easings.QUAD_IN_OUT); } Rects.rounded(Math.round(x + 14), Math.round(y + 3), 6, 6, 3, box.getColor().getRGB()); FPSMaster.fontManager.s16.drawString( FPSMaster.i18n.get((mod.name + "." + setting.name).toLowerCase(Locale.getDefault())), - x + 26, y + 1, new Color(162, 162, 162).getRGB() + x + 26, y + 1, ClickGuiTheme.textSecondary().getRGB() ); if (screen.consumePressInBounds(x, y, width, height) != null) { diff --git a/src/main/java/top/fpsmaster/ui/click/modules/impl/ColorSettingRender.java b/src/main/java/top/fpsmaster/ui/click/modules/impl/ColorSettingRender.java index 89237fa6..bd8ac034 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/impl/ColorSettingRender.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/impl/ColorSettingRender.java @@ -8,6 +8,7 @@ import top.fpsmaster.ui.click.modules.SettingRender; import top.fpsmaster.ui.common.binding.ColorSettingBinding; import top.fpsmaster.utils.math.anim.AnimMath; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.utils.render.draw.Gradients; import top.fpsmaster.utils.render.draw.Hover; import top.fpsmaster.utils.render.draw.Images; @@ -56,7 +57,7 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float FPSMaster.i18n.get(labelKey), x + 10, y + 3, - new Color(162, 162, 162).getRGB() + ClickGuiTheme.textSecondary().getRGB() ); float colorBoxX = x + labelW + 26; @@ -65,13 +66,13 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float CustomColor customColor = binding.get(); Color previewColor = setting.getColor(); - Rects.rounded(Math.round(colorBoxX), Math.round(y + 1), Math.round(COLOR_BOX_W), Math.round(COLOR_BOX_H), 3, new Color(39, 39, 39)); + Rects.rounded(Math.round(colorBoxX), Math.round(y + 1), Math.round(COLOR_BOX_W), Math.round(COLOR_BOX_H), 3, ClickGuiTheme.pickerBg().getRGB()); Rects.rounded(Math.round(colorBoxX + 1), Math.round(y + 2), 12, 12, 3, previewColor.getRGB()); FPSMaster.fontManager.s16.drawString( "#" + Integer.toHexString(previewColor.getRGB()).toUpperCase(Locale.getDefault()), colorBoxX + 18, y + 2, - new Color(234, 234, 234).getRGB() + ClickGuiTheme.hexText().getRGB() ); boolean showPalette = setting.getColorType() == ColorSetting.ColorType.STATIC || setting.getColorType() == ColorSetting.ColorType.WAVE; @@ -79,12 +80,12 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float expandedHeight = (float) AnimMath.base(expandedHeight, targetHeight, 0.2); if (expandedHeight > 1f) { - Rects.rounded(Math.round(modeBoxX), Math.round(y + 1), Math.round(MODE_BOX_W), Math.round(COLOR_BOX_H), 3, new Color(39, 39, 39)); + Rects.rounded(Math.round(modeBoxX), Math.round(y + 1), Math.round(MODE_BOX_W), Math.round(COLOR_BOX_H), 3, ClickGuiTheme.pickerBg().getRGB()); FPSMaster.fontManager.s16.drawCenteredString( FPSMaster.i18n.get(setting.getColorType().i18nKey), modeBoxX + MODE_BOX_W / 2f, y + 2, - new Color(214, 214, 214).getRGB() + ClickGuiTheme.modeText().getRGB() ); if (showPalette) { renderStaticOrWaveEditor(screen, x, y, mouseX, mouseY, labelW, customColor, expandedHeight); @@ -178,11 +179,11 @@ private void renderDynamicEditor(ScaledGuiScreen screen, float x, float y, float float brightY = y + 34; float sliderW = 106f; - FPSMaster.fontManager.s14.drawString("S", sliderX - 8f, satY - 1f, new Color(200, 200, 200).getRGB()); - FPSMaster.fontManager.s14.drawString("B", sliderX - 8f, brightY - 1f, new Color(200, 200, 200).getRGB()); + FPSMaster.fontManager.s14.drawString("S", sliderX - 8f, satY - 1f, ClickGuiTheme.textSecondary().getRGB()); + FPSMaster.fontManager.s14.drawString("B", sliderX - 8f, brightY - 1f, ClickGuiTheme.textSecondary().getRGB()); - Rects.rounded(Math.round(sliderX), Math.round(satY), Math.round(sliderW), 6, 3, new Color(48, 48, 48)); - Rects.rounded(Math.round(sliderX), Math.round(brightY), Math.round(sliderW), 6, 3, new Color(48, 48, 48)); + Rects.rounded(Math.round(sliderX), Math.round(satY), Math.round(sliderW), 6, 3, ClickGuiTheme.inputBg().getRGB()); + Rects.rounded(Math.round(sliderX), Math.round(brightY), Math.round(sliderW), 6, 3, ClickGuiTheme.inputBg().getRGB()); Rects.rounded(Math.round(sliderX), Math.round(satY), Math.round(sliderW * customColor.saturation), 6, 3, new Color(114, 173, 255)); Rects.rounded(Math.round(sliderX), Math.round(brightY), Math.round(sliderW * customColor.brightness), 6, 3, new Color(255, 223, 114)); diff --git a/src/main/java/top/fpsmaster/ui/click/modules/impl/ModeSettingRender.java b/src/main/java/top/fpsmaster/ui/click/modules/impl/ModeSettingRender.java index 018adbe0..ed319f54 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/impl/ModeSettingRender.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/impl/ModeSettingRender.java @@ -9,6 +9,7 @@ import top.fpsmaster.FPSMaster; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.ModeSetting; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.ui.click.modules.SettingRender; import top.fpsmaster.utils.math.anim.AnimMath; import top.fpsmaster.ui.common.binding.SettingBinding; @@ -32,7 +33,7 @@ public ModeSettingRender(Module mod, ModeSetting setting) { public void render(ScaledGuiScreen screen, float x, float y, float width, float height, float mouseX, float mouseY, boolean custom) { float fw = FPSMaster.fontManager.s16.drawString( FPSMaster.i18n.get((mod.name + "." + setting.name).toLowerCase(Locale.getDefault())), - x + 10, y + 8, new Color(162, 162, 162).getRGB() + x + 10, y + 8, ClickGuiTheme.textSecondary().getRGB() ); float maxWidth = 80f; maxWidth = Math.max(maxWidth, fw + 10); @@ -43,12 +44,12 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float Math.round(16 + expandH), 3, 0.5f, - new Color(52, 52, 52).getRGB(), - new Color(255, 255, 255, 50).getRGB() + ClickGuiTheme.modeBg().getRGB(), + ClickGuiTheme.modeBorder().getRGB() ); FPSMaster.fontManager.s18.drawString( FPSMaster.i18n.get((mod.name + "." + setting.name + "." + setting.getModeName()).toLowerCase(Locale.getDefault())), - x + 20 + fw, y + 7, new Color(234, 234, 234).getRGB() + x + 20 + fw, y + 7, ClickGuiTheme.modeText().getRGB() ); // Rotate this icon @@ -63,7 +64,7 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float y + 8, 8f, 8f, - new Color(234, 234, 234) + ClickGuiTheme.modeText() ); GL11.glPopMatrix(); if (expand) { @@ -72,12 +73,12 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float if (Hover.is(x + 20 + fw, y + 4 + i * 14, maxWidth, 16f, (int) mouseX, (int) mouseY)) { FPSMaster.fontManager.s16.drawString( FPSMaster.i18n.get((mod.name + "." + setting.name + "." + setting.getMode(i)).toLowerCase(Locale.getDefault())), - x + 20 + fw, y + 7 + i * 14, new Color(182, 182, 182).getRGB() + x + 20 + fw, y + 7 + i * 14, ClickGuiTheme.textPrimary().getRGB() ); } else { FPSMaster.fontManager.s16.drawString( FPSMaster.i18n.get((mod.name + "." + setting.name + "." + setting.getMode(i)).toLowerCase(Locale.getDefault())), - x + 20 + fw, y + 7 + i * 14, new Color(162, 162, 162).getRGB() + x + 20 + fw, y + 7 + i * 14, ClickGuiTheme.textSecondary().getRGB() ); } } diff --git a/src/main/java/top/fpsmaster/ui/click/modules/impl/MultipleItemSettingRender.java b/src/main/java/top/fpsmaster/ui/click/modules/impl/MultipleItemSettingRender.java index ac862997..c6a374d4 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/impl/MultipleItemSettingRender.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/impl/MultipleItemSettingRender.java @@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack; import top.fpsmaster.FPSMaster; import top.fpsmaster.features.manager.Module; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.features.settings.impl.MultipleItemSetting; import top.fpsmaster.ui.click.modules.SettingRender; import top.fpsmaster.ui.common.binding.MultipleItemSettingBinding; @@ -33,27 +34,27 @@ public MultipleItemSettingRender(Module module, MultipleItemSetting setting) { public void render(ScaledGuiScreen screen, float x, float y, float width, float height, float mouseX, float mouseY, boolean custom) { FPSMaster.fontManager.s16.drawString( FPSMaster.i18n.get((mod.name + "." + setting.name).toLowerCase(Locale.getDefault())), - x + xOffset, y + 1, new Color(162, 162, 162).getRGB() + x + xOffset, y + 1, ClickGuiTheme.textSecondary().getRGB() ); - Rects.rounded(Math.round(x + xOffset), Math.round(y + FPSMaster.fontManager.s16.getHeight() + 5), Math.round(itemWidth + padding), Math.round(this.height - 7), 3, new Color(80, 80, 80, 160).getRGB()); + Rects.rounded(Math.round(x + xOffset), Math.round(y + FPSMaster.fontManager.s16.getHeight() + 5), Math.round(itemWidth + padding), Math.round(this.height - 7), 3, ClickGuiTheme.itemContainerBg().getRGB()); int textWidth = FPSMaster.fontManager.s14.getStringWidth(FPSMaster.i18n.get(FPSMaster.i18n.get("ItemsSetting.heldItem".toLowerCase(Locale.getDefault())))); - FPSMaster.fontManager.s14.drawString(FPSMaster.i18n.get("ItemsSetting.heldItem".toLowerCase(Locale.getDefault())), x + xOffset + itemWidth - 30 - textWidth, y + 1, -1) ; - FPSMaster.fontManager.s22.drawString("+", x + xOffset + itemWidth - 12, y + 1, -1); + FPSMaster.fontManager.s14.drawString(FPSMaster.i18n.get("ItemsSetting.heldItem".toLowerCase(Locale.getDefault())), x + xOffset + itemWidth - 30 - textWidth, y + 1, ClickGuiTheme.textPrimary().getRGB()); + FPSMaster.fontManager.s22.drawString("+", x + xOffset + itemWidth - 12, y + 1, ClickGuiTheme.textPrimary().getRGB()); - Rects.rounded(Math.round(x + xOffset), Math.round(y + FPSMaster.fontManager.s16.getHeight() + 5), Math.round(itemWidth + padding), Math.round(this.height - 7), 3, new Color(80, 80, 80, 160).getRGB()); + Rects.rounded(Math.round(x + xOffset), Math.round(y + FPSMaster.fontManager.s16.getHeight() + 5), Math.round(itemWidth + padding), Math.round(this.height - 7), 3, ClickGuiTheme.itemContainerBg().getRGB()); int index = 0; this.itemWidth = width - (xOffset * 2); for (ItemStack itemStack : binding.get()) { - Rects.rounded(Math.round(x + xOffset + padding), Math.round(y + FPSMaster.fontManager.s16.getHeight() + 5 + padding + (index * (itemHeight + padding))), Math.round(itemWidth - padding), itemHeight, new Color(50, 50, 50, 120)); + Rects.rounded(Math.round(x + xOffset + padding), Math.round(y + FPSMaster.fontManager.s16.getHeight() + 5 + padding + (index * (itemHeight + padding))), Math.round(itemWidth - padding), itemHeight, ClickGuiTheme.itemBg()); ItemsUtil.renderItem(itemStack, x + (padding * 2) + 20f, (y + FPSMaster.fontManager.s16.getHeight() + 5 + padding * 2) + (index * (itemHeight + padding))); renderButton(x + xOffset + itemWidth - (padding * 2) - buttonSize, (y + FPSMaster.fontManager.s16.getHeight() + 5 + padding * 2) + (index * (buttonSize + (padding * 3))), mouseX,mouseY ,"-"); - FPSMaster.fontManager.s14.drawString(itemStack.getDisplayName(), x + (padding * 2) + 45f, (y + FPSMaster.fontManager.s16.getHeight() + 5 + padding * 2) + (index * (buttonSize + (padding * 3))) + 5, -1); + FPSMaster.fontManager.s14.drawString(itemStack.getDisplayName(), x + (padding * 2) + 45f, (y + FPSMaster.fontManager.s16.getHeight() + 5 + padding * 2) + (index * (buttonSize + (padding * 3))) + 5, ClickGuiTheme.textPrimary().getRGB()); index++; } if (binding.get().isEmpty()) { this.height = itemHeight + 10; - FPSMaster.fontManager.s14.drawString(FPSMaster.i18n.get("ItemsSetting.isEmpty".toLowerCase(Locale.getDefault())), x + ((itemWidth - (padding * 2)) / 2), (y + FPSMaster.fontManager.s16.getHeight() + 5 + padding * 2) + 5, -1); + FPSMaster.fontManager.s14.drawString(FPSMaster.i18n.get("ItemsSetting.isEmpty".toLowerCase(Locale.getDefault())), x + ((itemWidth - (padding * 2)) / 2), (y + FPSMaster.fontManager.s16.getHeight() + 5 + padding * 2) + 5, ClickGuiTheme.textSecondary().getRGB()); }else{ this.height = (index * (itemHeight + padding)) + 10; } @@ -79,12 +80,12 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float } public void renderButton(float x, float y, float mouseX, float mouseY, String icon) { - Color color = new Color(70, 70, 70, 140); + Color color = ClickGuiTheme.buttonBg(); if(Hover.is(x,y,buttonSize,buttonSize,(int) mouseX,(int) mouseY)){ - color = new Color(120, 120, 120, 140); + color = ClickGuiTheme.buttonHoverBg(); } Rects.rounded(Math.round(x), Math.round(y), buttonSize, buttonSize, color); - FPSMaster.fontManager.s16.drawString(icon, x + (buttonSize / 2.0f) - 2, y + (buttonSize / 2.0f) - 6, -1); + FPSMaster.fontManager.s16.drawString(icon, x + (buttonSize / 2.0f) - 2, y + (buttonSize / 2.0f) - 6, ClickGuiTheme.textPrimary().getRGB()); } } diff --git a/src/main/java/top/fpsmaster/ui/click/modules/impl/NumberSettingRender.java b/src/main/java/top/fpsmaster/ui/click/modules/impl/NumberSettingRender.java index 293b579b..008f8f5a 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/impl/NumberSettingRender.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/impl/NumberSettingRender.java @@ -5,6 +5,7 @@ import top.fpsmaster.FPSMaster; import top.fpsmaster.features.manager.Module; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.features.settings.impl.NumberSetting; import top.fpsmaster.ui.click.modules.SettingRender; import top.fpsmaster.utils.math.anim.AnimMath; @@ -34,17 +35,17 @@ public NumberSettingRender(Module mod, NumberSetting setting) { public void render(ScaledGuiScreen screen, float x, float y, float width, float height, float mouseX, float mouseY, boolean custom) { float fw = FPSMaster.fontManager.s16.drawString( FPSMaster.i18n.get((mod.name + "." + setting.name).toLowerCase(Locale.getDefault())), - x + 10, y + 2, new Color(162, 162, 162).getRGB() + x + 10, y + 2, ClickGuiTheme.textSecondary().getRGB() ); - Rects.rounded(Math.round(x + 16 + fw), Math.round(y + 3), Math.round(SLIDER_WIDTH), 6, new Color(0,0,0,80)); + Rects.rounded(Math.round(x + 16 + fw), Math.round(y + 3), Math.round(SLIDER_WIDTH), 6, ClickGuiTheme.inputBg().getRGB()); float percent = (setting.getValue().floatValue() - setting.min.floatValue()) / (setting.max.floatValue() - setting.min.floatValue()); aWidth = (float) AnimMath.base(aWidth, SLIDER_WIDTH * percent, 0.2); - Rects.rounded(Math.round(x + 16 + fw), Math.round(y + 3), Math.round(aWidth), 6, -1); + Rects.rounded(Math.round(x + 16 + fw), Math.round(y + 3), Math.round(aWidth), 6, ClickGuiTheme.sliderFill().getRGB()); FPSMaster.fontManager.s16.drawString( df.format(setting.getValue()), x + fw + 20 + SLIDER_WIDTH, y + 2, - new Color(128, 128, 128).getRGB() + ClickGuiTheme.textSecondary().getRGB() ); float labelWidth = FPSMaster.fontManager.s16.getStringWidth( diff --git a/src/main/java/top/fpsmaster/ui/click/modules/impl/TextSettingRender.java b/src/main/java/top/fpsmaster/ui/click/modules/impl/TextSettingRender.java index 3c9ceffe..a58e62e9 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/impl/TextSettingRender.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/impl/TextSettingRender.java @@ -2,6 +2,7 @@ import top.fpsmaster.FPSMaster; import top.fpsmaster.features.manager.Module; +import top.fpsmaster.ui.click.ClickGuiTheme; import top.fpsmaster.features.settings.impl.TextSetting; import top.fpsmaster.ui.click.modules.SettingRender; import top.fpsmaster.ui.common.TextField; @@ -18,7 +19,7 @@ public class TextSettingRender extends SettingRender { public TextSettingRender(Module mod, TextSetting setting) { super(setting); this.mod = mod; - TextField inputBox = new TextField(FPSMaster.fontManager.s16, false, "输入名称", -1, new Color(50, 50, 50).getRGB(), 1500); + TextField inputBox = new TextField(FPSMaster.fontManager.s16, false, "输入名称", -1, ClickGuiTheme.textFieldBg().getRGB(), 1500); inputBox.setText(setting.getValue()); input = new BoundTextFieldControl(inputBox, new SettingBinding<>(setting)); } @@ -26,10 +27,10 @@ public TextSettingRender(Module mod, TextSetting setting) { @Override public void render(ScaledGuiScreen screen, float x, float y, float width, float height, float mouseX, float mouseY, boolean custom) { TextField inputBox = input.getTextField(); - inputBox.backGroundColor = new Color(58, 58, 58).getRGB(); - inputBox.fontColor = new Color(234, 234, 234).getRGB(); + inputBox.backGroundColor = ClickGuiTheme.textFieldBg().getRGB(); + inputBox.fontColor = ClickGuiTheme.textFieldText().getRGB(); String text = FPSMaster.i18n.get((mod.name + "." + setting.name).toLowerCase(Locale.getDefault())); - FPSMaster.fontManager.s16.drawString(text, x + 18, y + 6, new Color(162, 162, 162).getRGB()); + FPSMaster.fontManager.s16.drawString(text, x + 18, y + 6, ClickGuiTheme.textSecondary().getRGB()); input.renderInScreen( screen, x + Math.max(FPSMaster.fontManager.s16.getStringWidth(inputBox.placeHolder), FPSMaster.fontManager.s16.getStringWidth(text)) + 20, diff --git a/src/main/java/top/fpsmaster/utils/input/raw/RawInputMod.java b/src/main/java/top/fpsmaster/utils/input/raw/RawInputMod.java index 8399d7a8..f635f958 100644 --- a/src/main/java/top/fpsmaster/utils/input/raw/RawInputMod.java +++ b/src/main/java/top/fpsmaster/utils/input/raw/RawInputMod.java @@ -14,17 +14,27 @@ public class RawInputMod { public static final AtomicInteger dx = new AtomicInteger(0); public static final AtomicInteger dy = new AtomicInteger(0); + private Thread inputThread; + private static ArrayList mouses = new ArrayList<>(); private static Controller[] controllers; private static boolean hasDx8 = false; + //**Periodically poll activeMouse** + //26.5.3 + private static Mouse activeMouse = null; + + private static long lastFullScanTime = 0L; + private static final long FULL_SCAN_INTERVAL = 1000L; public void start() { try { if (inputThread != null && inputThread.isAlive()) { return; } + Minecraft.getMinecraft().mouseHelper = new RawMouseHelper(); + String environment; if (checkLibrary("jinput-dx8")) { environment = "DirectInputEnvironmentPlugin"; @@ -34,35 +44,74 @@ public void start() { } else { return; } + Class aClass = Class.forName("net.java.games.input." + environment); aClass.getDeclaredConstructor().setAccessible(true); controllers = (((ControllerEnvironment) aClass.newInstance())).getControllers(); + inputThread = new Thread(() -> { try { while (!Thread.currentThread().isInterrupted()) { - if (controllers != null && mouses.isEmpty()) { - for (Controller controller : controllers) { - if (controller.getType() == Controller.Type.MOUSE) { - RawInputMod.mouses.add((Mouse) controller); - if (RawInputMod.hasDx8) break; // Thank UknownPerson for discovering the logical mouse. - } - } - } + initMouses(); + if (Minecraft.getMinecraft().currentScreen != null) { dx.set(0); dy.set(0); - for (Mouse mouse : mouses) { - mouse.poll(); + + pollActiveOrAll(false); + + try { + Thread.sleep(5L); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); } - } else { + + continue; + } + + int totalDx = 0; + int totalDy = 0; + + long now = System.currentTimeMillis(); + boolean needFullScan = activeMouse == null || now - lastFullScanTime >= FULL_SCAN_INTERVAL; + + if (needFullScan) { + lastFullScanTime = now; + for (Mouse mouse : mouses) { mouse.poll(); - dx.addAndGet((int) mouse.getX().getPollData()); - dy.addAndGet((int) mouse.getY().getPollData()); + + int mouseDx = (int) mouse.getX().getPollData(); + int mouseDy = (int) mouse.getY().getPollData(); + + if (mouseDx != 0 || mouseDy != 0) { + activeMouse = mouse; + } + + totalDx += mouseDx; + totalDy += mouseDy; + + if (hasDx8) { + break; + } } + } else { + activeMouse.poll(); + + totalDx = (int) activeMouse.getX().getPollData(); + totalDy = (int) activeMouse.getY().getPollData(); } + + if (totalDx != 0) { + dx.addAndGet(totalDx); + } + + if (totalDy != 0) { + dy.addAndGet(totalDy); + } + try { - Thread.sleep(1); + Thread.sleep(1L); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } @@ -71,6 +120,7 @@ public void start() { ClientLogger.error("Failed to start raw input"); } }); + inputThread.setName("inputThread"); inputThread.setDaemon(true); inputThread.start(); @@ -79,16 +129,63 @@ public void start() { } } + private static void initMouses() { + if (controllers != null && mouses.isEmpty()) { + for (Controller controller : controllers) { + if (controller.getType() == Controller.Type.MOUSE) { + RawInputMod.mouses.add((Mouse) controller); + + if (RawInputMod.hasDx8) { + break; + } + } + } + } + } + + private static void pollActiveOrAll(boolean readMovement) { + if (activeMouse != null) { + activeMouse.poll(); + + if (readMovement) { + activeMouse.getX().getPollData(); + activeMouse.getY().getPollData(); + } + + return; + } + + for (Mouse mouse : mouses) { + mouse.poll(); + + if (readMovement) { + mouse.getX().getPollData(); + mouse.getY().getPollData(); + } + + if (hasDx8) { + break; + } + } + } + public void stop() { try { if (inputThread != null && inputThread.isAlive()) { inputThread.interrupt(); inputThread.join(200L); } + inputThread = null; mouses = new ArrayList<>(); + controllers = null; + activeMouse = null; + lastFullScanTime = 0L; + hasDx8 = false; + dx.set(0); dy.set(0); + Minecraft.getMinecraft().mouseHelper = new MouseHelper(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); @@ -114,7 +211,4 @@ public static boolean checkLibrary(String name) { return false; } } -} - - - +} \ No newline at end of file diff --git a/src/main/resources/assets/minecraft/client/lang/en_us.lang b/src/main/resources/assets/minecraft/client/lang/en_us.lang index 8c4048c3..f17f28fd 100644 --- a/src/main/resources/assets/minecraft/client/lang/en_us.lang +++ b/src/main/resources/assets/minecraft/client/lang/en_us.lang @@ -368,8 +368,8 @@ sprint.betterfont=Clean Font autogg=AutoGG autogg.desc=Automatically send a custom message after a game has ended. autogg.servers=Servers -autogg.servers.hypxiel=Hypxiel -autogg.servers.kkcraft=KKCraft +autogg.servers.hypixel=Hypixel +autogg.servers.普通=Normal autogg.message=Custom Message autogg.autoplay=Auto Play autogg.delaytoplay=Auto Play Delay @@ -662,6 +662,10 @@ clientsettings.fixedscale.2x=2x clientsettings.fixedscale.2.5x=2.5x clientsettings.fixedscale.3x=3x clientsettings.blur=Blur UI Elements +clientsettings.theme=UI Theme +clientsettings.theme.dark=Dark +clientsettings.theme.light=Light +clientsettings.zoombind=Zoom Modifier Key clientsettings.command=Client Command clientsettings.prefix=Command Prefix clientsettings.language=Language diff --git a/src/main/resources/assets/minecraft/client/lang/zh_cn.lang b/src/main/resources/assets/minecraft/client/lang/zh_cn.lang index 50062181..02c52e31 100644 --- a/src/main/resources/assets/minecraft/client/lang/zh_cn.lang +++ b/src/main/resources/assets/minecraft/client/lang/zh_cn.lang @@ -371,8 +371,8 @@ sprint.betterfont=更好的字体 autogg=自动GG autogg.desc=游戏结束后自动地在发送你自定义的消息 autogg.servers=服务器列表 -autogg.servers.hypixel=Hypxiel -autogg.servers.kkcraft=KKCraft +autogg.servers.hypixel=Hypixel +autogg.servers.普通=普通模式 autogg.message=自定义消息 autogg.autoplay=自动重开 autogg.delaytoplay=自动重开延迟 @@ -666,6 +666,10 @@ clientsettings.fixedscale.2x=2x clientsettings.fixedscale.2.5x=2.5x clientsettings.fixedscale.3x=3x clientsettings.blur=界面组件模糊 +clientsettings.theme=界面主题 +clientsettings.theme.dark=暗色 +clientsettings.theme.light=亮色 +clientsettings.zoombind=缩放快捷键 clientsettings.command=客户端命令 clientsettings.prefix=命令前缀 clientsettings.language=客户端语言 From ff736147d1895d92121fc7c92ea8fd8aa6987760 Mon Sep 17 00:00:00 2001 From: Ukiyograin Date: Sun, 31 May 2026 11:38:26 +0800 Subject: [PATCH 2/5] fix(clickgui): improve light theme contrast --- src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java | 2 +- src/main/java/top/fpsmaster/ui/click/MainPanel.java | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java b/src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java index ad85acf7..a5f08324 100644 --- a/src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java +++ b/src/main/java/top/fpsmaster/ui/click/ClickGuiTheme.java @@ -63,7 +63,7 @@ public static Color moduleContentEnabled() { } public static Color moduleContentDisabled() { - return isLight() ? new Color(200, 200, 200) : new Color(156, 156, 156); + return isLight() ? new Color(0, 0, 0) : new Color(156, 156, 156); } public static Color toggleEnabled() { diff --git a/src/main/java/top/fpsmaster/ui/click/MainPanel.java b/src/main/java/top/fpsmaster/ui/click/MainPanel.java index 8af08c47..35fa83a0 100644 --- a/src/main/java/top/fpsmaster/ui/click/MainPanel.java +++ b/src/main/java/top/fpsmaster/ui/click/MainPanel.java @@ -142,12 +142,6 @@ public void render(int mouseX, int mouseY, float partialTicks) { -1 ); - if (ClickGuiTheme.isLight()) { - Rects.rounded(Math.round(x + leftWidth - 8), Math.round(y - 2), - Math.round(width - leftWidth + 16), Math.round(height + 12), - 8, ClickGuiTheme.panelBg()); - } - moduleListAlpha = (float) AnimMath.base(moduleListAlpha, 255.0, 0.1f); float scale = (float) scaleAnimation.get(); From 26b2afeb3a31f65141b17b0bb33f03362a4ae313 Mon Sep 17 00:00:00 2001 From: Ukiyograin Date: Sun, 31 May 2026 11:45:11 +0800 Subject: [PATCH 3/5] fix(clickgui): align light overlay with panel --- src/main/java/top/fpsmaster/ui/click/MainPanel.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/top/fpsmaster/ui/click/MainPanel.java b/src/main/java/top/fpsmaster/ui/click/MainPanel.java index 35fa83a0..fe5c11d1 100644 --- a/src/main/java/top/fpsmaster/ui/click/MainPanel.java +++ b/src/main/java/top/fpsmaster/ui/click/MainPanel.java @@ -142,6 +142,12 @@ public void render(int mouseX, int mouseY, float partialTicks) { -1 ); + if (ClickGuiTheme.isLight()) { + Rects.rounded(Math.round(x + leftWidth), Math.round(y), + Math.round(width - leftWidth), Math.round(height), + 8, ClickGuiTheme.panelBg()); + } + moduleListAlpha = (float) AnimMath.base(moduleListAlpha, 255.0, 0.1f); float scale = (float) scaleAnimation.get(); From 9f0e10514a29bc68571e4bf97f6b218ae68488e0 Mon Sep 17 00:00:00 2001 From: Ukiyograin Date: Sun, 31 May 2026 12:04:00 +0800 Subject: [PATCH 4/5] fix(clickgui): tune light theme controls --- src/main/java/top/fpsmaster/ui/click/MainPanel.java | 2 +- .../top/fpsmaster/ui/click/modules/impl/BindSettingRender.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/top/fpsmaster/ui/click/MainPanel.java b/src/main/java/top/fpsmaster/ui/click/MainPanel.java index fe5c11d1..2cc31a76 100644 --- a/src/main/java/top/fpsmaster/ui/click/MainPanel.java +++ b/src/main/java/top/fpsmaster/ui/click/MainPanel.java @@ -143,7 +143,7 @@ public void render(int mouseX, int mouseY, float partialTicks) { ); if (ClickGuiTheme.isLight()) { - Rects.rounded(Math.round(x + leftWidth), Math.round(y), + Rects.rounded(Math.round(x + leftWidth), Math.round(y + 4), Math.round(width - leftWidth), Math.round(height), 8, ClickGuiTheme.panelBg()); } diff --git a/src/main/java/top/fpsmaster/ui/click/modules/impl/BindSettingRender.java b/src/main/java/top/fpsmaster/ui/click/modules/impl/BindSettingRender.java index 9da7e1a8..627202e0 100644 --- a/src/main/java/top/fpsmaster/ui/click/modules/impl/BindSettingRender.java +++ b/src/main/java/top/fpsmaster/ui/click/modules/impl/BindSettingRender.java @@ -51,7 +51,7 @@ public void render(ScaledGuiScreen screen, float x, float y, float width, float if (MainPanel.bindLock.equals(setting.name)) { colorAnimation.base(new Color(255,255,255,80)); } else { - colorAnimation.base(new Color(0,0,0,80)); + colorAnimation.base(ClickGuiTheme.textFieldBg()); } ScaledGuiScreen.PointerEvent click = screen.consumePressInBounds(x + 25 + fw, y, 10f + s16b.getStringWidth(keyName), 12f, 0); From 2421508153681a86a05e45854fffec6e9d115375 Mon Sep 17 00:00:00 2001 From: Ukiyograin Date: Sun, 31 May 2026 12:18:38 +0800 Subject: [PATCH 5/5] fix(edge): restore successful raw input build --- .../features/impl/utility/AutoGG.java | 2 +- .../features/impl/utility/LevelTag.java | 16 ++ .../features/impl/utility/RawInput.java | 1 - .../utils/input/raw/RawInputMod.java | 257 +++++++----------- .../utils/input/raw/RawMouseHelper.java | 12 +- 5 files changed, 121 insertions(+), 167 deletions(-) diff --git a/src/main/java/top/fpsmaster/features/impl/utility/AutoGG.java b/src/main/java/top/fpsmaster/features/impl/utility/AutoGG.java index 18fc1251..059812a0 100644 --- a/src/main/java/top/fpsmaster/features/impl/utility/AutoGG.java +++ b/src/main/java/top/fpsmaster/features/impl/utility/AutoGG.java @@ -23,7 +23,6 @@ public class AutoGG extends Module { private final ModeSetting servers = new ModeSetting("Servers", 0, "hypixel", "普通"); - private final String[] hypixelTrigger = new String[]{ "Reward Summary", "1st Killer", @@ -114,3 +113,4 @@ public void onPacket(EventPacket event) { } } } +} \ No newline at end of file diff --git a/src/main/java/top/fpsmaster/features/impl/utility/LevelTag.java b/src/main/java/top/fpsmaster/features/impl/utility/LevelTag.java index 204ace3b..5abbb38c 100644 --- a/src/main/java/top/fpsmaster/features/impl/utility/LevelTag.java +++ b/src/main/java/top/fpsmaster/features/impl/utility/LevelTag.java @@ -97,6 +97,15 @@ public static void renderName(Entity entityIn, String str, double x, double y, d GlStateManager.translate((float) x + 0.0F, (float) y + entityIn.height + 0.5F, (float) z); GL11.glNormal3f(0.0F, 1.0F, 0.0F); + /* + * 原版 1.8.9 nametag 朝向逻辑: + * + * playerViewY 控制左右方向,前面需要负号; + * playerViewX 控制上下俯仰方向,直接使用正值; + * + * 不要根据 first person / third person 分支处理, + * RenderManager.playerViewX / playerViewY 本身就应该代表当前相机方向。 + */ GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); @@ -175,6 +184,9 @@ public static void renderName(Entity entityIn, String str, double x, double y, d GL11.glColor4f(1, 1, 1, 1); GlStateManager.enableTexture2D(); + /* + * 第一遍绘制:关闭深度时绘制暗色文字。 + */ if (isMate) { Images.draw( new ResourceLocation("client/textures/mate.png"), @@ -201,6 +213,9 @@ public static void renderName(Entity entityIn, String str, double x, double y, d ); } + /* + * 第二遍绘制:开启深度后绘制正常白色文字。 + */ GlStateManager.enableDepth(); GlStateManager.depthMask(true); @@ -242,3 +257,4 @@ public void onDisable() { public static boolean isUsing() { return using; } +} \ No newline at end of file diff --git a/src/main/java/top/fpsmaster/features/impl/utility/RawInput.java b/src/main/java/top/fpsmaster/features/impl/utility/RawInput.java index d7fa679d..b6a8a71f 100644 --- a/src/main/java/top/fpsmaster/features/impl/utility/RawInput.java +++ b/src/main/java/top/fpsmaster/features/impl/utility/RawInput.java @@ -13,7 +13,6 @@ public RawInput() { @Override public void onEnable() { rawInputMod.start(); - RawInputMod.setAcceptingInput(true); } @Override diff --git a/src/main/java/top/fpsmaster/utils/input/raw/RawInputMod.java b/src/main/java/top/fpsmaster/utils/input/raw/RawInputMod.java index 99577f00..f635f958 100644 --- a/src/main/java/top/fpsmaster/utils/input/raw/RawInputMod.java +++ b/src/main/java/top/fpsmaster/utils/input/raw/RawInputMod.java @@ -8,99 +8,92 @@ import top.fpsmaster.modules.logger.ClientLogger; import java.io.File; -import java.lang.reflect.Constructor; import java.util.ArrayList; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; public class RawInputMod { public static final AtomicInteger dx = new AtomicInteger(0); public static final AtomicInteger dy = new AtomicInteger(0); - private static final AtomicBoolean acceptingInput = new AtomicBoolean(false); - - private final Object lock = new Object(); - private Thread inputThread; - private final ArrayList mice = new ArrayList<>(); - private Controller[] controllers; + private static ArrayList mouses = new ArrayList<>(); + private static Controller[] controllers; + private static boolean hasDx8 = false; + //**Periodically poll activeMouse** + //26.5.3 + private static Mouse activeMouse = null; - private boolean hasDx8 = false; - private Mouse activeMouse = null; - - private long lastFullScanTime = 0L; + private static long lastFullScanTime = 0L; private static final long FULL_SCAN_INTERVAL = 1000L; public void start() { - synchronized (lock) { - try { - if (inputThread != null && inputThread.isAlive()) { - return; - } + try { + if (inputThread != null && inputThread.isAlive()) { + return; + } - String environment; - if (checkLibrary("jinput-dx8")) { - environment = "DirectInputEnvironmentPlugin"; - hasDx8 = true; - } else if (checkLibrary("jinput-raw")) { - environment = "DirectAndRawInputEnvironmentPlugin"; - hasDx8 = false; - } else { - return; - } + Minecraft.getMinecraft().mouseHelper = new RawMouseHelper(); - Class clazz = Class.forName("net.java.games.input." + environment); - Constructor constructor = clazz.getDeclaredConstructor(); - constructor.setAccessible(true); + String environment; + if (checkLibrary("jinput-dx8")) { + environment = "DirectInputEnvironmentPlugin"; + hasDx8 = true; + } else if (checkLibrary("jinput-raw")) { + environment = "DirectAndRawInputEnvironmentPlugin"; + } else { + return; + } - ControllerEnvironment controllerEnvironment = (ControllerEnvironment) constructor.newInstance(); - controllers = controllerEnvironment.getControllers(); + Class aClass = Class.forName("net.java.games.input." + environment); + aClass.getDeclaredConstructor().setAccessible(true); + controllers = (((ControllerEnvironment) aClass.newInstance())).getControllers(); - clearDeltas(); - acceptingInput.set(false); + inputThread = new Thread(() -> { + try { + while (!Thread.currentThread().isInterrupted()) { + initMouses(); - Minecraft.getMinecraft().mouseHelper = new RawMouseHelper(); + if (Minecraft.getMinecraft().currentScreen != null) { + dx.set(0); + dy.set(0); - inputThread = new Thread(this::inputLoop, "RawInputThread"); - inputThread.setDaemon(true); - inputThread.start(); - } catch (Exception e) { - ClientLogger.error("Failed to start raw input"); - } - } - } + pollActiveOrAll(false); - private void inputLoop() { - try { - while (!Thread.currentThread().isInterrupted()) { - initMice(); + try { + Thread.sleep(5L); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } - int totalDx = 0; - int totalDy = 0; + continue; + } - if (!mice.isEmpty()) { - long now = System.currentTimeMillis(); - boolean fullScan = activeMouse == null || now - lastFullScanTime >= FULL_SCAN_INTERVAL; + int totalDx = 0; + int totalDy = 0; - if (fullScan) { - lastFullScanTime = now; + long now = System.currentTimeMillis(); + boolean needFullScan = activeMouse == null || now - lastFullScanTime >= FULL_SCAN_INTERVAL; - for (Mouse mouse : mice) { - mouse.poll(); + if (needFullScan) { + lastFullScanTime = now; - int mouseDx = (int) mouse.getX().getPollData(); - int mouseDy = (int) mouse.getY().getPollData(); + for (Mouse mouse : mouses) { + mouse.poll(); - if (mouseDx != 0 || mouseDy != 0) { - activeMouse = mouse; - } + int mouseDx = (int) mouse.getX().getPollData(); + int mouseDy = (int) mouse.getY().getPollData(); - totalDx += mouseDx; - totalDy += mouseDy; + if (mouseDx != 0 || mouseDy != 0) { + activeMouse = mouse; + } - if (hasDx8) { - break; + totalDx += mouseDx; + totalDy += mouseDy; + + if (hasDx8) { + break; + } } } else { activeMouse.poll(); @@ -108,49 +101,31 @@ private void inputLoop() { totalDx = (int) activeMouse.getX().getPollData(); totalDy = (int) activeMouse.getY().getPollData(); } - } else { - activeMouse.poll(); - totalDx = (int) activeMouse.getX().getPollData(); - totalDy = (int) activeMouse.getY().getPollData(); - } - } + if (totalDx != 0) { + dx.addAndGet(totalDx); + } - if (acceptingInput.get() && shouldAcceptGameInput()) { - if (totalDx != 0) { - dx.addAndGet(totalDx); - } + if (totalDy != 0) { + dy.addAndGet(totalDy); + } - if (totalDy != 0) { - dy.addAndGet(totalDy); + try { + Thread.sleep(1L); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } } - - Thread.sleep(1L); - } else { - clearDeltas(); - Thread.sleep(5L); + } catch (Exception e) { + ClientLogger.error("Failed to start raw input"); } - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (Exception e) { - ClientLogger.error("Failed to poll raw input"); - } - } + }); - private void initMice() { - if (controllers == null || !mice.isEmpty()) { - return; - } - - for (Controller controller : controllers) { - if (controller.getType() == Controller.Type.MOUSE) { - mice.add((Mouse) controller); - - if (hasDx8) { - break; - } - } + inputThread.setName("inputThread"); + inputThread.setDaemon(true); + inputThread.start(); + } catch (Exception e) { + ClientLogger.error("Failed to start raw input"); } } @@ -195,74 +170,42 @@ private static void pollActiveOrAll(boolean readMovement) { } public void stop() { - synchronized (lock) { - try { - if (inputThread != null && inputThread.isAlive()) { - inputThread.interrupt(); - - if (Thread.currentThread() != inputThread) { - inputThread.join(200L); - } - } - - inputThread = null; - - mice.clear(); - controllers = null; - activeMouse = null; - lastFullScanTime = 0L; - hasDx8 = false; - - acceptingInput.set(false); - clearDeltas(); - - Minecraft.getMinecraft().mouseHelper = new MouseHelper(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (Exception e) { - ClientLogger.error("Failed to stop raw input"); + try { + if (inputThread != null && inputThread.isAlive()) { + inputThread.interrupt(); + inputThread.join(200L); } - } - } - public static void setAcceptingInput(boolean value) { - acceptingInput.set(value); + inputThread = null; + mouses = new ArrayList<>(); + controllers = null; + activeMouse = null; + lastFullScanTime = 0L; + hasDx8 = false; - if (!value) { - clearDeltas(); - } - } + dx.set(0); + dy.set(0); - public static boolean shouldAcceptGameInput() { - try { - Minecraft mc = Minecraft.getMinecraft(); - return mc != null && mc.currentScreen == null && mc.inGameHasFocus; + Minecraft.getMinecraft().mouseHelper = new MouseHelper(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); } catch (Exception e) { - return false; + ClientLogger.error("Failed to stop raw input"); } } - public static void clearDeltas() { - dx.set(0); - dy.set(0); - } - public static boolean checkLibrary(String name) { try { String path = System.getProperty("java.library.path"); - if (path == null) { - return false; - } - - String mapped = System.mapLibraryName(name); - String[] paths = path.split(File.pathSeparator); - - for (String libPath : paths) { - if (new File(libPath, mapped).exists()) { - return true; + if (path != null) { + String mapped = System.mapLibraryName(name); + String[] paths = path.split(File.pathSeparator); + for (String libPath : paths) { + if (new File(libPath, mapped).exists()) { + return true; + } } } - return false; } catch (Exception e) { return false; diff --git a/src/main/java/top/fpsmaster/utils/input/raw/RawMouseHelper.java b/src/main/java/top/fpsmaster/utils/input/raw/RawMouseHelper.java index 800e7882..df66b1fe 100644 --- a/src/main/java/top/fpsmaster/utils/input/raw/RawMouseHelper.java +++ b/src/main/java/top/fpsmaster/utils/input/raw/RawMouseHelper.java @@ -6,14 +6,10 @@ public class RawMouseHelper extends MouseHelper { @Override public void mouseXYChange() { - if (!RawInputMod.shouldAcceptGameInput()) { - RawInputMod.clearDeltas(); - deltaX = 0; - deltaY = 0; - return; - } - deltaX = RawInputMod.dx.getAndSet(0); deltaY = -RawInputMod.dy.getAndSet(0); } -} \ No newline at end of file +} + + +