From 69b444c3c22f830e6884fcc779bf6468c3482abd Mon Sep 17 00:00:00 2001 From: kawaiizenbo <48113593+kawaiizenbo@users.noreply.github.com> Date: Sat, 15 Jun 2024 16:38:24 -0700 Subject: [PATCH] 1.21 update update to 1.21, remove timer --- build.gradle | 8 ++++---- gradle.properties | 8 ++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- .../moonlight/command/commands/DeathPos.java | 6 +++--- .../moonlight/mixin/InGameHudMixin.java | 10 ++++------ .../moonlight/module/ModuleManager.java | 4 ++-- .../moonlight/module/modules/Step.java | 15 ++++++++++++--- .../moonlight/module/modules/Timer.java | 4 ++-- .../moonlight/ui/clickgui/CategoryPane.java | 2 +- src/main/resources/fabric.mod.json | 6 +++--- src/main/resources/moonlight.accesswidener | 2 -- 11 files changed, 36 insertions(+), 31 deletions(-) diff --git a/build.gradle b/build.gradle index e74432b..d9b0d39 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,10 @@ plugins { - id 'fabric-loom' version '1.4-SNAPSHOT' + id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 +sourceCompatibility = JavaVersion.VERSION_21 +targetCompatibility = JavaVersion.VERSION_21 archivesBaseName = project.archives_base_name version = project.mod_version @@ -47,7 +47,7 @@ processResources { tasks.withType(JavaCompile).configureEach { // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. - it.options.release = 17 + it.options.release = 21 } java { diff --git a/gradle.properties b/gradle.properties index 7ee8ad1..209feed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,9 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.20.4 - yarn_mappings=1.20.4+build.2 - loader_version=0.15.1 + minecraft_version=1.21 + yarn_mappings=1.21+build.2 + loader_version=0.15.11 # Mod Properties mod_version = 0.2.0 @@ -14,4 +14,4 @@ org.gradle.parallel=true archives_base_name = moonlight # Dependencies - fabric_version=0.91.2+1.20.4 + fabric_version=0.100.1+1.21 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e09..a80b22c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java b/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java index 665f609..af53a3b 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java +++ b/src/main/java/me/kawaiizenbo/moonlight/command/commands/DeathPos.java @@ -34,9 +34,9 @@ public class DeathPos extends Command } ChatUtils.sendMsg(ColorUtils.reset + "You last died at: " + - ColorUtils.aqua + " X: " + ColorUtils.gray + pos.getPos().getX() + - ColorUtils.aqua + " Y: " + ColorUtils.gray + pos.getPos().getY() + - ColorUtils.aqua + " Z: " + ColorUtils.gray + pos.getPos().getZ() + 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/mixin/InGameHudMixin.java b/src/main/java/me/kawaiizenbo/moonlight/mixin/InGameHudMixin.java index 44adfd1..771480b 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/mixin/InGameHudMixin.java +++ b/src/main/java/me/kawaiizenbo/moonlight/mixin/InGameHudMixin.java @@ -11,18 +11,16 @@ import me.kawaiizenbo.moonlight.ui.HUDOverlay; import me.kawaiizenbo.moonlight.ui.ModulesListOverlay; 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, float tickDelta, CallbackInfo info) + public void onRender (DrawContext drawContext, RenderTickCounter tickCounter, CallbackInfo info) { - if (ModuleManager.INSTANCE.getModuleByName("HUD").enabled) HUDOverlay.INSTANCE.render(drawContext, scaledWidth, scaledHeight); - if (ModuleManager.INSTANCE.getModuleByName("ModulesList").enabled) ModulesListOverlay.INSTANCE.render(drawContext, scaledWidth, scaledHeight); + if (ModuleManager.INSTANCE.getModuleByName("HUD").enabled) HUDOverlay.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight()); + if (ModuleManager.INSTANCE.getModuleByName("ModulesList").enabled) ModulesListOverlay.INSTANCE.render(drawContext, drawContext.getScaledWindowWidth(), drawContext.getScaledWindowHeight()); } } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/ModuleManager.java b/src/main/java/me/kawaiizenbo/moonlight/module/ModuleManager.java index e84f966..1375d4e 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/ModuleManager.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/ModuleManager.java @@ -21,8 +21,8 @@ public class ModuleManager new ModulesList(), new ChatSpammer(), new Rotation(), - new AutoJump(), - new Timer() + new AutoJump() + /*new Timer()*/ ); } 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 3fa8431..5b57ad4 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Step.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Step.java @@ -3,27 +3,36 @@ 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.GENERIC_STEP_HEIGHT).getBaseValue(); + } @Override public void tick() - { - mc.player.setStepHeight((float)stepHeight.value); + { + mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(stepHeight.value); } @Override public void onDisable() { super.onDisable(); - mc.player.setStepHeight(0.6f); + mc.player.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(old); } } diff --git a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Timer.java b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Timer.java index 9c2f1e1..c53dc0f 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/module/modules/Timer.java +++ b/src/main/java/me/kawaiizenbo/moonlight/module/modules/Timer.java @@ -19,7 +19,7 @@ public class Timer extends Module public void onEnable() { super.onEnable(); - mc.renderTickCounter = new RenderTickCounter((float)(20.0*speed.value), 0L, this::targetTickRate); + //mc.renderTickCounter = new RenderTickCounter((float)(20.0*speed.value), 0L, this::targetTickRate); current = speed.value; } @@ -33,7 +33,7 @@ public class Timer extends Module public void onDisable() { super.onDisable(); - mc.renderTickCounter = new RenderTickCounter(20.0f, 0L, this::targetTickRate); + //mc.renderTickCounter = new RenderTickCounter(20.0f, 0L, this::targetTickRate); } public float targetTickRate(float millis) 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 bea9360..9ccfb67 100644 --- a/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java +++ b/src/main/java/me/kawaiizenbo/moonlight/ui/clickgui/CategoryPane.java @@ -26,7 +26,7 @@ public class CategoryPane this.y = initialY; this.collapsed = collapsed; moduleButtons = new ArrayList(); - icon = new Identifier("moonlight", category.name.toLowerCase()); + icon = Identifier.of("moonlight", category.name.toLowerCase()); for (Module m : ModuleManager.INSTANCE.getModulesByCategory(category)) { moduleButtons.add(new ModuleButton(m)); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index e5bc7bd..c9c009b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -29,9 +29,9 @@ ], "depends": { - "fabricloader": ">=0.15.1", + "fabricloader": ">=0.15.11", "fabric-api": "*", - "minecraft": "~1.20", - "java": ">=17" + "minecraft": "~1.21", + "java": ">=21" } } diff --git a/src/main/resources/moonlight.accesswidener b/src/main/resources/moonlight.accesswidener index 456e433..2c77e65 100644 --- a/src/main/resources/moonlight.accesswidener +++ b/src/main/resources/moonlight.accesswidener @@ -1,4 +1,2 @@ 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;