From 395334d19528dcc5d18b4e88b9b72a83323005fb Mon Sep 17 00:00:00 2001 From: Tristan Date: Sun, 13 Jul 2025 07:58:20 -0400 Subject: [PATCH] added AnarchyFlight and AnarchySpeed implementations to respective modules, updated FullbrightModule with mode setting and potion effect support, and refactored NukerModule block breaking logic into a helper method --- .../impl/movement/flight/FlightModule.java | 4 +- .../flight/anarchy/AnarchyFlight.java | 34 +++++++++++ .../impl/movement/speed/SpeedModule.java | 5 +- .../movement/speed/anarchy/AnarchySpeed.java | 59 +++++++++++++++++++ .../module/impl/visual/FullbrightModule.java | 57 +++++++++++++++++- .../alya/module/impl/world/NukerModule.java | 36 ++++++----- 6 files changed, 175 insertions(+), 20 deletions(-) create mode 100644 src/client/java/works/alya/module/impl/movement/flight/anarchy/AnarchyFlight.java create mode 100644 src/client/java/works/alya/module/impl/movement/speed/anarchy/AnarchySpeed.java diff --git a/src/client/java/works/alya/module/impl/movement/flight/FlightModule.java b/src/client/java/works/alya/module/impl/movement/flight/FlightModule.java index d611440..7998b7c 100644 --- a/src/client/java/works/alya/module/impl/movement/flight/FlightModule.java +++ b/src/client/java/works/alya/module/impl/movement/flight/FlightModule.java @@ -18,6 +18,7 @@ import works.alya.module.Module; import works.alya.module.ModuleCategory; +import works.alya.module.impl.movement.flight.anarchy.AnarchyFlight; import works.alya.module.impl.movement.flight.ncp.NCPFlight; import works.alya.module.impl.movement.flight.vanilla.CreativeFlight; import works.alya.module.impl.movement.flight.vanilla.NormalFlight; @@ -37,7 +38,8 @@ public FlightModule() { new VerusPacketFlight(this), new VerusDamageFly(this), new VerusGlideFly(this), - new NCPFlight(this) + new NCPFlight(this), + new AnarchyFlight(this) ); } diff --git a/src/client/java/works/alya/module/impl/movement/flight/anarchy/AnarchyFlight.java b/src/client/java/works/alya/module/impl/movement/flight/anarchy/AnarchyFlight.java new file mode 100644 index 0000000..be0e409 --- /dev/null +++ b/src/client/java/works/alya/module/impl/movement/flight/anarchy/AnarchyFlight.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) Alya Client 2024-2025. + * + * This file belongs to Alya Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/AlyaClient/alya-beta.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Alya (and subsequently, its files) are all licensed under the MIT License. + * Alya should have come with a copy of the MIT License. + * If it did not, you may obtain a copy here: + * MIT License: https://opensource.org/license/mit + * + */ + +package works.alya.module.impl.movement.flight.anarchy; + +import works.alya.event.IEventListener; +import works.alya.event.impl.MotionEvent; +import works.alya.module.Module; +import works.alya.module.SubModule; + +public class AnarchyFlight extends SubModule { + public AnarchyFlight(Module parent) { + super("Anarchy", parent); + } + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { + if(!event.isPre()) return; + if(this.mc.player == null) return; + }; +} diff --git a/src/client/java/works/alya/module/impl/movement/speed/SpeedModule.java b/src/client/java/works/alya/module/impl/movement/speed/SpeedModule.java index 2bf3c3c..1cba679 100644 --- a/src/client/java/works/alya/module/impl/movement/speed/SpeedModule.java +++ b/src/client/java/works/alya/module/impl/movement/speed/SpeedModule.java @@ -18,6 +18,8 @@ import works.alya.module.Module; import works.alya.module.ModuleCategory; +import works.alya.module.impl.movement.flight.anarchy.AnarchyFlight; +import works.alya.module.impl.movement.speed.anarchy.AnarchySpeed; import works.alya.module.impl.movement.speed.blocksmc.BlocksMCSpeed; import works.alya.module.impl.movement.speed.ncp.NCPSpeed; import works.alya.module.impl.movement.speed.normal.NormalSpeed; @@ -38,7 +40,8 @@ public SpeedModule() { new VerusSpeed(this), new BlocksMCSpeed(this), new SpartanSpeed(this), - new VulcanSpeed(this) + new VulcanSpeed(this), + new AnarchySpeed(this) ); } diff --git a/src/client/java/works/alya/module/impl/movement/speed/anarchy/AnarchySpeed.java b/src/client/java/works/alya/module/impl/movement/speed/anarchy/AnarchySpeed.java new file mode 100644 index 0000000..cdb42d0 --- /dev/null +++ b/src/client/java/works/alya/module/impl/movement/speed/anarchy/AnarchySpeed.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) Alya Client 2024-2025. + * + * This file belongs to Alya Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/AlyaClient/alya-beta.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Alya (and subsequently, its files) are all licensed under the MIT License. + * Alya should have come with a copy of the MIT License. + * If it did not, you may obtain a copy here: + * MIT License: https://opensource.org/license/mit + * + */ + +package works.alya.module.impl.movement.speed.anarchy; + +import works.alya.event.IEventListener; +import works.alya.event.impl.MotionEvent; +import works.alya.module.Module; +import works.alya.module.SubModule; +import works.alya.utilities.player.MoveUtility; + +public class AnarchySpeed extends SubModule { + private static int timeElapsed = 0; + + public AnarchySpeed(Module parent) { + super("Anarchy", parent); + } + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { + if(!event.isPre()) return; + if(this.mc.player == null) return; + timeElapsed++; + + if(mc.player.isOnGround() && MoveUtility.isMoving()) { + mc.player.jump(); + } + + if(timeElapsed >= 10) { + MoveUtility.setSpeed(1f, true); + } else { + MoveUtility.setSpeed(0.28f, true); + } + + if(timeElapsed > 11) { + timeElapsed = 0; + } + }; + + @Override + public void reset() { + super.reset(); + + timeElapsed = 0; + } +} \ No newline at end of file diff --git a/src/client/java/works/alya/module/impl/visual/FullbrightModule.java b/src/client/java/works/alya/module/impl/visual/FullbrightModule.java index 6ff3c8e..14b42a5 100644 --- a/src/client/java/works/alya/module/impl/visual/FullbrightModule.java +++ b/src/client/java/works/alya/module/impl/visual/FullbrightModule.java @@ -16,6 +16,11 @@ package works.alya.module.impl.visual; +import net.minecraft.entity.effect.StatusEffectInstance; +import net.minecraft.entity.effect.StatusEffects; +import works.alya.config.setting.impl.ModeSetting; +import works.alya.event.IEventListener; +import works.alya.event.impl.TickEvent; import works.alya.module.Module; import works.alya.module.ModuleCategory; @@ -24,16 +29,62 @@ public class FullbrightModule extends Module { public FullbrightModule() { super("FullBright", "Full Bright", "Light mode for minecraft caves", ModuleCategory.VISUAL); + + ModeSetting modeSetting = new ModeSetting("Mode", "Mode", "Gamma", "Gamma", "Potion"); + + addSetting(modeSetting); } + // 1726, 104 + @SuppressWarnings("unused") + private final IEventListener tickEvent = event -> { + if(!isEnabled() || mc.player == null) return; + + String mode = ((ModeSetting) getSetting("Mode")).getValue(); + switch(mode) { + case "Gamma": { + mc.options.getGamma().setValue(1.0D); + + break; + } + + case "Potion": { + StatusEffectInstance effect = new StatusEffectInstance( + StatusEffects.NIGHT_VISION, + 1000000000, + 255, + false, + false + ); + mc.player.addStatusEffect(effect); + + break; + } + } + }; + @Override - protected void onEnable() { + public void onEnable() { previousGamma = mc.options.getGamma().getValue(); - mc.options.getGamma().setValue(1.0D); + super.onEnable(); } @Override protected void onDisable() { - mc.options.getGamma().setValue(previousGamma); + if(mc.player == null) return; + + String mode = ((ModeSetting) getSetting("Mode")).getValue(); + switch(mode) { + case "Gamma": { + mc.options.getGamma().setValue(previousGamma); + break; + } + case "Potion": { + mc.player.removeStatusEffect(net.minecraft.entity.effect.StatusEffects.NIGHT_VISION); + break; + } + } + + super.onDisable(); } } diff --git a/src/client/java/works/alya/module/impl/world/NukerModule.java b/src/client/java/works/alya/module/impl/world/NukerModule.java index a73be92..6bafcd5 100644 --- a/src/client/java/works/alya/module/impl/world/NukerModule.java +++ b/src/client/java/works/alya/module/impl/world/NukerModule.java @@ -16,6 +16,7 @@ package works.alya.module.impl.world; +import org.jetbrains.annotations.NotNull; import works.alya.config.setting.impl.BooleanSetting; import works.alya.config.setting.impl.ModeSetting; import works.alya.config.setting.impl.NumberSetting; @@ -237,21 +238,7 @@ public NukerModule() { if(bedBreakingTicks >= 3) { mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND)); - Direction face = Direction.UP; - double relativeY = mc.player.getY() - currentBedBreaking.getY(); - if(relativeY > 0.5) { - face = Direction.DOWN; - } else if(Math.abs(dx) > Math.abs(dz)) { - face = dx > 0 ? Direction.WEST : Direction.EAST; - } else { - face = dz > 0 ? Direction.NORTH : Direction.SOUTH; - } - - PlayerActionC2SPacket stopBreaking = new PlayerActionC2SPacket( - PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, - currentBedBreaking, - face - ); + PlayerActionC2SPacket stopBreaking = getPlayerActionC2SPacket(dx, dz); mc.getNetworkHandler().sendPacket(stopBreaking); currentBedBreaking = null; @@ -313,6 +300,25 @@ public NukerModule() { } }; + private @NotNull PlayerActionC2SPacket getPlayerActionC2SPacket(double dx, double dz) { + Direction face = Direction.UP; + double relativeY = mc.player.getY() - currentBedBreaking.getY(); + if(relativeY > 0.5) { + face = Direction.DOWN; + } else if(Math.abs(dx) > Math.abs(dz)) { + face = dx > 0 ? Direction.WEST : Direction.EAST; + } else { + face = dz > 0 ? Direction.NORTH : Direction.SOUTH; + } + + PlayerActionC2SPacket stopBreaking = new PlayerActionC2SPacket( + PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, + currentBedBreaking, + face + ); + return stopBreaking; + } + private boolean isNotBedBlock(Block block) { return block != Blocks.RED_BED && block != Blocks.BLACK_BED && block != Blocks.BLUE_BED && block != Blocks.BROWN_BED && block != Blocks.CYAN_BED && block != Blocks.GRAY_BED