diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1b0523..76d177f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,3 +1,8 @@ +# Automatically build the project and run any configured tests for every push +# and submitted pull request. This can help catch issues that only occur on +# certain platforms or Java versions, and provides a first line of defence +# against bad commits. + name: build on: [pull_request, push] @@ -5,11 +10,12 @@ jobs: build: strategy: matrix: + # Use these Java versions java: [ - 21, # java version used since 1.20.5 + 17, # Current Java LTS & minimum supported by Minecraft ] - # only linux - os: [ubuntu-latest] + # and run on both Linux and Windows + os: [ubuntu-22.04] runs-on: ${{ matrix.os }} steps: - name: checkout repository @@ -22,10 +28,12 @@ jobs: java-version: ${{ matrix.java }} distribution: 'microsoft' - name: make gradle wrapper executable + if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - name: build run: ./gradlew build - name: capture build artifacts + if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS uses: actions/upload-artifact@v3 with: name: Artifacts diff --git a/README.md b/README.md index 1ad91ae..174614e 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # Moonlight Meadows Utility Mod for Modern versions of Minecraft -Requires Fabric, Fabric API, and Minecraft 1.21 +Requires Fabric API and Minecraft 1.20.2 Default ClickGUI Key is Right Alt. -Grab the latest release build [here](https://github.com/kawaiizenbo/MoonlightMeadows/releases) -Grab the latest nightly build [here](https://nightly.link/kawaiizenbo/MoonlightMeadows/workflows/build/main/Artifacts.zip) +~~Grab the latest release build [here](https://github.com/kawaiizenbo/MoonlightMeadows/releases)~~ These will be available soon. +Grab the latest nightly build [here](https://nightly.link/kawaiizenbo/MoonlightMeadows/workflows/build/main/Artifacts.zip) ## Screenshots ![Title Screen](./readme-assets/title.png) @@ -19,6 +19,5 @@ Grab the latest nightly build [here](https://nightly.link/kawaiizenbo/MoonlightM ## Disclaimer -Please use this mod at your own risk, we are not responsible for any serious injury or death caused by this mod. -Do not use while operating heavy machinery. +Please use this mod at your own risk, we are not responsible for any injury or death caused by this mod. This project is not affiliated with Mojang or Microsoft. diff --git a/build.gradle b/build.gradle index 87ccbb0..ef0decd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,10 @@ plugins { - id 'fabric-loom' version '1.8-SNAPSHOT' + id 'fabric-loom' version '1.0-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_21 -targetCompatibility = JavaVersion.VERSION_21 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name version = project.mod_version @@ -46,8 +46,8 @@ processResources { } tasks.withType(JavaCompile).configureEach { - // Minecraft 1.20.5 (24w14a) upwards uses Java 21. - it.options.release = 21 + // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. + it.options.release = 17 } java { diff --git a/gradle.properties b/gradle.properties index c91a95b..ba817f4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,14 +4,14 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.21.4 - yarn_mappings=1.21.4+build.8 - loader_version=0.16.10 + minecraft_version=1.20.2 + yarn_mappings=1.20.2+build.4 + loader_version=0.14.22 # Mod Properties - mod_version = 0.4.0 + mod_version = 0.1.0 maven_group = me.kawaiizenbo archives_base_name = moonlight # Dependencies - fabric_version=0.115.0+1.21.4 + fabric_version=0.90.0+1.20.2 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d64cd49..943f0cb 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9355b41..f398c33 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip networkTimeout=10000 -validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1aa94a4..65dcd68 100755 --- a/gradlew +++ b/gradlew @@ -83,8 +83,10 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -131,13 +133,10 @@ location of your Java installation." fi else JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." - fi fi # Increase the maximum file descriptors if we can. @@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC2039,SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -198,15 +197,11 @@ if "$cygwin" || "$msys" ; then done fi - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command: -# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, -# and any embedded shellness will be escaped. -# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be -# treated as '${Hostname}' itself on the command line. +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/readme-assets/clickgui-old.png b/readme-assets/clickgui-old.png deleted file mode 100644 index d377230..0000000 Binary files a/readme-assets/clickgui-old.png and /dev/null differ diff --git a/readme-assets/clickgui.png b/readme-assets/clickgui.png index beb240e..d377230 100644 Binary files a/readme-assets/clickgui.png and b/readme-assets/clickgui.png differ diff --git a/readme-assets/ingame-old.png b/readme-assets/ingame-old.png deleted file mode 100644 index a54558b..0000000 Binary files a/readme-assets/ingame-old.png and /dev/null differ diff --git a/readme-assets/ingame.png b/readme-assets/ingame.png index e752937..a54558b 100644 Binary files a/readme-assets/ingame.png and b/readme-assets/ingame.png differ diff --git a/readme-assets/title-old.png b/readme-assets/title-old.png deleted file mode 100644 index 80a29bc..0000000 Binary files a/readme-assets/title-old.png and /dev/null differ diff --git a/readme-assets/title.png b/readme-assets/title.png index b77ff6d..80a29bc 100644 Binary files a/readme-assets/title.png and b/readme-assets/title.png differ diff --git a/src/main/java/me/kawaiizenbo/moonlight/Config.java b/src/main/java/me/kawaiizenbo/moonlight/Config.java index f2356cd..5c91a44 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/Config.java +++ b/src/main/java/me/kawaiizenbo/moonlight/Config.java @@ -14,13 +14,10 @@ import me.kawaiizenbo.moonlight.module.ModuleManager; import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.settings.BooleanSetting; import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; -import me.kawaiizenbo.moonlight.module.settings.IndexSetting; import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting; import me.kawaiizenbo.moonlight.module.settings.Setting; import me.kawaiizenbo.moonlight.module.settings.StringSetting; import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager; import net.minecraft.client.MinecraftClient; public class Config @@ -44,7 +41,6 @@ public class Config public void loadDefaultConfig() { ModuleManager.INSTANCE = new ModuleManager(); - config.put("theme", 2); Map mi = new HashMap<>(); for (Module m : ModuleManager.INSTANCE.modules) { @@ -53,6 +49,7 @@ public class Config Map ms = new HashMap<>(); for (Setting s : m.settings) { + // sometimes i wish i were a nymphet instead of a massive nerd if (s instanceof BooleanSetting) { ms.put(s.name, ((BooleanSetting)s).value); @@ -61,60 +58,19 @@ public class Config { ms.put(s.name, ((DoubleSetting)s).value); } - else if (s instanceof StringSetting) + if (s instanceof StringSetting) { ms.put(s.name, ((StringSetting)s).value); } else if (s instanceof KeycodeSetting) { ms.put(s.name, ((KeycodeSetting)s).value); - } - else if (s instanceof IndexSetting) - { - ms.put(s.name, ((IndexSetting)s).index); } } mo.put("settings", ms); mi.put(m.name, mo); } config.put("modules", mi); - - HUDModuleManager.INSTANCE = new HUDModuleManager(); - Map hi = new HashMap<>(); - for (HUDModule h : HUDModuleManager.INSTANCE.modules) - { - Map ho = new HashMap<>(); - ho.put("enabled", h.enabled); - Map hs = new HashMap<>(); - for (Setting s : h.settings) - { - if (s instanceof BooleanSetting) - { - hs.put(s.name, ((BooleanSetting)s).value); - } - else if (s instanceof DoubleSetting) - { - hs.put(s.name, ((DoubleSetting)s).value); - } - else if (s instanceof StringSetting) - { - hs.put(s.name, ((StringSetting)s).value); - } - else if (s instanceof KeycodeSetting) - { - hs.put(s.name, ((KeycodeSetting)s).value); - } - else if (s instanceof IndexSetting) - { - hs.put(s.name, ((IndexSetting)s).index); - } - } - ho.put("settings", hs); - ho.put("x", h.x); - ho.put("y", h.y); - hi.put(h.name, ho); - } - config.put("hud", hi); int xOffset = 4; int yOffset = 4; Map pi = new HashMap<>(); @@ -136,8 +92,7 @@ public class Config ClickGUIScreen.INSTANCE = new ClickGUIScreen(); } - @SuppressWarnings("unchecked") - public void load() throws IOException + public void load() throws IOException { try { diff --git a/src/main/java/me/kawaiizenbo/moonlight/Moonlight.java b/src/main/java/me/kawaiizenbo/moonlight/Moonlight.java index dfe4324..e2615e9 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/Moonlight.java +++ b/src/main/java/me/kawaiizenbo/moonlight/Moonlight.java @@ -12,15 +12,11 @@ import me.kawaiizenbo.moonlight.module.ModuleManager; import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.settings.BooleanSetting; import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; -import me.kawaiizenbo.moonlight.module.settings.IndexSetting; import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting; import me.kawaiizenbo.moonlight.module.settings.Setting; import me.kawaiizenbo.moonlight.module.settings.StringSetting; -import me.kawaiizenbo.moonlight.theme.Theme; import me.kawaiizenbo.moonlight.ui.clickgui.CategoryPane; import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager; import me.kawaiizenbo.moonlight.util.ColorUtils; public class Moonlight implements ModInitializer @@ -28,10 +24,10 @@ public class Moonlight implements ModInitializer public static final Moonlight INSTANCE = new Moonlight(); public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight"); public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows"; - public static final String versionTag = ColorUtils.magenta + "v0.4.0"; - public static Theme THEME = Theme.DARK; - public static int THEME_IDX = 2; + public static final String versionTag = ColorUtils.magenta + "v0.1.0"; public static Config CONFIG = new Config(); + public static int uiColorA = 0xFF55FFFF; + public static int uiColor = 0x55FFFF; @Override public void onInitialize() @@ -40,15 +36,12 @@ public class Moonlight implements ModInitializer loadConfig(); } - @SuppressWarnings("unchecked") public void loadConfig() { try { LOGGER.info("Loading config..."); CONFIG.load(); - THEME_IDX = ((Double)CONFIG.config.get("theme")).intValue(); - THEME = Theme.THEME_LIST[THEME_IDX]; for (Module m : ModuleManager.INSTANCE.modules) { m.enabled = (boolean)((Map)((Map)CONFIG.config.get("modules")).get(m.name)).get("enabled"); @@ -69,39 +62,6 @@ public class Moonlight implements ModInitializer else if (s instanceof KeycodeSetting) { ((KeycodeSetting)s).value = ((Double)((Map)((Map)((Map)CONFIG.config.get("modules")).get(m.name)).get("settings")).get(s.name)).intValue(); - } - else if (s instanceof IndexSetting) - { - ((IndexSetting)s).index = ((Double)((Map)((Map)((Map)CONFIG.config.get("modules")).get(m.name)).get("settings")).get(s.name)).intValue(); - } - } - } - for (HUDModule m : HUDModuleManager.INSTANCE.modules) - { - m.enabled = (boolean)((Map)((Map)CONFIG.config.get("hud")).get(m.name)).get("enabled"); - m.x = ((Double)((Map)((Map)CONFIG.config.get("hud")).get(m.name)).get("x")).intValue(); - m.y = ((Double)((Map)((Map)CONFIG.config.get("hud")).get(m.name)).get("y")).intValue(); - for (Setting s : m.settings) - { - if (s instanceof BooleanSetting) - { - ((BooleanSetting)s).value = (boolean)((Map)((Map)((Map)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name); - } - else if (s instanceof DoubleSetting) - { - ((DoubleSetting)s).value = (Double)((Map)((Map)((Map)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name); - } - else if (s instanceof StringSetting) - { - ((StringSetting)s).value = (String)((Map)((Map)((Map)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name); - } - else if (s instanceof KeycodeSetting) - { - ((KeycodeSetting)s).value = ((Double)((Map)((Map)((Map)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name)).intValue(); - } - else if (s instanceof IndexSetting) - { - ((IndexSetting)s).index = ((Double)((Map)((Map)((Map)CONFIG.config.get("hud")).get(m.name)).get("settings")).get(s.name)).intValue(); } } } @@ -118,7 +78,6 @@ public class Moonlight implements ModInitializer public void saveConfig() { LOGGER.info("Saving config..."); - CONFIG.config.put("theme", THEME_IDX); Map mi = new HashMap<>(); for (Module m : ModuleManager.INSTANCE.modules) { @@ -135,60 +94,19 @@ public class Moonlight implements ModInitializer { ms.put(s.name, ((DoubleSetting)s).value); } - else if (s instanceof StringSetting) + if (s instanceof StringSetting) { ms.put(s.name, ((StringSetting)s).value); } else if (s instanceof KeycodeSetting) { ms.put(s.name, ((KeycodeSetting)s).value); - } - else if (s instanceof IndexSetting) - { - ms.put(s.name, ((IndexSetting)s).index); } } mo.put("settings", ms); mi.put(m.name, mo); } CONFIG.config.put("modules", mi); - - Map hi = new HashMap<>(); - for (HUDModule h : HUDModuleManager.INSTANCE.modules) - { - Map ho = new HashMap<>(); - ho.put("enabled", h.enabled); - Map hs = new HashMap<>(); - for (Setting s : h.settings) - { - if (s instanceof BooleanSetting) - { - hs.put(s.name, ((BooleanSetting)s).value); - } - else if (s instanceof DoubleSetting) - { - hs.put(s.name, ((DoubleSetting)s).value); - } - else if (s instanceof StringSetting) - { - hs.put(s.name, ((StringSetting)s).value); - } - else if (s instanceof KeycodeSetting) - { - hs.put(s.name, ((KeycodeSetting)s).value); - } - else if (s instanceof IndexSetting) - { - hs.put(s.name, ((IndexSetting)s).index); - } - } - ho.put("settings", hs); - ho.put("x", h.x); - ho.put("y", h.y); - hi.put(h.name, ho); - } - CONFIG.config.put("hud", hi); - Map pi = new HashMap<>(); for (CategoryPane c : ClickGUIScreen.INSTANCE.categoryPanes) { diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/CommandManager.java b/src/main/java/me/kawaiizenbo/moonlight/command/CommandManager.java index a790653..8713ec2 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/command/CommandManager.java +++ b/src/main/java/me/kawaiizenbo/moonlight/command/CommandManager.java @@ -29,8 +29,7 @@ public class CommandManager add(new Help()); add(new Toggle()); add(new Teleport()); - add(new Reset()); - add(new DeathPos()); + add(new SettingCommand()); commands.sort(Comparator.comparing(Command::getName)); } diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java b/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java deleted file mode 100644 index 4b20903..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java +++ /dev/null @@ -1,43 +0,0 @@ -package me.kawaiizenbo.moonlight.command.commands; - -import com.mojang.brigadier.builder.LiteralArgumentBuilder; - -import me.kawaiizenbo.moonlight.command.Command; -import me.kawaiizenbo.moonlight.util.ChatUtils; -import me.kawaiizenbo.moonlight.util.ColorUtils; -import net.minecraft.command.CommandSource; -import net.minecraft.util.math.GlobalPos; - -public class DeathPos extends Command -{ - public DeathPos() - { - super("deathpos", "Shows your last death position."); - } - - @Override - public void build(LiteralArgumentBuilder builder) - { - builder.executes(context -> - { - GlobalPos pos = null; - try - { - pos = mc.player.getLastDeathPos().get(); - if (pos == null) throw new Exception(); - } - catch (Exception e) - { - ChatUtils.sendMsg(ColorUtils.reset + "You have not died in this world."); - return SINGLE_SUCCESS; - } - - ChatUtils.sendMsg(ColorUtils.reset + "You last died at: " + - ColorUtils.aqua + " X: " + ColorUtils.gray + pos.pos().getX() + - ColorUtils.aqua + " Y: " + ColorUtils.gray + pos.pos().getY() + - ColorUtils.aqua + " Z: " + ColorUtils.gray + pos.pos().getZ() - ); - return SINGLE_SUCCESS; - }); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/commands/Help.java b/src/main/java/me/kawaiizenbo/moonlight/command/commands/Help.java index c1601fa..d4ccae3 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/command/commands/Help.java +++ b/src/main/java/me/kawaiizenbo/moonlight/command/commands/Help.java @@ -14,19 +14,19 @@ public class Help extends Command { super("help", "Gives you a list of all of the commands"); } - + @Override public void build(LiteralArgumentBuilder builder) { builder.executes(context -> { - for (Command cmd : CommandManager.get().getAll()) - { + for (Command cmd : CommandManager.get().getAll()) { ChatUtils.sendMsg(ColorUtils.aqua + "Command: " + ColorUtils.gray + cmd.getName()); ChatUtils.sendMsg(ColorUtils.gray + cmd.getDescription()); - ChatUtils.sendMsg(ColorUtils.gray + ""); } return SINGLE_SUCCESS; - }); + }); + } + } diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/commands/SettingCommand.java b/src/main/java/me/kawaiizenbo/moonlight/command/commands/SettingCommand.java new file mode 100644 index 0000000..9d2d033 --- /dev/null +++ b/src/main/java/me/kawaiizenbo/moonlight/command/commands/SettingCommand.java @@ -0,0 +1,115 @@ +package me.kawaiizenbo.moonlight.command.commands; + +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; + +import me.kawaiizenbo.moonlight.command.Command; +import me.kawaiizenbo.moonlight.module.ModuleManager; +import me.kawaiizenbo.moonlight.module.settings.BooleanSetting; +import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; +import me.kawaiizenbo.moonlight.module.settings.KeycodeSetting; +import me.kawaiizenbo.moonlight.module.settings.Setting; +import me.kawaiizenbo.moonlight.module.settings.StringSetting; +import me.kawaiizenbo.moonlight.util.ChatUtils; +import me.kawaiizenbo.moonlight.util.ColorUtils; +import me.kawaiizenbo.moonlight.module.Module; +import net.minecraft.command.CommandSource; + +public class SettingCommand extends Command +{ + public SettingCommand() + { + super("setting", "Change a setting of a module."); + } + + @Override + public void build(LiteralArgumentBuilder builder) + { + builder + .then(argument("module", StringArgumentType.string()) + .then(argument("setting", StringArgumentType.string()) + .then(argument("value", StringArgumentType.string()) + .executes(context -> + { + String m = context.getArgument("module", String.class); + String s = context.getArgument("setting", String.class); + String v = context.getArgument("value", String.class); + + Module module = ModuleManager.INSTANCE.getModuleByName(m); + if (module == null) + { + ChatUtils.sendMsg(ColorUtils.red + "Invalid Module Name"); + return 0; + } + Setting setting = module.getSettingByName(s); + if (setting == null) + { + ChatUtils.sendMsg(ColorUtils.red + "Invalid Setting Name"); + return 0; + } + + if (setting instanceof BooleanSetting) + { + try + { + ((BooleanSetting)setting).value = Boolean.parseBoolean(v); + } + catch (Exception e) + { + ChatUtils.sendMsg(ColorUtils.red + "Invalid Value, expected boolean"); + return 0; + } + + } + else if (setting instanceof DoubleSetting) + { + try + { + ((DoubleSetting)setting).value = Double.parseDouble(v); + } + catch (Exception e) + { + ChatUtils.sendMsg(ColorUtils.red + "Invalid Value, expected Double"); + return 0; + } + } + else if (setting instanceof StringSetting) + { + try + { + ((StringSetting)setting).value = v; + } + catch (Exception e) + { + ChatUtils.sendMsg(ColorUtils.red + "Invalid Value, expected String"); + return 0; + } + } + else if (setting instanceof KeycodeSetting) + { + try + { + int kv = Integer.parseInt(v); + if (kv > 348) + { + ChatUtils.sendMsg(ColorUtils.red + "Keycode Value is too high, maximum is 348 (Menu)"); + return 0; + } + if (kv < 0) + { + ChatUtils.sendMsg(ColorUtils.red + "Keycode Value must be positive"); + return 0; + } + ((KeycodeSetting)setting).value = kv; + } + catch (Exception e) + { + ChatUtils.sendMsg(ColorUtils.red + "Invalid Value, expected Keycode (integer)"); + return 0; + } + } + + return SINGLE_SUCCESS; + })))); + } +} diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/commands/Toggle.java b/src/main/java/me/kawaiizenbo/moonlight/command/commands/Toggle.java index 7153f76..a63f810 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/command/commands/Toggle.java +++ b/src/main/java/me/kawaiizenbo/moonlight/command/commands/Toggle.java @@ -6,7 +6,6 @@ import com.mojang.brigadier.builder.LiteralArgumentBuilder; import me.kawaiizenbo.moonlight.command.Command; import me.kawaiizenbo.moonlight.module.ModuleManager; import me.kawaiizenbo.moonlight.module.Module; -import net.minecraft.client.MinecraftClient; import net.minecraft.command.CommandSource; public class Toggle extends Command @@ -14,7 +13,7 @@ public class Toggle extends Command public Toggle() { - super("toggle", "Toggle a module on or off."); + super("toggle", "Toggle a module."); } @Override @@ -25,7 +24,7 @@ public class Toggle extends Command { String m = context.getArgument("module", String.class); Module module = ModuleManager.INSTANCE.getModuleByName(m); - MinecraftClient.getInstance().send(() -> module.toggle()); + module.toggle(); return SINGLE_SUCCESS; })); diff --git a/src/main/java/me/kawaiizenbo/moonlight/mixin/ClientPlayerEntityMixin.java b/src/main/java/me/kawaiizenbo/moonlight/mixin/ClientPlayerEntityMixin.java index a87e8c7..e4dc2a9 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/mixin/ClientPlayerEntityMixin.java +++ b/src/main/java/me/kawaiizenbo/moonlight/mixin/ClientPlayerEntityMixin.java @@ -24,8 +24,7 @@ public class ClientPlayerEntityMixin } } - @SuppressWarnings("resource") - @Inject(method = "tick", at = @At(value = "HEAD"), cancellable = true) + @Inject(method = "tick", at = @At(value = "HEAD"), cancellable = true) public void onTick(CallbackInfo ci) { for (Module m : ModuleManager.INSTANCE.getEnabledModules()) diff --git a/src/main/java/me/kawaiizenbo/moonlight/mixin/InGameHudMixin.java b/src/main/java/me/kawaiizenbo/moonlight/mixin/InGameHudMixin.java index 84c006f..44adfd1 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/mixin/InGameHudMixin.java +++ b/src/main/java/me/kawaiizenbo/moonlight/mixin/InGameHudMixin.java @@ -1,32 +1,28 @@ package me.kawaiizenbo.moonlight.mixin; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import me.kawaiizenbo.moonlight.module.ModuleManager; -import me.kawaiizenbo.moonlight.module.modules.HUDEnabler; -import me.kawaiizenbo.moonlight.ui.LegacyHUD; +import me.kawaiizenbo.moonlight.ui.HUDOverlay; import me.kawaiizenbo.moonlight.ui.ModulesListOverlay; -import me.kawaiizenbo.moonlight.ui.hud.HUDRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; -import net.minecraft.client.render.RenderTickCounter; @Mixin(InGameHud.class) public class InGameHudMixin { + + @Shadow private int scaledWidth; + @Shadow private int scaledHeight; @Inject(at = @At("TAIL"), method = "render") - public void onRender (DrawContext drawContext, RenderTickCounter tickCounter, CallbackInfo info) + public void onRender (DrawContext drawContext, float tickDelta, CallbackInfo info) { - HUDEnabler hudModule = (HUDEnabler)ModuleManager.INSTANCE.getModuleByName("HUD"); - if (hudModule.enabled) - { - if (hudModule.mode.index == 1) LegacyHUD.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight()); - else HUDRenderer.INSTANCE.render(drawContext); - } - if (ModuleManager.INSTANCE.getModuleByName("ModulesList").enabled) ModulesListOverlay.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight()); + if (ModuleManager.INSTANCE.getModuleByName("HUD").enabled) HUDOverlay.INSTANCE.render(drawContext, scaledWidth, scaledHeight); + if (ModuleManager.INSTANCE.getModuleByName("ModulesList").enabled) ModulesListOverlay.INSTANCE.render(drawContext, scaledWidth, scaledHeight); } } diff --git a/src/main/java/me/kawaiizenbo/moonlight/mixin/KeyboardMixin.java b/src/main/java/me/kawaiizenbo/moonlight/mixin/KeyboardMixin.java index 079b1f5..647fe00 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/mixin/KeyboardMixin.java +++ b/src/main/java/me/kawaiizenbo/moonlight/mixin/KeyboardMixin.java @@ -25,7 +25,7 @@ public abstract class KeyboardMixin if (key == GLFW.GLFW_KEY_RIGHT_ALT) MinecraftClient.getInstance().setScreen(ClickGUIScreen.INSTANCE); for (Module m : ModuleManager.INSTANCE.modules) { - if (key == m.keybind.value && action == GLFW.GLFW_PRESS && MinecraftClient.getInstance().currentScreen == null) + if (key == m.keybind.value && action == GLFW.GLFW_PRESS) { m.toggle(); } diff --git a/src/main/java/me/kawaiizenbo/moonlight/mixin/PowderSnowBlockMixin.java b/src/main/java/me/kawaiizenbo/moonlight/mixin/PowderSnowBlockMixin.java deleted file mode 100644 index cf45529..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/mixin/PowderSnowBlockMixin.java +++ /dev/null @@ -1,21 +0,0 @@ -package me.kawaiizenbo.moonlight.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; - -import me.kawaiizenbo.moonlight.module.ModuleManager; -import net.minecraft.block.PowderSnowBlock; -import net.minecraft.entity.Entity; - -@Mixin(PowderSnowBlock.class) -public class PowderSnowBlockMixin -{ - - @Inject(at = @At("HEAD"), method = "canWalkOnPowderSnow", cancellable = true) - private static void canWalkOnPowderSnow(Entity entity, CallbackInfoReturnable cir) - { - if (ModuleManager.INSTANCE.getModuleByName("Anti Powder Snow").enabled) cir.setReturnValue(true); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/Category.java b/src/main/java/me/kawaiizenbo/moonlight/module/Category.java index ad4ad63..da15fac 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/Category.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/Category.java @@ -7,8 +7,7 @@ public enum Category RENDER("Render", 0xFF5555FF), WORLD("World", 0xFF55FF55), PLAYER("Player", 0xFF00AAAA), - CHAT("Chat", 0xFFFFAA00), - SPECIAL("Special", 0xFFFFFFFF); + CHAT("Chat", 0xFFFFAA00); public String name; public int color; diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/Module.java b/src/main/java/me/kawaiizenbo/moonlight/module/Module.java index 371ad6d..dbeecd4 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/Module.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/Module.java @@ -18,7 +18,6 @@ public abstract class Module public Category category; public boolean enabled; public ArrayList settings; - public boolean showEditButton; public BooleanSetting showInModulesList = new BooleanSetting("Show in Modules List", true); public KeycodeSetting keybind = new KeycodeSetting("Keybind", 0); diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/ModuleManager.java b/src/main/java/me/kawaiizenbo/moonlight/module/ModuleManager.java index 070c027..e84f966 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/ModuleManager.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/ModuleManager.java @@ -14,7 +14,7 @@ public class ModuleManager registerModules( new Fly(), new NoFall(), - new HUDEnabler(), + new HUDModule(), new Step(), new Fullbright(), new Speed(), @@ -22,11 +22,7 @@ public class ModuleManager new ChatSpammer(), new Rotation(), new AutoJump(), - new Reach(), - new AntiPowderSnow(), - new AutoTotem(), - new AutoWalk() - /*new Timer()*/ + new Timer() ); } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/AntiPowderSnow.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/AntiPowderSnow.java deleted file mode 100644 index fdc21b4..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/AntiPowderSnow.java +++ /dev/null @@ -1,12 +0,0 @@ -package me.kawaiizenbo.moonlight.module.modules; - -import me.kawaiizenbo.moonlight.module.Category; -import me.kawaiizenbo.moonlight.module.Module; - -public class AntiPowderSnow extends Module -{ - public AntiPowderSnow() - { - super("Anti Powder Snow", "Allows the player to walk on powder snow.", Category.PLAYER); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/AutoTotem.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/AutoTotem.java deleted file mode 100644 index 019e00c..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/AutoTotem.java +++ /dev/null @@ -1,36 +0,0 @@ -package me.kawaiizenbo.moonlight.module.modules; - -import me.kawaiizenbo.moonlight.module.Category; -import me.kawaiizenbo.moonlight.module.Module; -import me.kawaiizenbo.moonlight.module.settings.BooleanSetting; -import net.minecraft.item.Items; -import net.minecraft.screen.slot.SlotActionType; - -public class AutoTotem extends Module -{ - public BooleanSetting overrideItems = new BooleanSetting("Override other items", false); - - public AutoTotem() - { - super("Auto Totem", "Automatically puts totems in offhand.", Category.COMBAT); - settings.add(overrideItems); - } - - @Override - public void tick() - { - if (mc.player.getInventory().offHand.get(0).getItem() != Items.TOTEM_OF_UNDYING) - { - if((!mc.player.getInventory().offHand.isEmpty()) && !overrideItems.value) return; - for (int i = 0; i <= 35; i++) - { - if (mc.player.getInventory().getStack(i).getItem() == Items.TOTEM_OF_UNDYING) - { - mc.interactionManager.clickSlot(0, i, 8, SlotActionType.SWAP, mc.player); - mc.interactionManager.clickSlot(0, 45, 8, SlotActionType.SWAP, mc.player); - mc.interactionManager.clickSlot(0, i, 8, SlotActionType.SWAP, mc.player); - } - } - } - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/AutoWalk.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/AutoWalk.java deleted file mode 100644 index 3fea35f..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/AutoWalk.java +++ /dev/null @@ -1,26 +0,0 @@ -package me.kawaiizenbo.moonlight.module.modules; - -import me.kawaiizenbo.moonlight.module.Category; -import me.kawaiizenbo.moonlight.module.Module; - -public class AutoWalk extends Module -{ - - public AutoWalk() - { - super("Auto Walk", "Automatically moves forward.", Category.MOVEMENT); - } - - @Override - public void tick() - { - mc.options.forwardKey.setPressed(true); - } - - @Override - public void onDisable() - { - super.onDisable(); - mc.options.forwardKey.setPressed(false); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Fullbright.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Fullbright.java index 8fe2c61..fe13345 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Fullbright.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Fullbright.java @@ -11,8 +11,7 @@ public class Fullbright extends Module super("Fullbright", "Allows you to see in the dark.", Category.RENDER); } - @SuppressWarnings("unchecked") - @Override + @Override public void onEnable() { super.onEnable(); diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/HUDEnabler.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/HUDEnabler.java deleted file mode 100644 index 866699b..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/HUDEnabler.java +++ /dev/null @@ -1,19 +0,0 @@ -package me.kawaiizenbo.moonlight.module.modules; - -import me.kawaiizenbo.moonlight.module.Category; -import me.kawaiizenbo.moonlight.module.Module; -import me.kawaiizenbo.moonlight.module.settings.IndexSetting; - -public class HUDEnabler extends Module -{ - public IndexSetting mode = new IndexSetting("Mode", 0, "Modular", "Legacy"); - - public HUDEnabler() - { - super("HUD", "The Moonlight HUD.", Category.RENDER); - this.enabled = true; - this.showInModulesList.value = false; - this.showEditButton = true; - settings.add(mode); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/HUDModule.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/HUDModule.java new file mode 100644 index 0000000..e485076 --- /dev/null +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/HUDModule.java @@ -0,0 +1,51 @@ +package me.kawaiizenbo.moonlight.module.modules; + +import me.kawaiizenbo.moonlight.Moonlight; +import me.kawaiizenbo.moonlight.module.Category; +import me.kawaiizenbo.moonlight.module.Module; +import me.kawaiizenbo.moonlight.module.settings.BooleanSetting; +import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; +import me.kawaiizenbo.moonlight.ui.HUDOverlay; +import me.kawaiizenbo.moonlight.util.ColorUtils; + +public class HUDModule extends Module +{ + public BooleanSetting clientTag = new BooleanSetting("Client Tag", true); + public DoubleSetting r = new DoubleSetting("Red", 0x55, 0, 255, 0); + public DoubleSetting g = new DoubleSetting("Green", 255, 0, 255, 0); + public DoubleSetting b = new DoubleSetting("Blue", 255, 0, 255, 0); + //public ColorSetting color = new ColorSetting("Color", 0x55FFFF, ReflectionUtils.tryGetMethod("updateHUD", getClass())); + + public HUDModule() + { + super("HUD", "The Moonlight HUD. Toggle to update.", Category.RENDER); + this.enabled = true; + this.showInModulesList.value = false; + + settings.add(clientTag); + settings.add(r); + settings.add(g); + settings.add(b); + //settings.add(color); + } + + @Override + public void onEnable() + { + super.onEnable(); + HUDOverlay.INSTANCE.showClientTag = clientTag.value; + Moonlight.uiColorA = + ColorUtils.rgbaToInt( + (int)r.value, + (int)g.value, + (int)b.value, + 255 + ); + Moonlight.uiColor = + ColorUtils.rgbToInt( + (int)r.value, + (int)g.value, + (int)b.value + ); + } +} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/NoFall.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/NoFall.java index 102dc8c..2e2b160 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/NoFall.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/NoFall.java @@ -14,6 +14,6 @@ public class NoFall extends Module @Override public void tick() { - if(mc.player.fallDistance >= 2.5) mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true, false)); + if(mc.player.fallDistance >= 2.5) mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.OnGroundOnly(true)); } } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Reach.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Reach.java deleted file mode 100644 index af245ab..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Reach.java +++ /dev/null @@ -1,44 +0,0 @@ -package me.kawaiizenbo.moonlight.module.modules; - -import me.kawaiizenbo.moonlight.module.Category; -import me.kawaiizenbo.moonlight.module.Module; -import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; -import net.minecraft.entity.attribute.EntityAttributes; - -public class Reach extends Module -{ - DoubleSetting blockRange = new DoubleSetting("Block Range", 4.5, 1, 10, 1); - DoubleSetting entityRange = new DoubleSetting("Entity Range", 3.0, 1, 10, 1); - double oldBe = 4.5; - double oldEe = 3.0; - - public Reach() - { - super("Reach", "Extends player interaction distance.", Category.MOVEMENT); - settings.add(blockRange); - settings.add(entityRange); - } - - @Override - public void onEnable() - { - super.onEnable(); - oldBe = mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).getBaseValue(); - oldEe = mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).getBaseValue(); - } - - @Override - public void tick() - { - mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).setBaseValue(blockRange.value); - mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).setBaseValue(entityRange.value); - } - - @Override - public void onDisable() - { - super.onDisable(); - mc.player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE).setBaseValue(oldBe); - mc.player.getAttributeInstance(EntityAttributes.ENTITY_INTERACTION_RANGE).setBaseValue(oldEe); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Speed.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Speed.java index 385f571..c9a934e 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Speed.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Speed.java @@ -3,13 +3,13 @@ package me.kawaiizenbo.moonlight.module.modules; import me.kawaiizenbo.moonlight.module.Category; import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; -import net.minecraft.entity.attribute.EntityAttributes; +import me.kawaiizenbo.moonlight.util.MathUtils; +import net.minecraft.entity.MovementType; +import net.minecraft.util.math.Vec3d; public class Speed extends Module { - double old = 0.1; - - DoubleSetting speed = new DoubleSetting("Speed", 1.4, 0.1, 10, 1); + DoubleSetting speed = new DoubleSetting("Speed", 2, 0.1, 10, 1); public Speed() { super("Speed", "Allows you to move faster.", Category.MOVEMENT); @@ -17,23 +17,24 @@ public class Speed extends Module } @Override - public void onEnable() + public void onMotion(MovementType type, Vec3d movement) { - super.onEnable(); - old = mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).getBaseValue(); - } - - @Override - public void tick() - { - mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(speed.value/10d); - } - - @Override - public void onDisable() - { - super.onDisable(); - mc.player.getAttributeInstance(EntityAttributes.MOVEMENT_SPEED).setBaseValue(old); + // this is a little janky but it works, will find a better solution later + if (mc.player.forwardSpeed == 0 && mc.player.sidewaysSpeed == 0 && mc.player.isOnGround()) + { + mc.player.setVelocity(0, 0, 0); + } + Vec3d move = new Vec3d(mc.player.getX() - mc.player.prevX, 0, mc.player.getZ() - mc.player.prevZ).multiply(20); + double mps = Math.abs(MathUtils.length2D(move)); + double normal = mc.player.isSprinting() ? 5.61 : 4.31; + if (mps > normal * speed.value) + { + return; + } + if (mc.player.isOnGround()) + { + mc.player.setVelocity(mc.player.getVelocity().x * speed.value, 0, mc.player.getVelocity().z * speed.value); + } } } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Step.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Step.java index ac115d1..3fa8431 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Step.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Step.java @@ -3,36 +3,27 @@ package me.kawaiizenbo.moonlight.module.modules; import me.kawaiizenbo.moonlight.module.Category; import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; -import net.minecraft.entity.attribute.EntityAttributes; public class Step extends Module { DoubleSetting stepHeight = new DoubleSetting("Height", 1, 1, 10, 0); - double old = 0.6; public Step() { super("Step", "Allows you to step up full blocks.", Category.MOVEMENT); settings.add(stepHeight); } - - @Override - public void onEnable() - { - super.onEnable(); - old = mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).getBaseValue(); - } @Override public void tick() - { - mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(stepHeight.value); + { + mc.player.setStepHeight((float)stepHeight.value); } @Override public void onDisable() { super.onDisable(); - mc.player.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(old); + mc.player.setStepHeight(0.6f); } } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Timer.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Timer.java new file mode 100644 index 0000000..37558ae --- /dev/null +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Timer.java @@ -0,0 +1,38 @@ +package me.kawaiizenbo.moonlight.module.modules; + +import me.kawaiizenbo.moonlight.module.Module; +import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; +import net.minecraft.client.render.RenderTickCounter; +import me.kawaiizenbo.moonlight.module.Category; + +public class Timer extends Module +{ + public DoubleSetting speed = new DoubleSetting("Speed", 1.5, 0.1, 10, 1); + double current = speed.value; + public Timer() + { + super("Timer", "Changes the number of ticks per second", Category.WORLD); + settings.add(speed); + } + + @Override + public void onEnable() + { + super.onEnable(); + mc.renderTickCounter = new RenderTickCounter((float)(20.0*speed.value), 0L); + current = speed.value; + } + + @Override + public void tick() + { + if (current != speed.value) onEnable(); + } + + @Override + public void onDisable() + { + super.onDisable(); + mc.renderTickCounter = new RenderTickCounter(20.0f, 0L); + } +} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/settings/BooleanSetting.java b/src/main/java/me/kawaiizenbo/moonlight/module/settings/BooleanSetting.java index 83338ec..3232061 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/settings/BooleanSetting.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/settings/BooleanSetting.java @@ -1,6 +1,5 @@ package me.kawaiizenbo.moonlight.module.settings; -import me.kawaiizenbo.moonlight.Moonlight; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; import net.minecraft.text.Text; @@ -19,10 +18,10 @@ public class BooleanSetting extends Setting public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) { super.render(drawContext, x, y, mouseX, mouseY, textRenderer); - drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false); - drawContext.fill(x+180, y+7, x+190, y+17, Moonlight.THEME.border.getRGB()); - drawContext.fill(x+181, y+8, x+189, y+16, Moonlight.THEME.background.getRGB()); - drawContext.fill(x+182, y+9, x+188, y+15, value ? Moonlight.THEME.accent.getRGB() : Moonlight.THEME.background.getRGB()); + drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF); + drawContext.fill(x+180, y+7, x+190, y+17, 0xFFFFFFFF); + drawContext.fill(x+181, y+8, x+189, y+16, 0xFF222222); + drawContext.fill(x+182, y+9, x+188, y+15, value ? 0xFF55FFFF : 0xFF222222); } @Override diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/settings/DoubleSetting.java b/src/main/java/me/kawaiizenbo/moonlight/module/settings/DoubleSetting.java index 7a6a123..b1d1b6b 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/settings/DoubleSetting.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/settings/DoubleSetting.java @@ -1,6 +1,5 @@ package me.kawaiizenbo.moonlight.module.settings; -import me.kawaiizenbo.moonlight.Moonlight; import me.kawaiizenbo.moonlight.util.MathUtils; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -27,7 +26,7 @@ public class DoubleSetting extends Setting public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) { super.render(drawContext, x, y, mouseX, mouseY, textRenderer); - drawContext.drawText(textRenderer, Text.literal(name), x+2, y+4, Moonlight.THEME.text.getRGB(), false); + drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+4, 0xFFFFFF); double diff = Math.min(100, Math.max(0, (mouseX - x)/1.9)); if (sliding) @@ -44,11 +43,11 @@ public class DoubleSetting extends Setting } String valueString = ""+MathUtils.round(value, roundingPlace); - drawContext.drawText(textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+4, Moonlight.THEME.text.getRGB(), false); - drawContext.fill(x+2, y+16, x+190, y+18, 0xFF777777); + drawContext.drawTextWithShadow(textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+4, 0xFFFFFF); + drawContext.fill(x+2, y+16, x+190, y+18, 0xFF666666); int scaledValue = (int)((value/max)*190); - drawContext.fill(x+2, y+16, (x+2)+scaledValue, y+18, Moonlight.THEME.accent.getRGB()); - drawContext.fill(x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, Moonlight.THEME.border.getRGB()); + drawContext.fill(x+2, y+16, (x+2)+scaledValue, y+18, 0xFF55FFFF); + drawContext.fill(x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, 0xFFFFFFFF); } @Override diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/settings/IndexSetting.java b/src/main/java/me/kawaiizenbo/moonlight/module/settings/IndexSetting.java deleted file mode 100644 index 4f44ec8..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/module/settings/IndexSetting.java +++ /dev/null @@ -1,42 +0,0 @@ -package me.kawaiizenbo.moonlight.module.settings; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.util.DrawUtils; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.text.Text; - -public class IndexSetting extends Setting -{ - public int index; - public String[] elements; - - public IndexSetting(String name, int index, String... elements) - { - this.name = name; - this.index = index; - this.elements = elements; - } - - @Override - public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) - { - super.render(drawContext, x, y, mouseX, mouseY, textRenderer); - drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false); - drawContext.fill(x+96, y+5, x+190, y+19, Moonlight.THEME.border.getRGB()); - drawContext.fill(x+97, y+6, x+189, y+18, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB()); - drawContext.drawText(textRenderer, elements[index], x+98, y+8, Moonlight.THEME.text.getRGB(), false); - drawContext.drawGuiTexture(RenderLayer::getGuiTextured, DrawUtils.getThemedGUIIcon("updown", Moonlight.THEME.background), x+177, y+6, 12, 12); - } - - @Override - public void mouseClicked(double mouseX, double mouseY, int button) - { - if (hovered((int)mouseX, (int)mouseY) && button == 0) - { - if (index >= elements.length-1) index = 0; - else index++; - } - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/settings/KeycodeSetting.java b/src/main/java/me/kawaiizenbo/moonlight/module/settings/KeycodeSetting.java index 37ab7c0..f4bbffe 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/settings/KeycodeSetting.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/settings/KeycodeSetting.java @@ -2,7 +2,6 @@ package me.kawaiizenbo.moonlight.module.settings; import org.lwjgl.glfw.GLFW; -import me.kawaiizenbo.moonlight.Moonlight; import me.kawaiizenbo.moonlight.util.KeycodeUtils; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -37,19 +36,19 @@ public class KeycodeSetting extends Setting public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) { super.render(drawContext, x, y, mouseX, mouseY, textRenderer); - drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false); + drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF); if (isWaiting) { String waiting = "Press any key."; int twwidth = textRenderer.getWidth(waiting); - drawContext.drawText(textRenderer, waiting, x+190-twwidth, y+8, Moonlight.THEME.text.getRGB(), false); + drawContext.drawTextWithShadow(textRenderer, waiting, x+190-twwidth, y+8, 0xFFFFFF); } else { String key = KeycodeUtils.keyTable[value]; if (value == GLFW.GLFW_KEY_UNKNOWN) key = ""; int twidth = textRenderer.getWidth(key); - drawContext.drawText(textRenderer, key, x+190-twidth, y+8, Moonlight.THEME.text.getRGB(), false); + drawContext.drawTextWithShadow(textRenderer, key, x+190-twidth, y+8, 0xFFFFFF); } } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/settings/Setting.java b/src/main/java/me/kawaiizenbo/moonlight/module/settings/Setting.java index cb6447a..6d33f21 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/settings/Setting.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/settings/Setting.java @@ -1,6 +1,5 @@ package me.kawaiizenbo.moonlight.module.settings; -import me.kawaiizenbo.moonlight.Moonlight; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -13,7 +12,7 @@ public class Setting { this.x = x; this.y = y; - drawContext.fill(x, y, x+192, y+24, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB(): Moonlight.THEME.background.getRGB()); + drawContext.fill(x, y, x+192, y+24, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222); } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/settings/StringSetting.java b/src/main/java/me/kawaiizenbo/moonlight/module/settings/StringSetting.java index bee45b3..e76a87f 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/settings/StringSetting.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/settings/StringSetting.java @@ -1,6 +1,5 @@ package me.kawaiizenbo.moonlight.module.settings; -import me.kawaiizenbo.moonlight.Moonlight; import me.kawaiizenbo.moonlight.util.KeycodeUtils; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; @@ -21,13 +20,13 @@ public class StringSetting extends Setting public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY, TextRenderer textRenderer) { super.render(drawContext, x, y, mouseX, mouseY, textRenderer); - drawContext.drawText(textRenderer, Text.literal(name), x+2, y+8, Moonlight.THEME.text.getRGB(), false); + drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF); int twidth = textRenderer.getWidth(value); - drawContext.fill(x+96, y+5, x+190, y+19, Moonlight.THEME.border.getRGB()); - drawContext.fill(x+97, y+6, x+189, y+18, Moonlight.THEME.background.getRGB()); + drawContext.fill(x+96, y+5, x+190, y+19, 0xFFFFFFFF); + drawContext.fill(x+97, y+6, x+189, y+18, 0xFF222222); int cursorPos = x+98+twidth; - if (focused) drawContext.fill(cursorPos, y+7, cursorPos+1, y+17, Moonlight.THEME.accent.getRGB()); - drawContext.drawText(textRenderer, value, x+98, y+8, Moonlight.THEME.text.getRGB(), false); + if (focused) drawContext.fill(cursorPos, y+7, cursorPos+1, y+17, 0xFF55FFFF); + drawContext.drawTextWithShadow(textRenderer, value, x+98, y+8, 0xFFFFFF); } @Override diff --git a/src/main/java/me/kawaiizenbo/moonlight/theme/Theme.java b/src/main/java/me/kawaiizenbo/moonlight/theme/Theme.java deleted file mode 100644 index fd464ce..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/theme/Theme.java +++ /dev/null @@ -1,81 +0,0 @@ -package me.kawaiizenbo.moonlight.theme; - -public class Theme -{ - public static final Theme LIGHT = new Theme( - "Light", - new ThemeColor(0x222222), - new ThemeColor(0xFFFFFF), - new ThemeColor(0xFFFFFF), - new ThemeColor(0xDDDDDD), - new ThemeColor(0x00AAAA), - new ThemeColor(0x55FFFF), - new ThemeColor(0x222222), - false, - false - ); - public static final Theme HIGHCONTRAST = new Theme( - "High Contrast", - new ThemeColor(0x000000), - new ThemeColor(0xFFFFFF), - new ThemeColor(0xFFFFFF), - new ThemeColor(0x777777), - new ThemeColor(0x00AAAA), - new ThemeColor(0xFFFFFF), - new ThemeColor(0x000000), - false, - true - ); - public static final Theme DARK = new Theme( - "Dark", - new ThemeColor(0xFFFFFF), - new ThemeColor(0xFFFFFF), - new ThemeColor(0x222222), - new ThemeColor(0x333333), - new ThemeColor(0x55FFFF), - new ThemeColor(0x55FFFF), - new ThemeColor(0xFFFFFF), - false, - false - ); - public static final Theme[] THEME_LIST = - { - LIGHT, HIGHCONTRAST, DARK - }; - - public String name; - public ThemeColor text; - public ThemeColor headerText; - public ThemeColor background; - public ThemeColor hover; - public ThemeColor accent; - public ThemeColor hudAccent; - public ThemeColor border; - public boolean useDarkIcons; - public boolean themedWindowBorders; - - public Theme( - String name, - ThemeColor text, - ThemeColor headerText, - ThemeColor background, - ThemeColor hover, - ThemeColor accent, - ThemeColor hudAccent, - ThemeColor border, - boolean useDarkIcons, - boolean themedWindowBorders - ) - { - this.name = name; - this.text = text; - this.headerText = headerText; - this.background = background; - this.hover = hover; - this.accent = accent; - this.hudAccent = hudAccent; - this.border = border; - this.useDarkIcons = useDarkIcons; - this.themedWindowBorders = themedWindowBorders; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/theme/ThemeColor.java b/src/main/java/me/kawaiizenbo/moonlight/theme/ThemeColor.java deleted file mode 100644 index 019cc44..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/theme/ThemeColor.java +++ /dev/null @@ -1,32 +0,0 @@ -package me.kawaiizenbo.moonlight.theme; - -public class ThemeColor -{ - public int r, g, b; - - public ThemeColor(int r, int g, int b) - { - this.r = r; - this.g = g; - this.b = b; - } - - public ThemeColor(int RGBcolor) - { - this.r = (RGBcolor&0x00FF0000)>>16; - this.g = (RGBcolor&0x0000FF00)>>8; - this.b = (RGBcolor&0x000000FF)>>0; - } - - public int getRGB() - { - return ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((g&0x0ff)<<8)|(b&0x0ff); - } - - public void setRGB(int RGBcolor) - { - this.r = RGBcolor&0x00FF0000; - this.g = RGBcolor&0x0000FF00; - this.b = RGBcolor&0x000000FF; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/HUDOverlay.java b/src/main/java/me/kawaiizenbo/moonlight/ui/HUDOverlay.java new file mode 100644 index 0000000..63094fb --- /dev/null +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/HUDOverlay.java @@ -0,0 +1,55 @@ +package me.kawaiizenbo.moonlight.ui; + +import me.kawaiizenbo.moonlight.Moonlight; +import me.kawaiizenbo.moonlight.module.ModuleManager; +import me.kawaiizenbo.moonlight.module.modules.HUDModule; +import me.kawaiizenbo.moonlight.util.ColorUtils; +import me.kawaiizenbo.moonlight.util.MathUtils; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; +import net.minecraft.util.math.Vec3d; + +public class HUDOverlay +{ + public static HUDOverlay INSTANCE = new HUDOverlay(); + private MinecraftClient mc = MinecraftClient.getInstance(); + public boolean showClientTag = ((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).clientTag.value; + public int hudColor = ColorUtils.rgbaToInt( + (int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).r.value, + (int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).g.value, + (int)((HUDModule)ModuleManager.INSTANCE.getModuleByName("HUD")).b.value, + 255 ); + + public void render(DrawContext drawContext, int scaledWidth, int scaledHeight) + { + // do not draw if F3 enabled + if (mc.getDebugHud().shouldShowDebugHud()) return; + + // draw stats + drawContext.drawTextWithShadow(mc.textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 2, Moonlight.uiColorA); + drawContext.drawTextWithShadow(mc.textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 12, Moonlight.uiColorA); + drawContext.drawTextWithShadow(mc.textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, Moonlight.uiColorA); + + // draw coordinates + drawContext.drawTextWithShadow(mc.textRenderer, + "X: " + ColorUtils.gray + MathUtils.round(mc.player.getX(), 1) + ColorUtils.reset + + " Y: " + ColorUtils.gray + MathUtils.round(mc.player.getY(), 1) + ColorUtils.reset + + " Z: " + ColorUtils.gray + MathUtils.round(mc.player.getZ(), 1), 2, scaledHeight - 10, Moonlight.uiColorA + ); + + // draw client tag (if enabled) + if (showClientTag) + { + drawContext.drawTextWithShadow(mc.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, + scaledWidth - mc.textRenderer.getWidth(Moonlight.clientTag + " " + Moonlight.versionTag) - 2, scaledHeight - 10, 16777215); + } + } + + private double moveSpeed() + { + Vec3d move = new Vec3d(mc.player.getX() - mc.player.prevX, 0, mc.player.getZ() - mc.player.prevZ).multiply(20); + + return Math.abs(MathUtils.length2D(move)) ; + } +} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/LegacyHUD.java b/src/main/java/me/kawaiizenbo/moonlight/ui/LegacyHUD.java deleted file mode 100644 index 2caf08f..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/LegacyHUD.java +++ /dev/null @@ -1,45 +0,0 @@ -package me.kawaiizenbo.moonlight.ui; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.util.ColorUtils; -import me.kawaiizenbo.moonlight.util.MathUtils; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.util.math.Vec3d; - -public class LegacyHUD -{ - // This is deprecated and will be removed in a later version - public static LegacyHUD INSTANCE = new LegacyHUD(); - private MinecraftClient mc = MinecraftClient.getInstance(); - - public void render(DrawContext drawContext, int scaledWidth, int scaledHeight) - { - // do not draw if F3 enabled - if (mc.getDebugHud().shouldShowDebugHud()) return; - - // draw stats - drawContext.drawTextWithShadow(mc.textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 2, 0xFF55FFFF); - drawContext.drawTextWithShadow(mc.textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 12, 0xFF55FFFF); - drawContext.drawTextWithShadow(mc.textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, 0xFF55FFFF); - - // draw coordinates - drawContext.drawTextWithShadow(mc.textRenderer, - "X: " + ColorUtils.gray + String.format("%.1f", mc.player.getX()) + ColorUtils.reset + - " Y: " + ColorUtils.gray + String.format("%.1f", mc.player.getY()) + ColorUtils.reset + - " Z: " + ColorUtils.gray + String.format("%.1f", mc.player.getZ()), 2, scaledHeight - 10, 0xFF55FFFF - ); - - // draw client tag - drawContext.drawTextWithShadow(mc.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, - scaledWidth - mc.textRenderer.getWidth(Moonlight.clientTag + " " + Moonlight.versionTag) - 2, scaledHeight - 10, 16777215); - } - - private double moveSpeed() - { - Vec3d move = new Vec3d(mc.player.getX() - mc.player.prevX, 0, mc.player.getZ() - mc.player.prevZ).multiply(20); - - return Math.abs(MathUtils.length2D(move)) ; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/ModulesListOverlay.java b/src/main/java/me/kawaiizenbo/moonlight/ui/ModulesListOverlay.java index 95d6a5e..a0716aa 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/ModulesListOverlay.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/ModulesListOverlay.java @@ -2,6 +2,7 @@ package me.kawaiizenbo.moonlight.ui; import java.util.ArrayList; +import me.kawaiizenbo.moonlight.Moonlight; import me.kawaiizenbo.moonlight.module.ModuleManager; import me.kawaiizenbo.moonlight.module.Module; import net.minecraft.client.MinecraftClient; @@ -10,8 +11,6 @@ import net.minecraft.client.gui.DrawContext; public class ModulesListOverlay { - // this will be replaced with a new hud version at some point - public static ModulesListOverlay INSTANCE = new ModulesListOverlay(); private MinecraftClient mc = MinecraftClient.getInstance(); private ArrayList enabledModules = ModuleManager.INSTANCE.getEnabledModules(); @@ -27,7 +26,7 @@ public class ModulesListOverlay if (!m.showInModulesList.value) continue; int nameWidth = mc.textRenderer.getWidth(m.name); drawContext.fill(scaledWidth - nameWidth - 8, yOffset, scaledWidth, yOffset+12, 0x77222222); - drawContext.fill(scaledWidth - 2, yOffset, scaledWidth, yOffset+12, 0xFF55FFFF); + drawContext.fill(scaledWidth - 2, yOffset, scaledWidth, yOffset+12, Moonlight.uiColorA); drawContext.drawText(mc.textRenderer, m.name, scaledWidth - nameWidth - 4, yOffset + 2, 0xFFFFFFFF, false); yOffset += 12; } diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/SetScreenButton.java b/src/main/java/me/kawaiizenbo/moonlight/ui/TextButton.java similarity index 62% rename from src/main/java/me/kawaiizenbo/moonlight/ui/SetScreenButton.java rename to src/main/java/me/kawaiizenbo/moonlight/ui/TextButton.java index 8d735c1..79d8643 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/SetScreenButton.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/TextButton.java @@ -1,33 +1,29 @@ package me.kawaiizenbo.moonlight.ui; -import me.kawaiizenbo.moonlight.Moonlight; +import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; -public class SetScreenButton +public class TextButton { String text; - Screen screen; - int x, y, width; + int x, y, color, width; - public SetScreenButton(String text, int x, int y, Screen screen) + public TextButton(String text, int x, int y, int color) { this.text = text; this.x = x; this.y = y; - this.screen = screen; + this.color = color; } - public void render(DrawContext drawContext, TextRenderer textRenderer, int mouseX, int mouseY, int x, int y) + public void render(DrawContext drawContext, TextRenderer textRenderer, int mouseX, int mouseY) { - this.x = x; - this.y = y; width = textRenderer.getWidth(text); - drawContext.fill(x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0x22222222 : 0); - drawContext.drawText(textRenderer, Text.literal(text), x, y, Moonlight.THEME.headerText.getRGB(), false); + drawContext.fill(x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0x55FFFFFF : 0); + drawContext.drawText(textRenderer, Text.literal(text), x, y, color, true); } public boolean hovered(int mouseX, int mouseY) @@ -39,7 +35,8 @@ public class SetScreenButton { if (hovered(mouseX, mouseY)) { - MinecraftClient.getInstance().setScreen(screen); + // i have no clue how to pass a method so this is kind of stupid + MinecraftClient.getInstance().setScreen(ClickGUIScreen.INSTANCE); } } } diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java index 61100e6..695e3f0 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java @@ -2,15 +2,11 @@ package me.kawaiizenbo.moonlight.ui.clickgui; import java.util.ArrayList; -import me.kawaiizenbo.moonlight.Moonlight; import me.kawaiizenbo.moonlight.module.Category; import me.kawaiizenbo.moonlight.module.ModuleManager; -import me.kawaiizenbo.moonlight.util.DrawUtils; import me.kawaiizenbo.moonlight.module.Module; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.util.Identifier; public class CategoryPane { @@ -20,7 +16,6 @@ public class CategoryPane boolean dragging = false; public boolean collapsed = false; ArrayList moduleButtons; - Identifier icon; public CategoryPane(Category category, int initialX, int initialY, boolean collapsed) { @@ -29,7 +24,6 @@ public class CategoryPane this.y = initialY; this.collapsed = collapsed; moduleButtons = new ArrayList(); - icon = DrawUtils.getThemedGUIIcon(category.name.toLowerCase()); for (Module m : ModuleManager.INSTANCE.getModulesByCategory(category)) { moduleButtons.add(new ModuleButton(m)); @@ -45,10 +39,9 @@ public class CategoryPane x = mouseX - startX; y = mouseY - startY; } - drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : category.color); - //drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB()); - drawContext.drawGuiTexture(RenderLayer::getGuiTextured, icon, x+2, y+2, 12, 12); - drawContext.drawText(textRenderer, category.name, x+16, y+4, Moonlight.THEME.headerText.getRGB(), false); + drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, category.color); + drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); + drawContext.drawText(textRenderer, category.name, x+4, y+4, 0xFFFFFFFF, false); if (!collapsed) { int buttonYOffset = y+16; diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ClickGUIScreen.java b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ClickGUIScreen.java index c90375b..8430540 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ClickGUIScreen.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ClickGUIScreen.java @@ -5,7 +5,6 @@ import java.util.Map; import me.kawaiizenbo.moonlight.Moonlight; import me.kawaiizenbo.moonlight.module.Category; -import me.kawaiizenbo.moonlight.theme.Theme; import me.kawaiizenbo.moonlight.util.MathUtils; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; @@ -16,7 +15,6 @@ public class ClickGUIScreen extends Screen public static ClickGUIScreen INSTANCE = new ClickGUIScreen(); public ArrayList categoryPanes; - @SuppressWarnings("unchecked") public ClickGUIScreen() { super(Text.literal("ClickGUI")); @@ -24,7 +22,6 @@ public class ClickGUIScreen extends Screen Map panePos = ((Map)Moonlight.CONFIG.config.get("panes")); for (Category category : Category.values()) { - if(category.name == "Special") continue; int xOffset = MathUtils.d2iSafe(((Map)panePos.get(category.name)).get("x")); int yOffset = MathUtils.d2iSafe(((Map)panePos.get(category.name)).get("y")); boolean collapsed = (boolean)((Map)panePos.get(category.name)).get("collapsed"); @@ -36,9 +33,6 @@ public class ClickGUIScreen extends Screen public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) { this.renderBackground(drawContext, mouseX, mouseY, delta); - drawContext.fill(width-80, height-16, width, height, Moonlight.THEME.border.getRGB()); - drawContext.fill(width-78, height-14, width-2, height-2, (mouseX > width-80 && mouseY > height-16) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB()); - drawContext.drawText(textRenderer, "Change Theme", width-75, height-12, Moonlight.THEME.text.getRGB(), false); for (CategoryPane category : categoryPanes) { category.render(drawContext, mouseX, mouseY, delta, textRenderer); @@ -52,12 +46,6 @@ public class ClickGUIScreen extends Screen { category.mouseClicked((int) mouseX, (int) mouseY, button); } - if (mouseX > width-80 && mouseY > height-16) - { - if (Moonlight.THEME_IDX >= Theme.THEME_LIST.length-1) Moonlight.THEME_IDX = 0; - else Moonlight.THEME_IDX++; - Moonlight.THEME = Theme.THEME_LIST[Moonlight.THEME_IDX]; - } return super.mouseClicked(mouseX, mouseY, button); } diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ModuleButton.java b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ModuleButton.java index 1627c6b..9566741 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ModuleButton.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/ModuleButton.java @@ -22,8 +22,8 @@ public class ModuleButton { this.x = x; this.y = y; - drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB()); - drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? Moonlight.THEME.accent.getRGB() : Moonlight.THEME.text.getRGB(), false); + drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222); + drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? Moonlight.uiColor : 0xFFFFFF, false); } public boolean hovered(int mouseX, int mouseY) diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/SettingsScreen.java b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/SettingsScreen.java index 5e8351f..b29bb1d 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/SettingsScreen.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/SettingsScreen.java @@ -1,10 +1,8 @@ package me.kawaiizenbo.moonlight.ui.clickgui; -import me.kawaiizenbo.moonlight.Moonlight; import me.kawaiizenbo.moonlight.module.Module; import me.kawaiizenbo.moonlight.module.settings.Setting; -import me.kawaiizenbo.moonlight.ui.SetScreenButton; -import me.kawaiizenbo.moonlight.ui.hud.editor.HUDEditorScreen; +import me.kawaiizenbo.moonlight.ui.TextButton; import me.kawaiizenbo.moonlight.util.ColorUtils; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; @@ -13,8 +11,7 @@ import net.minecraft.text.Text; public class SettingsScreen extends Screen { private Module module; - private SetScreenButton backButton; - private SetScreenButton editButton; + private TextButton backButton; boolean dragging = false; int startX, startY, x = (ClickGUIScreen.INSTANCE.width/2)-112, y = (ClickGUIScreen.INSTANCE.height/2)-96, windowWidth = 224, windowHeight = 192; @@ -22,8 +19,6 @@ public class SettingsScreen extends Screen public SettingsScreen(Module module) { super(Text.literal("Settings")); - backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, ClickGUIScreen.INSTANCE); - editButton = new SetScreenButton(ColorUtils.underline + "Edit", x+windowWidth-22, y+4, HUDEditorScreen.INSTANCE); this.module = module; } @@ -38,14 +33,13 @@ public class SettingsScreen extends Screen x = mouseX - startX; y = mouseY - startY; } - drawContext.fill(x, y, x+windowWidth, y+windowHeight, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : module.category.color); - drawContext.fill(x+2, y+2, x+windowWidth-2, y+windowHeight-2, Moonlight.THEME.background.getRGB()); - drawContext.fill(x, y, x+windowWidth, y+16, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : module.category.color); - //drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, Moonlight.THEME.background.getRGB()); - drawContext.drawText(textRenderer, module.name, x+((windowWidth/2)-(textRenderer.getWidth(module.name)/2)), y+4, Moonlight.THEME.headerText.getRGB(), false); - drawContext.drawText(textRenderer, module.description, x+8, y+24, Moonlight.THEME.text.getRGB(), false); - backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4); - if (module.showEditButton) editButton.render(drawContext, textRenderer, mouseX, mouseY, x+windowWidth-22, y+4); + drawContext.fill(x, y, x+windowWidth, y+windowHeight, 0xFF222222); + drawContext.fill(x, y, x+windowWidth, y+16, module.category.color); + drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, 0xFF222222); + drawContext.drawCenteredTextWithShadow(textRenderer, module.name, x+(windowWidth/2), y+4, 0xFFFFFF); + drawContext.drawText(textRenderer, module.description, x+8, y+24, 0xFFFFFF, true); + backButton = new TextButton(ColorUtils.underline + "< Back", x+4, y+4, 0xFFFFFF); + backButton.render(drawContext, textRenderer, mouseX, mouseY); int yOffset = y+40; for (Setting setting : module.settings) { @@ -75,7 +69,6 @@ public class SettingsScreen extends Screen dragging = true; } backButton.mouseClicked((int)mouseX, (int)mouseY); - editButton.mouseClicked((int)mouseX, (int)mouseY); for (Setting setting : module.settings) { setting.mouseClicked(mouseX, mouseY, button); diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDModule.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDModule.java deleted file mode 100644 index 96cc293..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDModule.java +++ /dev/null @@ -1,68 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud; - -import java.util.ArrayList; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.module.settings.Setting; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; - -public abstract class HUDModule -{ - public int x, y, height, width; - public String name; - int startX, startY; - boolean dragging = false; - public boolean enabled = false; - public ArrayList settings; - - protected static MinecraftClient mc = MinecraftClient.getInstance(); - - public HUDModule(String name, int x, int y) - { - this.name = name; - this.x = x; - this.y = y; - settings = new ArrayList<>(); - } - - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - if (editMode) - { - if (dragging) - { - x = mouseX - startX; - y = mouseY - startY; - } - drawContext.fill(x-1, y-1, x+width+1, y+height+1, enabled ? Moonlight.THEME.accent.getRGB() : 0xFF555555); - drawContext.fill(x, y, x+width, y+height, 0xFF222222); - } - } - - public boolean hovered(int mouseX, int mouseY) - { - return mouseX >= x && mouseX <= x+width && mouseY >= y && mouseY <= y+height; - } - - public void mouseClicked(int mouseX, int mouseY, int button) - { - if (hovered(mouseX, mouseY) && button == 0) - { - startX = (int)mouseX-x; - startY = (int)mouseY-y; - dragging = true; - } - } - - public void mouseReleased(int mouseX, int mouseY, int button) - { - dragging = false; - } - - public void toggle() - { - enabled = !enabled; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDModuleManager.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDModuleManager.java deleted file mode 100644 index b2b3dc7..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDModuleManager.java +++ /dev/null @@ -1,56 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud; - -import java.util.ArrayList; - -import me.kawaiizenbo.moonlight.ui.hud.modules.*; - -public class HUDModuleManager -{ - public static HUDModuleManager INSTANCE = new HUDModuleManager(); - public ArrayList modules = new ArrayList<>(); - - public HUDModuleManager() - { - registerModules( - new ClientTag(2, 2), - new FPS(2, 12), - new Ping(2, 22), - new MovementSpeed(2, 32), - new Coordinates(2, 42), - new ArmorDisplay(2, 52), - new TotemCounter(20, 52) - //new TestModuleHUD(20, 50) - ); - } - - private void registerModules(HUDModule... modules) - { - for (HUDModule module : modules) { - this.modules.add(module); - } - } - - public HUDModule getModuleByName(String moduleName) - { - for(HUDModule module : modules) - { - if ((module.name.trim().equalsIgnoreCase(moduleName))) - { - return module; - } - } - return null; - } - - public ArrayList getEnabledModules() - { - ArrayList enabledModules = new ArrayList<>(); - for (HUDModule module : modules) - { - if (!module.enabled) - continue; - enabledModules.add(module); - } - return enabledModules; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDRenderer.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDRenderer.java deleted file mode 100644 index 8c03be3..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/HUDRenderer.java +++ /dev/null @@ -1,22 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud; - -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.DrawContext; - -public class HUDRenderer -{ - public static HUDRenderer INSTANCE = new HUDRenderer(); - private MinecraftClient mc = MinecraftClient.getInstance(); - - public void render(DrawContext drawContext) - { - // do not draw if F3 enabled - if (mc.getDebugHud().shouldShowDebugHud()) return; - - for (HUDModule h : HUDModuleManager.INSTANCE.getEnabledModules()) - { - // mouse coords are not needed when not in edit mode - h.render(drawContext, 0, 0, mc.textRenderer, false, true); - } - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDEditorScreen.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDEditorScreen.java deleted file mode 100644 index 6df96cc..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDEditorScreen.java +++ /dev/null @@ -1,58 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.editor; - -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; - -public class HUDEditorScreen extends Screen -{ - public static HUDEditorScreen INSTANCE = new HUDEditorScreen(); - HUDModuleList moduleList; - - public HUDEditorScreen() - { - super(Text.literal("HUD Editor")); - moduleList = new HUDModuleList(256, 2, false); - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) - { - this.renderBackground(drawContext, mouseX, mouseY, delta); - for (HUDModule h : HUDModuleManager.INSTANCE.modules) - { - h.render(drawContext, mouseX, mouseY, textRenderer, true, h.enabled); - } - moduleList.render(drawContext, mouseX, mouseY, delta, textRenderer); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) - { - for (HUDModule h : HUDModuleManager.INSTANCE.modules) - { - h.mouseClicked((int)mouseX, (int)mouseY, button); - } - moduleList.mouseClicked((int)mouseX, (int)mouseY, button); - return super.mouseClicked(mouseX, mouseY, button); - } - - @Override - public boolean mouseReleased(double mouseX, double mouseY, int button) - { - for (HUDModule h : HUDModuleManager.INSTANCE.modules) - { - h.mouseReleased((int)mouseX, (int)mouseY, button); - } - moduleList.mouseReleased((int)mouseX, (int)mouseY, button); - return super.mouseReleased(mouseX, mouseY, button); - } - - @Override - public boolean shouldPause() - { - return false; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleButton.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleButton.java deleted file mode 100644 index cd09ee1..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleButton.java +++ /dev/null @@ -1,53 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.editor; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.util.Identifier; - -public class HUDModuleButton -{ - public HUDModule module; - public int x, y, width, height = 0; - - public HUDModuleButton(HUDModule module) - { - this.module = module; - this.width = 124; - this.height = 12; - } - - public void render(DrawContext drawContext, int mouseX, int mouseY, int x, int y, TextRenderer textRenderer) - { - this.x = x; - this.y = y; - drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB()); - drawContext.drawText(textRenderer, module.name, x+2, y+2, module.enabled ? Moonlight.THEME.accent.getRGB() : Moonlight.THEME.text.getRGB(), false); - if (!module.settings.isEmpty()) drawContext.drawGuiTexture(RenderLayer::getGuiTextured, Identifier.of("moonlight", "settings"), x+width-12, y, 12, 12); - } - - public boolean hovered(int mouseX, int mouseY) - { - return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height; - } - - public boolean mouseClicked(int mouseX, int mouseY, int button) - { - if (hovered(mouseX, mouseY)) - { - if (button == 0) - { - module.toggle(); - } - else if (button == 1) - { - if (!module.settings.isEmpty()) MinecraftClient.getInstance().setScreen(new HUDModuleSettingsScreen(module)); - } - return true; - } - return false; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleList.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleList.java deleted file mode 100644 index f9cfdad..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleList.java +++ /dev/null @@ -1,82 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.editor; - -import java.util.ArrayList; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.ui.hud.HUDModuleManager; -import me.kawaiizenbo.moonlight.util.DrawUtils; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.render.RenderLayer; -import net.minecraft.util.Identifier; - -public class HUDModuleList -{ - public int x, y, height, width = 128; - int startX, startY; - boolean dragging = false; - public boolean collapsed = false; - ArrayList buttons; - - public HUDModuleList(int initialX, int initialY, boolean collapsed) - { - this.x = initialX; - this.y = initialY; - this.collapsed = collapsed; - buttons = new ArrayList(); - for (HUDModule m : HUDModuleManager.INSTANCE.modules) - { - buttons.add(new HUDModuleButton(m)); - } - if (buttons.size() == 0) collapsed = true; - height = (buttons.size()*12) + 18; - } - - public void render(DrawContext drawContext, int mouseX, int mouseY, float delta, TextRenderer textRenderer) - { - if (dragging) - { - x = mouseX - startX; - y = mouseY - startY; - } - drawContext.fill(x, y, x+width, collapsed ? y+16 : y+height, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : Moonlight.THEME.accent.getRGB()); - //drawContext.fill(x+2, y+2, x+(width-2), y+14, hovered(mouseX, mouseY) ? Moonlight.THEME.hover.getRGB() : Moonlight.THEME.background.getRGB()); - drawContext.drawGuiTexture(RenderLayer::getGuiTextured, DrawUtils.getThemedGUIIcon("hud"), x+2, y+2, 12, 12); - drawContext.drawText(textRenderer, "HUD Modules", x+16, y+4, Moonlight.THEME.headerText.getRGB(), false); - if (!collapsed) - { - int buttonYOffset = y+16; - for (HUDModuleButton m : buttons) - { - m.render(drawContext, mouseX, mouseY, x+2, buttonYOffset, textRenderer); - buttonYOffset += 12; - } - } - } - - public boolean hovered(int mouseX, int mouseY) - { - return mouseX >= x+2 && mouseX <= x+(width-2) && mouseY >= y+2 && mouseY <= y+14; - } - - public void mouseClicked(int mouseX, int mouseY, int button) - { - for (HUDModuleButton moduleButton : buttons) - { - if (moduleButton.mouseClicked(mouseX, mouseY, button)) return; - } - if (hovered(mouseX, mouseY) && button == 1) collapsed = !collapsed; - else if (hovered(mouseX, mouseY) && button == 0) - { - startX = (int)mouseX-x; - startY = (int)mouseY-y; - dragging = true; - } - } - - public void mouseReleased(int mouseX, int mouseY, int button) - { - dragging = false; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleSettingsScreen.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleSettingsScreen.java deleted file mode 100644 index a3d2a90..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/editor/HUDModuleSettingsScreen.java +++ /dev/null @@ -1,101 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.editor; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.module.settings.Setting; -import me.kawaiizenbo.moonlight.ui.SetScreenButton; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.util.ColorUtils; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.text.Text; - -public class HUDModuleSettingsScreen extends Screen -{ - // adapted for hud modules - private HUDModule module; - private SetScreenButton backButton; - - boolean dragging = false; - int startX, startY, x = (HUDEditorScreen.INSTANCE.width/2)-112, y = (HUDEditorScreen.INSTANCE.height/2)-96, windowWidth = 224, windowHeight = 192; - - public HUDModuleSettingsScreen(HUDModule module) - { - super(Text.literal("Settings")); - backButton = new SetScreenButton(ColorUtils.underline + "< Back", x+4, y+4, HUDEditorScreen.INSTANCE); - this.module = module; - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) - { - this.renderBackground(drawContext, mouseX, mouseY, delta); - - // move window if dragging - if (dragging) - { - x = mouseX - startX; - y = mouseY - startY; - } - drawContext.fill(x, y, x+windowWidth, y+windowHeight, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : Moonlight.THEME.accent.getRGB()); - drawContext.fill(x+2, y+2, x+windowWidth-2, y+windowHeight-2, Moonlight.THEME.background.getRGB()); - drawContext.fill(x, y, x+windowWidth, y+16, Moonlight.THEME.themedWindowBorders ? Moonlight.THEME.border.getRGB() : Moonlight.THEME.accent.getRGB()); - //drawContext.fill(x+2, y+2, x+(windowWidth-2), y+14, Moonlight.THEME.background.getRGB()); - drawContext.drawText(textRenderer, module.name, x+((windowWidth/2)-(textRenderer.getWidth(module.name)/2)), y+4, Moonlight.THEME.headerText.getRGB(), false); - backButton.render(drawContext, textRenderer, mouseX, mouseY, x+4, y+4); - int yOffset = y+24; - for (Setting setting : module.settings) - { - setting.render(drawContext, x+16, yOffset, mouseX, mouseY, textRenderer); - yOffset += 25; - } - } - - public boolean barHovered(int mouseX, int mouseY) - { - return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + 16; - } - - @Override - public boolean shouldPause() - { - return false; - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) - { - if (barHovered((int)mouseX, (int)mouseY)) - { - startX = (int)mouseX-x; - startY = (int)mouseY-y; - dragging = true; - } - backButton.mouseClicked((int)mouseX, (int)mouseY); - for (Setting setting : module.settings) - { - setting.mouseClicked(mouseX, mouseY, button); - } - return super.mouseClicked(mouseX, mouseY, button); - } - - @Override - public boolean mouseReleased(double mouseX, double mouseY, int button) - { - dragging = false; - for (Setting setting : module.settings) - { - setting.mouseReleased(mouseX, mouseY, button); - } - return super.mouseReleased(mouseX, mouseY, button); - } - - @Override - public boolean keyPressed(int keyCode, int scanCode, int modifiers) - { - for (Setting setting : module.settings) - { - setting.keyPressed(keyCode, scanCode, modifiers); - } - return super.keyPressed(keyCode, scanCode, modifiers); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/ArmorDisplay.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/ArmorDisplay.java deleted file mode 100644 index 8c3bf83..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/ArmorDisplay.java +++ /dev/null @@ -1,31 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.modules; - -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.item.ItemStack; - -public class ArmorDisplay extends HUDModule -{ - - public ArmorDisplay(int x, int y) - { - super("Armor Display", x, y); - this.width = 16; - this.height = 64; - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); - int yOffset = 0; - for (int i = 39; i >= 36; i--) - { - ItemStack piece = mc.player.getInventory().getStack(i); - drawContext.drawItem(piece, x, y+yOffset); - drawContext.drawStackOverlay(textRenderer, piece, x, y+yOffset); - yOffset += 16; - } - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/ClientTag.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/ClientTag.java deleted file mode 100644 index d8f0ff8..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/ClientTag.java +++ /dev/null @@ -1,24 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.modules; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; - -public class ClientTag extends HUDModule -{ - public ClientTag(int x, int y) - { - super("Client Tag", x, y); - this.width = 128; - this.height = 8; - this.enabled = true; - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); - drawContext.drawTextWithShadow(mc.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, x, y, 16777215); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/Coordinates.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/Coordinates.java deleted file mode 100644 index 699a5a9..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/Coordinates.java +++ /dev/null @@ -1,29 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.modules; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.util.ColorUtils; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; - -public class Coordinates extends HUDModule -{ - public Coordinates(int x, int y) - { - super("Coordinates", x, y); - this.width = 128; - this.height = 8; - this.enabled = true; - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); - drawContext.drawTextWithShadow(mc.textRenderer, - "X: " + ColorUtils.gray + String.format("%.1f", mc.player.getX()) + ColorUtils.reset + - " Y: " + ColorUtils.gray + String.format("%.1f", mc.player.getY()) + ColorUtils.reset + - " Z: " + ColorUtils.gray + String.format("%.1f", mc.player.getZ()), x, y, Moonlight.THEME.hudAccent.getRGB() - ); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/FPS.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/FPS.java deleted file mode 100644 index c7dd4a6..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/FPS.java +++ /dev/null @@ -1,25 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.modules; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.util.ColorUtils; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; - -public class FPS extends HUDModule -{ - public FPS(int x, int y) - { - super("FPS", x, y); - this.width = 48; - this.height = 8; - this.enabled = true; - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); - drawContext.drawTextWithShadow(mc.textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], x, y, Moonlight.THEME.hudAccent.getRGB()); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/MovementSpeed.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/MovementSpeed.java deleted file mode 100644 index a21c01f..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/MovementSpeed.java +++ /dev/null @@ -1,33 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.modules; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.util.ColorUtils; -import me.kawaiizenbo.moonlight.util.MathUtils; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.util.math.Vec3d; - -public class MovementSpeed extends HUDModule -{ - public MovementSpeed(int x, int y) - { - super("Movement Speed", x, y); - this.width = 72; - this.height = 8; - this.enabled = true; - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); - drawContext.drawTextWithShadow(mc.textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), x, y, Moonlight.THEME.hudAccent.getRGB()); - } - - private double moveSpeed() - { - Vec3d move = new Vec3d(mc.player.getX() - mc.player.prevX, 0, mc.player.getZ() - mc.player.prevZ).multiply(20); - return Math.abs(MathUtils.length2D(move)) ; - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/Ping.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/Ping.java deleted file mode 100644 index 935fbe4..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/Ping.java +++ /dev/null @@ -1,25 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.modules; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import me.kawaiizenbo.moonlight.util.ColorUtils; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; - -public class Ping extends HUDModule -{ - public Ping(int x, int y) - { - super("Ping", x, y); - this.width = 48; - this.height = 8; - this.enabled = true; - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); - drawContext.drawTextWithShadow(mc.textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), x, y, Moonlight.THEME.hudAccent.getRGB()); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/TestModuleHUD.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/TestModuleHUD.java deleted file mode 100644 index fed72f9..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/TestModuleHUD.java +++ /dev/null @@ -1,29 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.modules; - -import me.kawaiizenbo.moonlight.module.settings.DoubleSetting; -import me.kawaiizenbo.moonlight.module.settings.StringSetting; -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; - -public class TestModuleHUD extends HUDModule -{ - public StringSetting text = new StringSetting("Text", "hii :3"); - public DoubleSetting number = new DoubleSetting("test", 1, 0, 10, 0); - - public TestModuleHUD(int x, int y) - { - super("Test HUD Module", x, y); - this.width = 96; - this.height = 8; - settings.add(text); - settings.add(number); - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); - drawContext.drawText(textRenderer, text.value, x, y, 0xFFFFFF, false); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/TotemCounter.java b/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/TotemCounter.java deleted file mode 100644 index fb0a618..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/hud/modules/TotemCounter.java +++ /dev/null @@ -1,32 +0,0 @@ -package me.kawaiizenbo.moonlight.ui.hud.modules; - -import me.kawaiizenbo.moonlight.ui.hud.HUDModule; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.DrawContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; - -public class TotemCounter extends HUDModule -{ - - public TotemCounter(int x, int y) - { - super("Totem Counter", x, y); - this.width = 24; - this.height = 16; - } - - @Override - public void render(DrawContext drawContext, int mouseX, int mouseY, TextRenderer textRenderer, boolean editMode, boolean enabled) - { - super.render(drawContext, mouseX, mouseY, textRenderer, editMode, enabled); - int count = 0; - for (int i = 0; i < 36; i++) - { - ItemStack stack = mc.player.getInventory().getStack(i); - if (stack.getItem() == Items.TOTEM_OF_UNDYING) count += stack.getCount(); - } - drawContext.drawItem(Items.TOTEM_OF_UNDYING.getDefaultStack(), x, y); - drawContext.drawTextWithShadow(textRenderer, count+"", x+16, y+8, 16777215); - } -} diff --git a/src/main/java/me/kawaiizenbo/moonlight/util/DrawUtils.java b/src/main/java/me/kawaiizenbo/moonlight/util/DrawUtils.java deleted file mode 100644 index 03443bc..0000000 --- a/src/main/java/me/kawaiizenbo/moonlight/util/DrawUtils.java +++ /dev/null @@ -1,21 +0,0 @@ -package me.kawaiizenbo.moonlight.util; - -import me.kawaiizenbo.moonlight.Moonlight; -import me.kawaiizenbo.moonlight.theme.ThemeColor; -import net.minecraft.util.Identifier; - -public class DrawUtils -{ - public static Identifier getThemedGUIIcon(String textureName, ThemeColor invert) - { - boolean mode = ((invert.r + invert.g + invert.b) / 3) > 77; - String addition = mode ? "_light" : ""; - return Identifier.of("moonlight", textureName+addition); - } - - public static Identifier getThemedGUIIcon(String textureName) - { - String addition = Moonlight.THEME.useDarkIcons ? "_light" : ""; - return Identifier.of("moonlight", textureName+addition); - } -} diff --git a/src/main/resources/assets/moonlight/chat.png b/src/main/resources/assets/moonlight/chat.png new file mode 100644 index 0000000..87aadee Binary files /dev/null and b/src/main/resources/assets/moonlight/chat.png differ diff --git a/src/main/resources/assets/moonlight/combat.png b/src/main/resources/assets/moonlight/combat.png new file mode 100644 index 0000000..82fee53 Binary files /dev/null and b/src/main/resources/assets/moonlight/combat.png differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/movement.png b/src/main/resources/assets/moonlight/movement.png similarity index 100% rename from src/main/resources/assets/moonlight/textures/gui/sprites/movement.png rename to src/main/resources/assets/moonlight/movement.png diff --git a/src/main/resources/assets/moonlight/player.png b/src/main/resources/assets/moonlight/player.png new file mode 100644 index 0000000..4cabe2e Binary files /dev/null and b/src/main/resources/assets/moonlight/player.png differ diff --git a/src/main/resources/assets/moonlight/render.png b/src/main/resources/assets/moonlight/render.png new file mode 100644 index 0000000..08257ab Binary files /dev/null and b/src/main/resources/assets/moonlight/render.png differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/chat.png b/src/main/resources/assets/moonlight/textures/gui/sprites/chat.png deleted file mode 100644 index 09aaee2..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/chat.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/chat_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/chat_light.png deleted file mode 100644 index 99d12cf..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/chat_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/combat.png b/src/main/resources/assets/moonlight/textures/gui/sprites/combat.png deleted file mode 100644 index 1c3c01c..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/combat.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/combat_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/combat_light.png deleted file mode 100644 index 235bda7..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/combat_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/hud.png b/src/main/resources/assets/moonlight/textures/gui/sprites/hud.png deleted file mode 100644 index 854c430..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/hud.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/hud_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/hud_light.png deleted file mode 100644 index 4052a19..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/hud_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/movement_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/movement_light.png deleted file mode 100644 index 6e08707..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/movement_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/player.png b/src/main/resources/assets/moonlight/textures/gui/sprites/player.png deleted file mode 100644 index 514dfdb..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/player.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/player_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/player_light.png deleted file mode 100644 index e9454e9..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/player_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/render.png b/src/main/resources/assets/moonlight/textures/gui/sprites/render.png deleted file mode 100644 index 4124739..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/render.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/render_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/render_light.png deleted file mode 100644 index d42ca54..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/render_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/settings.png b/src/main/resources/assets/moonlight/textures/gui/sprites/settings.png deleted file mode 100644 index 93e6cec..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/settings.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/settings_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/settings_light.png deleted file mode 100644 index aaedc9f..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/settings_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/updown.png b/src/main/resources/assets/moonlight/textures/gui/sprites/updown.png deleted file mode 100644 index ca63110..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/updown.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/updown_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/updown_light.png deleted file mode 100644 index 684cdbd..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/updown_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/world.png b/src/main/resources/assets/moonlight/textures/gui/sprites/world.png deleted file mode 100644 index 1ef0a88..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/world.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/textures/gui/sprites/world_light.png b/src/main/resources/assets/moonlight/textures/gui/sprites/world_light.png deleted file mode 100644 index 1308ef9..0000000 Binary files a/src/main/resources/assets/moonlight/textures/gui/sprites/world_light.png and /dev/null differ diff --git a/src/main/resources/assets/moonlight/world.png b/src/main/resources/assets/moonlight/world.png new file mode 100644 index 0000000..e1bef72 Binary files /dev/null and b/src/main/resources/assets/moonlight/world.png differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d09ff4b..31a03d5 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,12 +1,12 @@ { "schemaVersion": 1, "id": "moonlight", - "version": "v0.4.0", + "version": "${version}", + "name": "Moonlight Meadows", "description": "Utility mod with a focus on stability.", "authors": [ "KawaiiZenbo", - "madeline1805", "BadGamesInc (re-used Hypnotic Code)" ], "contact": { @@ -29,9 +29,9 @@ ], "depends": { - "fabricloader": ">=0.16.9", + "fabricloader": ">=0.14.21", "fabric-api": "*", - "minecraft": "~1.21.3", - "java": ">=21" + "minecraft": "~1.20", + "java": ">=17" } } diff --git a/src/main/resources/moonlight.accesswidener b/src/main/resources/moonlight.accesswidener index 2c77e65..456e433 100644 --- a/src/main/resources/moonlight.accesswidener +++ b/src/main/resources/moonlight.accesswidener @@ -1,2 +1,4 @@ accessWidener v1 named accessible method net/minecraft/client/gui/DrawContext fillGradient (IIIIIII)V +accessible field net/minecraft/client/MinecraftClient renderTickCounter Lnet/minecraft/client/render/RenderTickCounter; +mutable field net/minecraft/client/MinecraftClient renderTickCounter Lnet/minecraft/client/render/RenderTickCounter; diff --git a/src/main/resources/moonlight.mixins.json b/src/main/resources/moonlight.mixins.json index beea7f0..4644a14 100644 --- a/src/main/resources/moonlight.mixins.json +++ b/src/main/resources/moonlight.mixins.json @@ -13,8 +13,7 @@ "KeyboardMixin", "SimpleOptionMixin", "MinecraftClientMixin", - "ClientPlayerEntityMixin", - "PowderSnowBlockMixin" + "ClientPlayerEntityMixin" ], "injectors": { "defaultRequire": 1