From 55168ec5de7f15f6ade8b1c6cbfd395817f46b9a Mon Sep 17 00:00:00 2001 From: gjc3 Date: Thu, 26 Mar 2026 14:11:10 -0600 Subject: [PATCH 1/2] Update to Minecraft 1.21.8 + fix HUD rendering --- build.gradle | 8 ++++---- gradle.properties | 15 +++++++------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../AutomaticInfiniteElytraClient.java | 16 +++++++++------ .../io/github/autoinfelytra/Commands.java | 16 +++++++-------- .../autoinfelytra/autopilot/Autopilot.java | 8 ++++---- .../autopilot/CollisionDetectionUtil.java | 2 +- .../autopilot/FlightAnalytics.java | 14 ++++++------- .../autoinfelytra/autopilot/TraverseArea.java | 2 +- .../java/io/github/autoinfelytra/hud/HUD.java | 17 ++++++++++------ .../autoinfelytra/music/MusicPlayer.java | 20 +++++++++---------- src/main/resources/fabric.mod.json | 4 ++-- 12 files changed, 67 insertions(+), 57 deletions(-) diff --git a/build.gradle b/build.gradle index b103fee..db4c5ec 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.6-SNAPSHOT' + id 'fabric-loom' version '1.15-SNAPSHOT' id 'maven-publish' } @@ -70,7 +70,7 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } java { @@ -79,8 +79,8 @@ java { // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { diff --git a/gradle.properties b/gradle.properties index 176c083..d5d4d0f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,9 +4,10 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21 -yarn_mappings=1.21+build.2 -loader_version=0.15.11 +minecraft_version=1.21.8 +yarn_mappings=1.21.8+build.1 +loader_version=0.18.4 +loom_version=1.15-SNAPSHOT # Mod Properties mod_version=5.0.1 @@ -14,7 +15,7 @@ maven_group=io.github.autoinfelytra archives_base_name=autoinfelytra # Dependencies -fabric_version=0.100.1+1.21 -clientarguments=1.9 -yacl=3.5.0+1.21-fabric -modmenu = 11.0.0-beta.1 \ No newline at end of file +fabric_version=0.136.1+1.21.8 +clientarguments=1.11.4 +yacl=3.8.2+1.21.6-fabric +modmenu = 15.0.2 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a80b22c..bad7c24 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.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/io/github/autoinfelytra/AutomaticInfiniteElytraClient.java b/src/main/java/io/github/autoinfelytra/AutomaticInfiniteElytraClient.java index 142c3c2..98e57d6 100644 --- a/src/main/java/io/github/autoinfelytra/AutomaticInfiniteElytraClient.java +++ b/src/main/java/io/github/autoinfelytra/AutomaticInfiniteElytraClient.java @@ -11,12 +11,13 @@ import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; -import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; +import net.fabricmc.fabric.api.client.rendering.v1.hud.HudElementRegistry; import net.minecraft.client.MinecraftClient; import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; import net.minecraft.text.Text; import net.minecraft.util.Formatting; +import net.minecraft.util.Identifier; import net.minecraft.util.math.Vec3d; import org.lwjgl.glfw.GLFW; import org.slf4j.Logger; @@ -99,7 +100,10 @@ public void onInitializeClient() { if(autoFlight && AutomaticElytraConfig.HANDLER.instance().play_music) MusicPlayer.playMusic(minecraftClient.player); else if(MusicPlayer.isPlayingMusic()) MusicPlayer.stopAllMusic(); }); - HudRenderCallback.EVENT.register(HUD::drawHUD); + HudElementRegistry.addLast( + Identifier.of("autoinfelytra", "hud"), + (drawContext, tickCounter) -> HUD.drawHUD(drawContext, tickCounter) + ); AutomaticInfiniteElytraClient.instance = this; LOGGER.info("I believe I can fly..."); @@ -115,12 +119,12 @@ public static void rotatePlayer(MinecraftClient minecraftClient){ minecraftClient.player.sendMessage(Text.literal("Taking evasive action! ").formatted(Formatting.RED), true); autoFlight = false; rotationStage++; - minecraftClient.player.stopFallFlying(); + minecraftClient.player.stopGliding(); } if(rotationStage >= CollisionDetectionUtil.scanAheadTicks){ rotating = false; rotationStage = 0; - if(minecraftClient.player.checkFallFlying()) minecraftClient.player.startFallFlying(); + if(minecraftClient.player.checkGliding()) minecraftClient.player.startGliding(); } } @@ -129,7 +133,7 @@ private static void onTick() { if (minecraftClient.player != null) { rotatePlayer(minecraftClient); if (minecraftClient == null) minecraftClient = MinecraftClient.getInstance(); - if (minecraftClient.player.isFallFlying()) showHud = true; + if (minecraftClient.player.isGliding()) showHud = true; else { showHud = false; autoFlight = false; @@ -138,7 +142,7 @@ private static void onTick() { showHud = false; if (!lastPressed && keyBinding.isPressed()) { - if (minecraftClient.player.isFallFlying()) { + if (minecraftClient.player.isGliding()) { // If the player is flying an elytra, we start the auto flight autoFlight = !autoFlight; if (autoFlight) isDescending = true; diff --git a/src/main/java/io/github/autoinfelytra/Commands.java b/src/main/java/io/github/autoinfelytra/Commands.java index 2aa1e16..d4d6f29 100644 --- a/src/main/java/io/github/autoinfelytra/Commands.java +++ b/src/main/java/io/github/autoinfelytra/Commands.java @@ -39,11 +39,11 @@ private static void SetLastDestinationCommand(CommandDispatcher= coordinates.size()){ stop(); - MinecraftClient.getInstance().player.sendMessage(Text.of("Done")); + MinecraftClient.getInstance().player.sendMessage(Text.of("Done"), true); return; } Autopilot.unsetLocation(); diff --git a/src/main/java/io/github/autoinfelytra/hud/HUD.java b/src/main/java/io/github/autoinfelytra/hud/HUD.java index 0391e52..4a084fb 100644 --- a/src/main/java/io/github/autoinfelytra/hud/HUD.java +++ b/src/main/java/io/github/autoinfelytra/hud/HUD.java @@ -15,9 +15,10 @@ @Environment(EnvType.CLIENT) public class HUD { - public static final int RED_HUD_COLOR = Objects.requireNonNull(TextColor.fromFormatting(Formatting.RED)).getRgb(); - public static final int YELLOW_HUD_COLOR = Objects.requireNonNull(TextColor.fromFormatting(Formatting.YELLOW)).getRgb(); - public static final int GREEN_HUD_COLOR = Objects.requireNonNull(TextColor.fromFormatting(Formatting.GREEN)).getRgb(); + // Hardcoding because easy + public static final int RED_HUD_COLOR = 0xFFFF5555; + public static final int YELLOW_HUD_COLOR = 0xFFFFFF55; + public static final int GREEN_HUD_COLOR = 0xFF55FF55; public static ArrayList hudArray; public static int hudColor = RED_HUD_COLOR; @@ -31,10 +32,14 @@ public static void tick(){ } else hudArray = null; } public static void drawHUD(DrawContext drawContext, RenderTickCounter renderTickCounter) { - drawContext.draw(); + //drawContext.draw(); + + MinecraftClient client = MinecraftClient.getInstance(); + int sw = client.getWindow().getScaledWidth(); + int sh = client.getWindow().getScaledHeight(); - int x = (MinecraftClient.getInstance().getWindow().getWidth() * AutomaticElytraConfig.HANDLER.instance().x_coordinates_of_hud)/2000; - int y = ((MinecraftClient.getInstance().getWindow().getHeight()) * AutomaticElytraConfig.HANDLER.instance().y_coordinates_of_hud)/2000; + int x = (sw * AutomaticElytraConfig.HANDLER.instance().x_coordinates_of_hud) / 2000; + int y = (sh * AutomaticElytraConfig.HANDLER.instance().y_coordinates_of_hud) / 2000; //MinecraftClient.getInstance().player.sendMessage(Text.literal(String.valueOf((MinecraftClient.getInstance().getWindow().getHeight()))), true); diff --git a/src/main/java/io/github/autoinfelytra/music/MusicPlayer.java b/src/main/java/io/github/autoinfelytra/music/MusicPlayer.java index 866a317..07ab708 100644 --- a/src/main/java/io/github/autoinfelytra/music/MusicPlayer.java +++ b/src/main/java/io/github/autoinfelytra/music/MusicPlayer.java @@ -108,15 +108,15 @@ public static void playMusic(PlayerEntity player){ incrementMusicNumberAndWrap(); } - isPlayingMusic = isSoundPlaying(EMBARK.getId(), MinecraftClient.getInstance().getSoundManager().soundSystem) - || isSoundPlaying(SWEEPING_CLOUDS_SOUND.getId(), MinecraftClient.getInstance().getSoundManager().soundSystem) - || isSoundPlaying(SUNSHINE.getId(), MinecraftClient.getInstance().getSoundManager().soundSystem) + isPlayingMusic = isSoundPlaying(EMBARK.id(), MinecraftClient.getInstance().getSoundManager().soundSystem) + || isSoundPlaying(SWEEPING_CLOUDS_SOUND.id(), MinecraftClient.getInstance().getSoundManager().soundSystem) + || isSoundPlaying(SUNSHINE.id(), MinecraftClient.getInstance().getSoundManager().soundSystem) || isSoundPlaying(SoundEvents.MUSIC_DISC_WAIT.registryKey().getValue(), MinecraftClient.getInstance().getSoundManager().soundSystem) || isSoundPlaying(SoundEvents.MUSIC_DISC_OTHERSIDE.registryKey().getValue(), MinecraftClient.getInstance().getSoundManager().soundSystem) || isSoundPlaying(SoundEvents.MUSIC_DISC_PIGSTEP.registryKey().getValue(), MinecraftClient.getInstance().getSoundManager().soundSystem) || isSoundPlaying(SoundEvents.MUSIC_DISC_MELLOHI.registryKey().getValue(), MinecraftClient.getInstance().getSoundManager().soundSystem) - || isSoundPlaying(FEELING.getId(), MinecraftClient.getInstance().getSoundManager().soundSystem) - || isSoundPlaying(HOMESICK.getId(), MinecraftClient.getInstance().getSoundManager().soundSystem); + || isSoundPlaying(FEELING.id(), MinecraftClient.getInstance().getSoundManager().soundSystem) + || isSoundPlaying(HOMESICK.id(), MinecraftClient.getInstance().getSoundManager().soundSystem); } else { MinecraftClient.getInstance().player.sendMessage(Text.literal("Music cannot play; your master volume is 0%"), true); @@ -125,14 +125,14 @@ public static void playMusic(PlayerEntity player){ public static void stopAllMusic(){ MinecraftClient.getInstance().getSoundManager().stopSounds(SoundEvents.MUSIC_DISC_WAIT.registryKey().getValue(), SoundCategory.MASTER); - MinecraftClient.getInstance().getSoundManager().stopSounds(EMBARK.getId(), SoundCategory.MASTER); - MinecraftClient.getInstance().getSoundManager().stopSounds(SWEEPING_CLOUDS_SOUND.getId(), SoundCategory.MASTER); + MinecraftClient.getInstance().getSoundManager().stopSounds(EMBARK.id(), SoundCategory.MASTER); + MinecraftClient.getInstance().getSoundManager().stopSounds(SWEEPING_CLOUDS_SOUND.id(), SoundCategory.MASTER); MinecraftClient.getInstance().getSoundManager().stopSounds(SoundEvents.MUSIC_DISC_OTHERSIDE.registryKey().getValue(), SoundCategory.MASTER); - MinecraftClient.getInstance().getSoundManager().stopSounds(SUNSHINE.getId(), SoundCategory.MASTER); + MinecraftClient.getInstance().getSoundManager().stopSounds(SUNSHINE.id(), SoundCategory.MASTER); MinecraftClient.getInstance().getSoundManager().stopSounds(SoundEvents.MUSIC_DISC_PIGSTEP.registryKey().getValue(), SoundCategory.MASTER); MinecraftClient.getInstance().getSoundManager().stopSounds(SoundEvents.MUSIC_DISC_MELLOHI.registryKey().getValue(), SoundCategory.MASTER); - MinecraftClient.getInstance().getSoundManager().stopSounds(FEELING.getId(), SoundCategory.MASTER); - MinecraftClient.getInstance().getSoundManager().stopSounds(HOMESICK.getId(), SoundCategory.MASTER); + MinecraftClient.getInstance().getSoundManager().stopSounds(FEELING.id(), SoundCategory.MASTER); + MinecraftClient.getInstance().getSoundManager().stopSounds(HOMESICK.id(), SoundCategory.MASTER); musicNumber = 1; isPlayingMusic = false; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 83f8951..4eeb848 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -23,10 +23,10 @@ "accessWidener": "automaticinfelytra.accesswidener", "depends": { "fabricloader": ">=0.15.0", - "minecraft": ">=1.21", + "minecraft": ">=1.21.8", "java": ">=21", "fabric-api": "*", - "yet_another_config_lib_v3": ">=3.2.1" + "yet_another_config_lib_v3": ">=3.8.2" }, "suggests": { "another-mod": "*" From 5980611e16ef9aa083ca15b5272b35825e08ecd4 Mon Sep 17 00:00:00 2001 From: gjc3 Date: Thu, 26 Mar 2026 15:37:47 -0600 Subject: [PATCH 2/2] Apparently YACL 3.8.2 is broken right now, stepping back a version so this mod is usable --- gradle.properties | 2 +- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index d5d4d0f..6640d10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,5 +17,5 @@ archives_base_name=autoinfelytra # Dependencies fabric_version=0.136.1+1.21.8 clientarguments=1.11.4 -yacl=3.8.2+1.21.6-fabric +yacl=3.8.1+1.21.6-fabric modmenu = 15.0.2 \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 4eeb848..a0e7b00 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,7 +26,7 @@ "minecraft": ">=1.21.8", "java": ">=21", "fabric-api": "*", - "yet_another_config_lib_v3": ">=3.8.2" + "yet_another_config_lib_v3": ">=3.8.1" }, "suggests": { "another-mod": "*"