diff --git a/src/client/java/dev/thoq/RyeClient.java b/src/client/java/dev/thoq/RyeClient.java index 2d61527..d37fc51 100644 --- a/src/client/java/dev/thoq/RyeClient.java +++ b/src/client/java/dev/thoq/RyeClient.java @@ -18,43 +18,39 @@ import dev.thoq.command.CommandBuilder; import dev.thoq.command.CommandRepository; -import dev.thoq.command.impl.BindCommand; -import dev.thoq.command.impl.ConfigCommand; -import dev.thoq.command.impl.SettingsCommand; -import dev.thoq.command.impl.ToggleCommand; +import dev.thoq.command.impl.*; import dev.thoq.config.KeybindManager; import dev.thoq.event.EventBus; import dev.thoq.module.ModuleBuilder; import dev.thoq.module.ModuleRepository; import dev.thoq.module.impl.combat.AttackDelayModule; import dev.thoq.module.impl.combat.killaura.KillauraModule; -import dev.thoq.module.impl.movement.StrafeModule; -import dev.thoq.module.impl.movement.HighJumpModule; +import dev.thoq.module.impl.movement.*; +import dev.thoq.module.impl.utility.antivoid.AntiVoidModule; import dev.thoq.module.impl.utility.disabler.DisablerModule; import dev.thoq.module.impl.world.TickBaseModule; import dev.thoq.module.impl.movement.flight.FlightModule; import dev.thoq.module.impl.combat.VelocityModule; import dev.thoq.module.impl.movement.longjump.LongJumpModule; -import dev.thoq.module.impl.movement.ScaffoldModule; import dev.thoq.module.impl.movement.speed.SpeedModule; import dev.thoq.module.impl.world.NukerModule; import dev.thoq.module.impl.combat.ReachModule; import dev.thoq.module.impl.utility.fastplace.FastPlaceModule; import dev.thoq.module.impl.utility.nofall.NoFallModule; -import dev.thoq.module.impl.movement.JumpCooldownModule; -import dev.thoq.module.impl.movement.SprintModule; import dev.thoq.module.impl.visual.*; import dev.thoq.module.impl.world.TimerModule; import dev.thoq.module.impl.visual.clickgui.ClickGUIModule; import dev.thoq.module.impl.visual.esp.ESPModule; import dev.thoq.utilities.misc.IconLoader; import dev.thoq.utilities.misc.RyeConstants; +import dev.thoq.utilities.render.Theme; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.minecraft.client.MinecraftClient; import net.minecraft.client.util.InputUtil; +import net.minecraft.util.TimeHelper; import net.minecraft.util.math.Vec3d; import org.apache.logging.log4j.Logger; import org.lwjgl.glfw.GLFW; @@ -152,7 +148,10 @@ private static void initializeModules() { new AmbienceModule(), new DiscordRPCModule(), new DisablerModule(), - new CapeModule() + new CapeModule(), + new AntiGravityModule(), + new AntiVoidModule(), + new TargetStrafeModule() ); } @@ -162,7 +161,8 @@ private static void initializeCommands() { new ToggleCommand(), new ConfigCommand(), new BindCommand(), - new SettingsCommand() + new SettingsCommand(), + new VClipCommand() ); } diff --git a/src/client/java/dev/thoq/command/impl/VClipCommand.java b/src/client/java/dev/thoq/command/impl/VClipCommand.java new file mode 100644 index 0000000..9a11227 --- /dev/null +++ b/src/client/java/dev/thoq/command/impl/VClipCommand.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.command.impl; + +import com.mojang.brigadier.arguments.StringArgumentType; +import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.brigadier.context.CommandContext; +import dev.thoq.command.AbstractCommand; +import dev.thoq.utilities.misc.ChatUtility; +import net.minecraft.client.MinecraftClient; +import net.minecraft.server.command.CommandManager; +import net.minecraft.server.command.ServerCommandSource; + +public class VClipCommand extends AbstractCommand { + public VClipCommand() { + super("vclip"); + } + + @Override + protected void build(LiteralArgumentBuilder builder) { + builder + .then(CommandManager.argument("distance", StringArgumentType.word()) + .executes(context -> { + String distanceStr = StringArgumentType.getString(context, "distance"); + try { + int distance = Integer.parseInt(distanceStr); + teleport(distance); + return 1; + } catch(NumberFormatException e) { + return 0; + } + })) + .executes(this::usage); + } + + private int usage(CommandContext serverCommandSourceCommandContext) { + ChatUtility.sendInfo("Usage: .vclip "); + return 1; + } + + private static void teleport(int distance) { + MinecraftClient mc = MinecraftClient.getInstance(); + + if(mc.player == null) return; + + double x = mc.player.getPos().x; + double y = mc.player.getPos().y + distance; + double z = mc.player.getPos().z; + + mc.player.setPosition(x, y, z); + } +} diff --git a/src/client/java/dev/thoq/mixin/client/ui/WatermarkTitleScreenMixin.java b/src/client/java/dev/thoq/mixin/client/ui/WatermarkTitleScreenMixin.java index 3d1dadb..bc2d729 100644 --- a/src/client/java/dev/thoq/mixin/client/ui/WatermarkTitleScreenMixin.java +++ b/src/client/java/dev/thoq/mixin/client/ui/WatermarkTitleScreenMixin.java @@ -17,6 +17,7 @@ package dev.thoq.mixin.client.ui; import dev.thoq.RyeClient; +import dev.thoq.utilities.misc.RyeConstants; import dev.thoq.utilities.render.ColorUtility; import dev.thoq.utilities.render.TextRendererUtility; import net.minecraft.client.gui.*; @@ -42,18 +43,30 @@ public void onHudRender(DrawContext context, int mouseX, int mouseY, float delta @Redirect(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/LogoDrawer;draw(Lnet/minecraft/client/gui/DrawContext;IF)V")) private void renderRyeLogo(LogoDrawer logoDrawer, DrawContext context, int width, float alpha) { - // don't draw the minecraft logo - String text = "Rye"; - int x = context.getScaledWindowWidth() / 2 - TextRendererUtility.getXlTextWidth(text) / 2; - int y = Math.round(context.getScaledWindowHeight() / 4.5f); + String versionText = RyeConstants.VERSION; + + int tX = context.getScaledWindowWidth() / 2 - TextRendererUtility.getXlTextWidth(text) / 2; + int tY = Math.round(context.getScaledWindowHeight() / 4.5f); + + int vX = tX + TextRendererUtility.getXlTextWidth(text); + int vY = tY - TextRendererUtility.getXlTextHeight() * 3; TextRendererUtility.renderXlText( context, text, ColorUtility.Colors.WHITE, - x, - y, + tX, + tY, + false + ); + + TextRendererUtility.renderText( + context, + versionText, + ColorUtility.Colors.WHITE, + vX, + vY, false ); } @@ -64,8 +77,7 @@ private void replaceVersionText(DrawContext context, net.minecraft.client.font.T // we ignore demo and modded - // I think I want to stop this - // its cleaner + // I think I want to stop this-its cleaner // context.drawTextWithShadow(textRenderer, ryeVersion, x, y, color); } diff --git a/src/client/java/dev/thoq/module/SubModule.java b/src/client/java/dev/thoq/module/SubModule.java index bcf4d66..b84b553 100644 --- a/src/client/java/dev/thoq/module/SubModule.java +++ b/src/client/java/dev/thoq/module/SubModule.java @@ -1,3 +1,19 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.module; import dev.thoq.RyeClient; @@ -26,6 +42,7 @@ public void onEnable() { } public void onDisable() { + reset(); RyeClient.getEventBus().unsubscribe(this); } @@ -36,4 +53,6 @@ public void addSettings(final Setting... settings) { } } + public void reset() { + } } diff --git a/src/client/java/dev/thoq/module/impl/combat/killaura/KillauraModule.java b/src/client/java/dev/thoq/module/impl/combat/killaura/KillauraModule.java index 0850bae..b35a000 100644 --- a/src/client/java/dev/thoq/module/impl/combat/killaura/KillauraModule.java +++ b/src/client/java/dev/thoq/module/impl/combat/killaura/KillauraModule.java @@ -56,8 +56,8 @@ public class KillauraModule extends Module { private final ModeSetting attackMode = new ModeSetting("AttackMode", "Attack mode", "Single", "Single", "Switch", "Multi"); private final ModeSetting targetMode = new ModeSetting("Target", "Target types", "Players", "Players", "Passive", "Hostile", "All"); - private final NumberSetting swingDistance = new NumberSetting<>("SwingDistance", "Distance to start swinging", 4.5, 3.0, 1000.0); - private final NumberSetting reach = new NumberSetting<>("Reach", "Distance to actually attack from", 4.0, 3.0, 1000.0); + private final NumberSetting swingDistance = new NumberSetting<>("SwingDistance", "Distance to start swinging", 4.5, 3.0, 6.0); + private final NumberSetting reach = new NumberSetting<>("Reach", "Distance to actually attack from", 3.0, 3.0, 6.0); private final NumberSetting cps = new NumberSetting<>("CPS", "Attacks per second", 12, 1, 20); private final BooleanSetting noHitDelay = new BooleanSetting("NoHitDelay", "Remove attack delay", false); private final BooleanSetting raycast = new BooleanSetting("Raycast", "Check line of sight to target", true); @@ -511,6 +511,30 @@ private void stopBlocking() { isBlocking = false; } + /** + * Get the current attack mode for Target Strafe integration + * @return Current attack mode + */ + public String getAttackMode() { + return attackMode.getValue(); + } + + /** + * Get the current target for Target Strafe integration + * @return Current target entity + */ + public Entity getCurrentTarget() { + return currentTarget; + } + + /** + * Check if the module has valid targets + * @return true if there are valid targets + */ + public boolean hasTargets() { + return !targets.isEmpty(); + } + @Override protected void onEnable() { if(mc.player != null) { diff --git a/src/client/java/dev/thoq/module/impl/movement/AntiGravityModule.java b/src/client/java/dev/thoq/module/impl/movement/AntiGravityModule.java new file mode 100644 index 0000000..e695fcd --- /dev/null +++ b/src/client/java/dev/thoq/module/impl/movement/AntiGravityModule.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.module.impl.movement; + +import dev.thoq.event.IEventListener; +import dev.thoq.event.impl.MotionEvent; +import dev.thoq.module.Module; +import dev.thoq.module.ModuleCategory; +import dev.thoq.utilities.player.TimerUtility; + +public class AntiGravityModule extends Module { + public AntiGravityModule() { + super("AntiGravity", "Anti-Gravity", "Makes you feel like you're on the moon", ModuleCategory.MOVEMENT); + } + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { + if(mc.player == null) return; + + if(event.isPre()) { + if(mc.player.isOnGround()) + TimerUtility.setTimerSpeed(0.97); + else + TimerUtility.setTimerSpeed(0.87658); + } + }; + + @Override + public void onDisable() { + if(mc.player == null) return; + + TimerUtility.resetTimer(); + } +} diff --git a/src/client/java/dev/thoq/module/impl/movement/ScaffoldModule.java b/src/client/java/dev/thoq/module/impl/movement/ScaffoldModule.java index c12126d..e43efc3 100644 --- a/src/client/java/dev/thoq/module/impl/movement/ScaffoldModule.java +++ b/src/client/java/dev/thoq/module/impl/movement/ScaffoldModule.java @@ -16,6 +16,7 @@ package dev.thoq.module.impl.movement; +import dev.thoq.RyeClient; import dev.thoq.config.setting.impl.BooleanSetting; import dev.thoq.config.setting.impl.ModeSetting; import dev.thoq.config.setting.impl.NumberSetting; @@ -37,7 +38,6 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.RaycastContext; @@ -50,6 +50,7 @@ public class ScaffoldModule extends Module { private final BooleanSetting swing = new BooleanSetting("Swing", "Swing arm when placing blocks", true); private final BooleanSetting rotate = new BooleanSetting("Rotate", "Rotate towards block placement", true); private final BooleanSetting tower = new BooleanSetting("Tower", "Enable tower mode when jumping", true); + private final BooleanSetting keepY = new BooleanSetting("KeepY", "Keep same Y position when placing blocks", false); private final NumberSetting searchRange = new NumberSetting<>("Search Range", "Block search radius", 3, 1, 6); private final NumberSetting bruteForceRayCastIntensity = new NumberSetting<>("Brute Force Intensity", "Intensity of rotation calculation", 5, 1, 10); @@ -62,8 +63,8 @@ public class ScaffoldModule extends Module { private BlockCache blockCache, lastBlockCache; private int startSlot, slot, lastSlot; - private long lastPlaceTime = 0; private float yaw, pitch; + private double keepYLevel = -1; public ScaffoldModule() { super("Scaffold", "Automatically bridges for you", ModuleCategory.WORLD); @@ -76,7 +77,8 @@ public ScaffoldModule() { addSetting(switchItemMode); addSetting(swing); addSetting(swingMode.setVisibilityCondition(swing::getValue)); - addSetting(tower); + addSetting(keepY.setVisibilityCondition(() -> !tower.getValue())); + addSetting(tower.setVisibilityCondition(() -> !keepY.getValue())); addSetting(towerMode.setVisibilityCondition(tower::getValue)); addSetting(towerSpeed.setVisibilityCondition(() -> tower.getValue() && towerMode.getValue().equals("Vanilla"))); } @@ -90,6 +92,10 @@ protected void onEnable() { slot = lastSlot = -1; blockCache = lastBlockCache = null; + if(keepY.getValue()) { + keepYLevel = Math.floor(mc.player.getY()) - 1; + } + yaw = getYaw() + 180; pitch = 80; } @@ -105,33 +111,36 @@ protected void onDisable() { mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(startSlot)); } } + + keepYLevel = -1; } @SuppressWarnings("unused") private final IEventListener motionEvent = event -> { if(mc.player == null || mc.world == null) return; - slot = findBlockSlot(); + if(event.isPre()) { + slot = findBlockSlot(); + + if(sprint.getValue() && MoveUtility.isMoving()) { + mc.player.setSprinting(true); + MoveUtility.setSpeed(MoveUtility.getVanillaPlayerSprintSpeed()); + } else { + mc.player.setSprinting(false); + MoveUtility.setSpeed(MoveUtility.getVanillaPlayerSpeed()); + } - if(sprint.getValue() && MoveUtility.isMoving()) { - mc.player.setSprinting(true); - MoveUtility.setSpeed(0.2873); - } else { - mc.player.setSprinting(false); - MoveUtility.setSpeed(0.2); - } + if(slot != -1) { + if(switchItemMode.getValue().equals("Client") && mc.player.getInventory().getSelectedSlot() != slot) { + mc.player.getInventory().setSelectedSlot(slot); + } - if(slot != -1) { - if(switchItemMode.getValue().equals("Client") && mc.player.getInventory().getSelectedSlot() != slot) { - mc.player.getInventory().setSelectedSlot(slot); - } - if(switchItemMode.getValue().equals("Server") && lastSlot != slot && mc.getNetworkHandler() != null) { - mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(slot)); - lastSlot = slot; + if(switchItemMode.getValue().equals("Server") && lastSlot != slot && mc.getNetworkHandler() != null) { + mc.getNetworkHandler().sendPacket(new UpdateSelectedSlotC2SPacket(slot)); + lastSlot = slot; + } } - } - if(event.isPre()) { blockCache = getBlockCache(); if(blockCache != null) lastBlockCache = blockCache; @@ -150,19 +159,19 @@ protected void onDisable() { mc.player.setVelocity(mc.player.getVelocity().x * 0.91f, mc.player.getVelocity().y, mc.player.getVelocity().z * 0.91f); } - if(tower.getValue() && mc.options.jumpKey.isPressed() && blockCache != null) { + if(!keepY.getValue() && tower.getValue() && mc.options.jumpKey.isPressed() && blockCache != null) { handleTower(); } - } - if(event.isPost() && lastBlockCache != null && slot != -1) { - placeBlock(); + if(lastBlockCache != null && slot != -1) { + placeBlock(); + } } }; @SuppressWarnings("unused") private final IEventListener packetSendEvent = event -> { - if(event.getPacket() instanceof UpdateSelectedSlotC2SPacket packet) { + if(event.getPacket() instanceof UpdateSelectedSlotC2SPacket packet && event.isPre()) { if(switchItemMode.getValue().equals("Server")) { startSlot = packet.getSelectedSlot(); event.cancel(); @@ -251,11 +260,16 @@ private void updateRotations() { private float getDirectionYaw(Direction direction) { switch(direction) { - case NORTH: return 0; - case SOUTH: return 180; - case WEST: return 90; - case EAST: return 270; - default: return getYaw(); + case NORTH: + return 0; + case SOUTH: + return 180; + case WEST: + return 90; + case EAST: + return 270; + default: + return getYaw(); } } @@ -315,7 +329,9 @@ private void handleTower() { private BlockCache getBlockCache() { if(mc.player == null || mc.world == null) return null; - BlockPos belowBlockPos = BlockPos.ofFloored(mc.player.getPos().subtract(0, 1, 0)); + double targetY = keepY.getValue() ? keepYLevel : mc.player.getY() - 1; + BlockPos belowBlockPos = new BlockPos((int) Math.floor(mc.player.getX()), (int) Math.floor(targetY), (int) Math.floor(mc.player.getZ())); + if(!mc.world.getBlockState(belowBlockPos).isAir()) return null; for(int x = 0; x < searchRange.getValue(); x++) { @@ -386,4 +402,4 @@ public Direction getEnumFacing() { return enumFacing; } } -} +} \ No newline at end of file diff --git a/src/client/java/dev/thoq/module/impl/movement/TargetStrafe.java b/src/client/java/dev/thoq/module/impl/movement/TargetStrafe.java deleted file mode 100644 index d08b48a..0000000 --- a/src/client/java/dev/thoq/module/impl/movement/TargetStrafe.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Rye Client 2024-2025. - * - * This file belongs to Rye Client, - * an open-source Fabric injection client. - * Rye GitHub: https://github.com/RyeClient/rye-v1.git - * - * THIS PROJECT DOES NOT HAVE A WARRANTY. - * - * Rye (and subsequently, its files) are all licensed under the MIT License. - * Rye 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 dev.thoq.module.impl.movement; - -import dev.thoq.config.setting.impl.BooleanSetting; -import dev.thoq.config.setting.impl.ModeSetting; -import dev.thoq.config.setting.impl.NumberSetting; -import dev.thoq.module.Module; -import dev.thoq.module.ModuleCategory; -import net.minecraft.entity.Entity; - -// todo: unbork (implement) -public class TargetStrafe extends Module { - private final ModeSetting targetMode = new ModeSetting("Target", "Target types", "Players", "Players", "Passive", "Hostile", "All"); - private final NumberSetting range = new NumberSetting<>("Range", "Distance from target to strafe", 3.0f, 0.1f, 6.0f); - private final NumberSetting speed = new NumberSetting<>("Speed", "Strafe speed", 0.28f, 0.1f, 1.0f); - private final BooleanSetting adaptiveSpeed = new BooleanSetting("Adaptive Speed", "Adjust speed based on distance", true); - private final BooleanSetting jumpStrafe = new BooleanSetting("Jump Strafe", "Allow strafing in air", false); - - private Entity currentTarget = null; - private float strafeDirection = 1.0f; - private int directionChangeTimer = 0; - - public TargetStrafe() { - super("TargetStrafe", "Target Strafe", "Automatically move around targets", ModuleCategory.MOVEMENT); - addSetting(targetMode); - addSetting(range); - addSetting(speed); - addSetting(adaptiveSpeed); - addSetting(jumpStrafe); - } -} \ No newline at end of file diff --git a/src/client/java/dev/thoq/module/impl/movement/TargetStrafeModule.java b/src/client/java/dev/thoq/module/impl/movement/TargetStrafeModule.java new file mode 100644 index 0000000..20b952b --- /dev/null +++ b/src/client/java/dev/thoq/module/impl/movement/TargetStrafeModule.java @@ -0,0 +1,247 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.module.impl.movement; + +import dev.thoq.RyeClient; +import dev.thoq.config.setting.impl.BooleanSetting; +import dev.thoq.config.setting.impl.ModeSetting; +import dev.thoq.config.setting.impl.NumberSetting; +import dev.thoq.event.IEventListener; +import dev.thoq.event.impl.MotionEvent; +import dev.thoq.module.Module; +import dev.thoq.module.ModuleCategory; +import dev.thoq.module.impl.combat.killaura.KillauraModule; +import net.minecraft.entity.Entity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.mob.HostileEntity; +import net.minecraft.entity.passive.PassiveEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.math.Vec3d; + +import java.util.Comparator; +import java.util.List; + +public class TargetStrafeModule extends Module { + private final ModeSetting targetMode = new ModeSetting("Target", "Target types", "Players", "Players", "Passive", "Hostile", "All"); + private final NumberSetting range = new NumberSetting<>("Range", "Distance from target to strafe", 3.0f, 0.1f, 6.0f); + private final NumberSetting speed = new NumberSetting<>("Speed", "Strafe speed", 0.28f, 0.1f, 1.0f); + private final BooleanSetting adaptiveSpeed = new BooleanSetting("Adaptive Speed", "Adjust speed based on distance", true); + private final BooleanSetting jumpStrafe = new BooleanSetting("Jump Strafe", "Allow strafing in air", false); + private final BooleanSetting onlyWhenKillaura = new BooleanSetting("Only with Killaura", "Only strafe when Killaura is enabled", true); + private final BooleanSetting autoJump = new BooleanSetting("Auto Jump", "Jump while strafing", false); + private final NumberSetting jumpChance = new NumberSetting<>("Jump Chance", "Chance to jump while strafing", 0.1f, 0.01f, 1.0f); + + private Entity currentTarget = null; + private float strafeDirection = 1.0f; + private int directionChangeTimer = 0; + private int jumpTimer = 0; + + public TargetStrafeModule() { + super("TargetStrafeModule", "Target Strafe", "Automatically move around targets", ModuleCategory.MOVEMENT); + + jumpChance.setVisibilityCondition(autoJump::getValue); + + addSetting(targetMode); + addSetting(range); + addSetting(speed); + addSetting(adaptiveSpeed); + addSetting(jumpStrafe); + addSetting(onlyWhenKillaura); + addSetting(autoJump); + addSetting(jumpChance); + } + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { + if (mc.player == null || mc.world == null || !event.isPre()) return; + + if (onlyWhenKillaura.getValue()) { + KillauraModule killaura = RyeClient.INSTANCE.getModuleRepository().getModule(KillauraModule.class); + if (killaura == null || !killaura.isEnabled()) { + currentTarget = null; + return; + } + + String attackMode = killaura.getAttackMode(); + if (attackMode.equals("Single") || attackMode.equals("Switch")) { + Entity killauraTarget = killaura.getCurrentTarget(); + + if (killauraTarget != null) { + currentTarget = killauraTarget; + } else if (currentTarget != null && isValidStrafeTarget(currentTarget)) { + } else { + currentTarget = null; + } + } else { + currentTarget = null; + return; + } + } else { + findTarget(); + } + + if (currentTarget == null) return; + + if (!shouldStrafe()) return; + + performStrafe(); + + if (autoJump.getValue() && shouldJump()) { + mc.player.jump(); + } + }; + + private boolean isValidStrafeTarget(Entity entity) { + if (mc.player == null || entity == null || !entity.isAlive()) return false; + + double distance = mc.player.distanceTo(entity); + if (distance > range.getValue() * 1.5) return false; + + return isValidTarget(entity); + } + + private void findTarget() { + if (mc.player == null || mc.world == null) return; + + List entities = mc.world.getEntitiesByClass(Entity.class, + mc.player.getBoundingBox().expand(range.getValue()), + this::isValidTarget); + + if (entities.isEmpty()) { + currentTarget = null; + return; + } + + entities.sort(Comparator.comparingDouble(entity -> entity.squaredDistanceTo(mc.player))); + currentTarget = entities.getFirst(); + } + + private boolean isValidTarget(Entity entity) { + if (mc.player == null) return false; + if (!(entity instanceof LivingEntity) || entity == mc.player || !entity.isAlive()) { + return false; + } + + double distance = mc.player.distanceTo(entity); + if (distance > range.getValue()) return false; + + return switch (targetMode.getValue()) { + case "Players" -> entity instanceof PlayerEntity; + case "Passive" -> entity instanceof PassiveEntity; + case "Hostile" -> entity instanceof HostileEntity; + case "All" -> entity instanceof PlayerEntity || entity instanceof PassiveEntity || entity instanceof HostileEntity; + default -> false; + }; + } + + private boolean shouldStrafe() { + if (mc.player == null || currentTarget == null) return false; + + if (!currentTarget.isAlive()) { + currentTarget = null; + return false; + } + + double distance = mc.player.distanceTo(currentTarget); + + if (distance > range.getValue() * 1.2) { + currentTarget = null; + return false; + } + + return mc.player.isOnGround() || jumpStrafe.getValue(); + } + + private void performStrafe() { + if (mc.player == null || currentTarget == null) return; + + Vec3d playerPos = mc.player.getPos(); + Vec3d targetPos = currentTarget.getPos(); + + double deltaX = targetPos.x - playerPos.x; + double deltaZ = targetPos.z - playerPos.z; + + float angleToTarget = (float) Math.toDegrees(Math.atan2(deltaZ, deltaX)) - 90.0f; + + float strafeAngle = angleToTarget + (90.0f * strafeDirection); + + if (directionChangeTimer++ >= 60) { + strafeDirection = -strafeDirection; + directionChangeTimer = 0; + } + + float currentSpeed = speed.getValue(); + + if (adaptiveSpeed.getValue()) { + double distance = mc.player.distanceTo(currentTarget); + float targetDistance = range.getValue() * 0.7f; + float distanceRatio = (float) (distance / targetDistance); + + if (distanceRatio < 0.8f) { + currentSpeed *= 1.2f; + } else if (distanceRatio > 1.2f) { + currentSpeed *= 0.8f; + } + } + + double radians = Math.toRadians(strafeAngle); + double xMotion = -Math.sin(radians) * currentSpeed; + double zMotion = Math.cos(radians) * currentSpeed; + + Vec3d currentVelocity = mc.player.getVelocity(); + mc.player.setVelocity(xMotion, currentVelocity.y, zMotion); + } + + private boolean shouldJump() { + if (mc.player == null) return false; + + if (!mc.player.isOnGround()) return false; + + if (jumpTimer > 0) { + jumpTimer--; + return false; + } + + if (Math.random() > jumpChance.getValue()) return false; + + jumpTimer = 10; + return true; + } + + @Override + protected void onEnable() { + currentTarget = null; + directionChangeTimer = 0; + jumpTimer = 0; + strafeDirection = 1.0f; + } + + @Override + protected void onDisable() { + currentTarget = null; + directionChangeTimer = 0; + jumpTimer = 0; + } + + public Entity getCurrentTarget() { + return currentTarget; + } + + public boolean isStrafing() { + return isEnabled() && currentTarget != null; + } +} \ No newline at end of file diff --git a/src/client/java/dev/thoq/module/impl/movement/flight/FlightModule.java b/src/client/java/dev/thoq/module/impl/movement/flight/FlightModule.java index 17bbb50..4566efa 100644 --- a/src/client/java/dev/thoq/module/impl/movement/flight/FlightModule.java +++ b/src/client/java/dev/thoq/module/impl/movement/flight/FlightModule.java @@ -25,14 +25,19 @@ import dev.thoq.module.impl.movement.flight.verus.VerusPacketFlight; import net.minecraft.client.option.GameOptions; -@SuppressWarnings("unchecked") public class FlightModule extends Module { private boolean wasSprinting = false; public FlightModule() { super("Flight", "Become airplane", ModuleCategory.MOVEMENT); - this.addSubmodules(new NormalFlight(this), new CreativeFlight(this), new VerusPacketFlight(this), new VerusDamageFly(this), new VerusGlideFly(this)); + this.addSubmodules( + new NormalFlight(this), + new CreativeFlight(this), + new VerusPacketFlight(this), + new VerusDamageFly(this), + new VerusGlideFly(this) + ); } @Override diff --git a/src/client/java/dev/thoq/module/impl/movement/flight/vanilla/NormalFlight.java b/src/client/java/dev/thoq/module/impl/movement/flight/vanilla/NormalFlight.java index 0aaf1f4..cc68aa4 100644 --- a/src/client/java/dev/thoq/module/impl/movement/flight/vanilla/NormalFlight.java +++ b/src/client/java/dev/thoq/module/impl/movement/flight/vanilla/NormalFlight.java @@ -53,7 +53,7 @@ else if(down) } if(this.preventVanillaKick.getValue() && !verticalMovement) - MoveUtility.setMotionY(MoveUtility.getVanillaFallingSpeed()); + MoveUtility.setMotionY(MoveUtility.getVanillaFallingSpeed() + 0.05); else if(!verticalMovement) MoveUtility.setMotionY(0); diff --git a/src/client/java/dev/thoq/module/impl/movement/flight/verus/VerusGlideFly.java b/src/client/java/dev/thoq/module/impl/movement/flight/verus/VerusGlideFly.java index 0c16adf..d594c97 100644 --- a/src/client/java/dev/thoq/module/impl/movement/flight/verus/VerusGlideFly.java +++ b/src/client/java/dev/thoq/module/impl/movement/flight/verus/VerusGlideFly.java @@ -23,7 +23,6 @@ import dev.thoq.module.SubModule; import dev.thoq.utilities.misc.ChatUtility; import dev.thoq.utilities.player.MoveUtility; -import net.minecraft.client.MinecraftClient; public class VerusGlideFly extends SubModule { @@ -37,11 +36,18 @@ public VerusGlideFly(final Module parent) { this.addSettings(this.clip); } + @SuppressWarnings("unused") private final IEventListener onMotion = event -> { if(!event.isPre()) return; if(mc.player == null) return; + + if(mc.player.isOnGround()) { + ChatUtility.sendError("Please be in air before toggling!"); + return; + } + if(!messageSent) { - ChatUtility.sendWarning("This fly does *NOT* new Verus, only old cracked versions!"); + ChatUtility.sendWarning("This fly may not work on new Verus (its iffy), it does work on old cracked versions!"); messageSent = true; } @@ -51,13 +57,13 @@ public VerusGlideFly(final Module parent) { timeRunning++; - if(clip.getValue() && timeRunning >= 80) { - mc.player.setPosition(posX, posY + 1, posZ); + if(clip.getValue() && timeRunning >= 90) { + mc.player.setPosition(posX, posY + 2, posZ); timeRunning = 0; } MoveUtility.setMotionY(-0.02); - MoveUtility.setSpeed(0.1); + MoveUtility.setSpeed(0.3, true); }; @Override diff --git a/src/client/java/dev/thoq/module/impl/movement/longjump/verus/VerusPacketLongjump.java b/src/client/java/dev/thoq/module/impl/movement/longjump/verus/VerusPacketLongjump.java index dff09bc..204988c 100644 --- a/src/client/java/dev/thoq/module/impl/movement/longjump/verus/VerusPacketLongjump.java +++ b/src/client/java/dev/thoq/module/impl/movement/longjump/verus/VerusPacketLongjump.java @@ -27,7 +27,7 @@ import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; public class VerusPacketLongjump extends SubModule { - + private final PlayerUtility playerUtility = new PlayerUtility(); static boolean jumped = false; static boolean damaged = false; static boolean waitingForGround = false; @@ -40,7 +40,7 @@ public VerusPacketLongjump(final Module parent) { if(mc.player == null) return; if(!damaged && !waitingForGround) { - PlayerUtility.applyDamage(mc, 3); + playerUtility.applyDamage(mc, 3); damaged = true; waitingForGround = true; } diff --git a/src/client/java/dev/thoq/module/impl/movement/speed/SpeedModule.java b/src/client/java/dev/thoq/module/impl/movement/speed/SpeedModule.java index 0ae171e..7b06134 100644 --- a/src/client/java/dev/thoq/module/impl/movement/speed/SpeedModule.java +++ b/src/client/java/dev/thoq/module/impl/movement/speed/SpeedModule.java @@ -21,6 +21,7 @@ import dev.thoq.module.impl.movement.speed.blocksmc.BlocksMCSpeed; import dev.thoq.module.impl.movement.speed.ncp.NCPSpeed; import dev.thoq.module.impl.movement.speed.normal.NormalSpeed; +import dev.thoq.module.impl.movement.speed.spartan.SpartanSpeed; import dev.thoq.module.impl.movement.speed.verus.VerusSpeed; import dev.thoq.utilities.player.TimerUtility; @@ -34,7 +35,8 @@ public SpeedModule() { new NormalSpeed(this), new NCPSpeed(this), new VerusSpeed(this), - new BlocksMCSpeed(this) + new BlocksMCSpeed(this), + new SpartanSpeed(this) ); } diff --git a/src/client/java/dev/thoq/module/impl/movement/speed/spartan/SpartanSpeed.java b/src/client/java/dev/thoq/module/impl/movement/speed/spartan/SpartanSpeed.java new file mode 100644 index 0000000..6490c5c --- /dev/null +++ b/src/client/java/dev/thoq/module/impl/movement/speed/spartan/SpartanSpeed.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.module.impl.movement.speed.spartan; + +import dev.thoq.event.IEventListener; +import dev.thoq.event.impl.MotionEvent; +import dev.thoq.module.Module; +import dev.thoq.module.SubModule; +import dev.thoq.utilities.misc.ChatUtility; +import dev.thoq.utilities.player.MoveUtility; + +public class SpartanSpeed extends SubModule { + private int ticks = 0; + + public SpartanSpeed(Module parent) { + super("Spartan", parent); + } + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { + if(!event.isPre()) return; + if(this.mc.player == null) return; + + if(mc.player.isOnGround()) { + ticks = 0; + } else { + ticks++; + + if(ticks == 1) { + if(MoveUtility.getSpeed() < 0.8) { + MoveUtility.setSpeed(0.8, true); + } else { + MoveUtility.setSpeed(MoveUtility.getSpeed() * 2.5, true); + } + } + } + }; + + @Override + public void reset() { + ticks = 0; + } +} diff --git a/src/client/java/dev/thoq/module/impl/movement/speed/verus/VerusSpeed.java b/src/client/java/dev/thoq/module/impl/movement/speed/verus/VerusSpeed.java index 0509f9a..2f9c717 100644 --- a/src/client/java/dev/thoq/module/impl/movement/speed/verus/VerusSpeed.java +++ b/src/client/java/dev/thoq/module/impl/movement/speed/verus/VerusSpeed.java @@ -41,7 +41,7 @@ public VerusSpeed(final Module parent) { return; if(forwardOnly) - MoveUtility.setSpeed(0.29f, true); + MoveUtility.setSpeed(0.285f, true); else MoveUtility.setSpeed(0.26f, true); diff --git a/src/client/java/dev/thoq/module/impl/utility/antivoid/AntiVoidModule.java b/src/client/java/dev/thoq/module/impl/utility/antivoid/AntiVoidModule.java new file mode 100644 index 0000000..4a558ac --- /dev/null +++ b/src/client/java/dev/thoq/module/impl/utility/antivoid/AntiVoidModule.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.module.impl.utility.antivoid; + +import dev.thoq.module.Module; +import dev.thoq.module.ModuleCategory; +import dev.thoq.module.impl.utility.antivoid.position.PositionAntiVoid; + +public class AntiVoidModule extends Module { + public AntiVoidModule() { + super("AntiVoid", "Anti-Void", "Prevents you from falling in the void", ModuleCategory.UTILITY); + + this.addSubmodules( + new PositionAntiVoid(this) + ); + } + + @Override + public void onEnable() { + super.onEnable(); + } + + @Override + public void onDisable() { + super.onDisable(); + } +} diff --git a/src/client/java/dev/thoq/module/impl/utility/antivoid/position/PositionAntiVoid.java b/src/client/java/dev/thoq/module/impl/utility/antivoid/position/PositionAntiVoid.java new file mode 100644 index 0000000..f230b06 --- /dev/null +++ b/src/client/java/dev/thoq/module/impl/utility/antivoid/position/PositionAntiVoid.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.module.impl.utility.antivoid.position; + +import dev.thoq.config.setting.impl.NumberSetting; +import dev.thoq.event.IEventListener; +import dev.thoq.event.impl.MotionEvent; +import dev.thoq.module.Module; +import dev.thoq.module.SubModule; +import dev.thoq.utilities.misc.ChatUtility; +import dev.thoq.utilities.player.PlayerUtility; + +/** + * @author slqnt + * @since 0.1 + */ +public class PositionAntiVoid extends SubModule { + private final PlayerUtility playerUtility = new PlayerUtility(); + private final NumberSetting distance = new NumberSetting<>("Distance", "Distance to check for void", 4, 1, 10); + + public PositionAntiVoid(Module parent) { + super("Position", parent); + + this.addSettings(distance); + } + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { + if(mc.player == null || !event.isPre()) return; + + boolean isOverVoid = playerUtility.isOverVoid(); + boolean isFalling = mc.player.fallDistance > distance.getValue(); + + ChatUtility.sendDebug("Is over void:" + isOverVoid); + ChatUtility.sendDebug("Is falling:" + isFalling); + if(isFalling && isOverVoid) { + event.setY(event.getY() + mc.player.fallDistance); + } + }; + +} diff --git a/src/client/java/dev/thoq/module/impl/utility/disabler/DisablerModule.java b/src/client/java/dev/thoq/module/impl/utility/disabler/DisablerModule.java index 297296c..525ed30 100644 --- a/src/client/java/dev/thoq/module/impl/utility/disabler/DisablerModule.java +++ b/src/client/java/dev/thoq/module/impl/utility/disabler/DisablerModule.java @@ -16,48 +16,30 @@ package dev.thoq.module.impl.utility.disabler; -import dev.thoq.config.setting.impl.MultipleBooleanSetting; -import dev.thoq.event.IEventListener; -import dev.thoq.event.impl.MotionEvent; -import dev.thoq.event.impl.PacketSendEvent; -import dev.thoq.event.impl.TickEvent; import dev.thoq.module.Module; import dev.thoq.module.ModuleCategory; import dev.thoq.module.impl.utility.disabler.cubecraft.CubecraftDisabler; import dev.thoq.module.impl.utility.disabler.omnisprint.OmniSprintDisabler; -import io.netty.util.internal.SuppressJava6Requirement; +import dev.thoq.module.impl.utility.disabler.spartan.SpartanDisabler; public class DisablerModule extends Module { - private final OmniSprintDisabler omniSprintDisabler = new OmniSprintDisabler(); - private final CubecraftDisabler cubecraftDisabler = new CubecraftDisabler(); - - private final MultipleBooleanSetting disabler = new MultipleBooleanSetting("Mode", "Disabler mode", "OmniSprint", "Cubecraft"); - public DisablerModule() { super("Disabler", "Partially or fully disable some anticheats", ModuleCategory.UTILITY); - addSetting(disabler); + this.addSubmodules( + new SpartanDisabler(this), + new OmniSprintDisabler(this), + new CubecraftDisabler(this) + ); } - @SuppressWarnings("unused") - private final IEventListener tickEvent = event -> { - if(disabler.getEnabledOptions().size() > 1) - setPrefix("Multi"); - else - setPrefix(disabler.getEnabledOptions().getFirst()); - }; - - @SuppressWarnings({"unused"}) - private final IEventListener packetSendEvent = event -> { - if(disabler.isEnabled("OmniSprint")) { - omniSprintDisabler.omniSprintDisabler(event, mc); - } - }; + @Override + public void onEnable() { + super.onEnable(); + } - @SuppressWarnings("unused") - private final IEventListener motionEvent = event -> { - if(disabler.isEnabled("Cubecraft")) { - cubecraftDisabler.cubecraftDisabler(event, mc); - } - }; -} \ No newline at end of file + @Override + public void onDisable() { + super.onDisable(); + } +} diff --git a/src/client/java/dev/thoq/module/impl/utility/disabler/cubecraft/CubecraftDisabler.java b/src/client/java/dev/thoq/module/impl/utility/disabler/cubecraft/CubecraftDisabler.java index 4990897..c004e8d 100644 --- a/src/client/java/dev/thoq/module/impl/utility/disabler/cubecraft/CubecraftDisabler.java +++ b/src/client/java/dev/thoq/module/impl/utility/disabler/cubecraft/CubecraftDisabler.java @@ -16,13 +16,22 @@ package dev.thoq.module.impl.utility.disabler.cubecraft; +import dev.thoq.event.IEventListener; import dev.thoq.event.impl.MotionEvent; +import dev.thoq.event.impl.PacketSendEvent; +import dev.thoq.module.Module; +import dev.thoq.module.SubModule; import net.minecraft.client.MinecraftClient; -public class CubecraftDisabler { - public void cubecraftDisabler(MotionEvent event, MinecraftClient mc) { +public class CubecraftDisabler extends SubModule { + public CubecraftDisabler(Module parent) { + super("Cubecraft", parent); + } + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { if(mc.player == null) return; event.setOnGround(mc.player.age % 2 == 0); - } + }; } diff --git a/src/client/java/dev/thoq/module/impl/utility/disabler/omnisprint/OmniSprintDisabler.java b/src/client/java/dev/thoq/module/impl/utility/disabler/omnisprint/OmniSprintDisabler.java index 887c4b8..7c951df 100644 --- a/src/client/java/dev/thoq/module/impl/utility/disabler/omnisprint/OmniSprintDisabler.java +++ b/src/client/java/dev/thoq/module/impl/utility/disabler/omnisprint/OmniSprintDisabler.java @@ -16,14 +16,21 @@ package dev.thoq.module.impl.utility.disabler.omnisprint; +import dev.thoq.event.IEventListener; import dev.thoq.event.impl.PacketSendEvent; -import net.minecraft.client.MinecraftClient; +import dev.thoq.module.Module; +import dev.thoq.module.SubModule; import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; -public class OmniSprintDisabler { +public class OmniSprintDisabler extends SubModule { private static boolean serverSprintState = false; - public void omniSprintDisabler(PacketSendEvent event, MinecraftClient mc) { + public OmniSprintDisabler(Module parent) { + super("OmniSprint", parent); + } + + @SuppressWarnings("unused") + private final IEventListener packetSendEvent = event -> { if(mc.player == null || mc.getNetworkHandler() == null) return; if(event.getPacket() instanceof ClientCommandC2SPacket packet) { @@ -37,5 +44,5 @@ public void omniSprintDisabler(PacketSendEvent event, MinecraftClient mc) { event.cancel(); } } - } + }; } \ No newline at end of file diff --git a/src/client/java/dev/thoq/module/impl/utility/disabler/spartan/SpartanDisabler.java b/src/client/java/dev/thoq/module/impl/utility/disabler/spartan/SpartanDisabler.java new file mode 100644 index 0000000..586a305 --- /dev/null +++ b/src/client/java/dev/thoq/module/impl/utility/disabler/spartan/SpartanDisabler.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.module.impl.utility.disabler.spartan; + +import dev.thoq.event.IEventListener; +import dev.thoq.event.impl.MotionEvent; +import dev.thoq.module.Module; +import dev.thoq.module.SubModule; +import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket; +import net.minecraft.util.Hand; + +public class SpartanDisabler extends SubModule { + private static int timeRunning = 0; + + public SpartanDisabler(Module parent) { + super("Spartan", parent); + } + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { + if(mc.player == null || mc.getNetworkHandler() == null) return; + if(!event.isPre()) return; + + timeRunning++; + + PlayerInteractItemC2SPacket playerInteractItemC2SPacket = new PlayerInteractItemC2SPacket( + Hand.MAIN_HAND, + 0, + mc.player.getYaw(), + mc.player.getPitch() + ); + + if(timeRunning > 20) { + mc.getNetworkHandler().sendPacket(playerInteractItemC2SPacket); + timeRunning = 0; + } + }; + + @Override + public void reset() { + timeRunning = 0; + } +} diff --git a/src/client/java/dev/thoq/module/impl/visual/ArraylistModule.java b/src/client/java/dev/thoq/module/impl/visual/ArraylistModule.java index 6b02db4..b47ea88 100644 --- a/src/client/java/dev/thoq/module/impl/visual/ArraylistModule.java +++ b/src/client/java/dev/thoq/module/impl/visual/ArraylistModule.java @@ -88,16 +88,14 @@ private int getWaveColor(int index, int totalModules) { float time = System.currentTimeMillis() / 1000.0f; float waveOffset = (float) index / Math.max(1, totalModules - 1); float phase = time * 2.0f + waveOffset * 4.0f; - - Theme currentTheme = Theme.getCurrentTheme(); float factor = (float) (Math.sin(phase) + 1.0) / 2.0f; - return Theme.interpolateColorInt(currentTheme.getPrimaryColor(), currentTheme.getSecondaryColor(), factor); + return Theme.getInterpolatedColors(factor); } /** - * Gets the full display name for a module including any prefixes - * Format: ModuleName [ModulePrefix] + * Gets the full display name for a module including any suffixes + * Format: ModuleName [Suffix] */ private String getModuleDisplayName(Module module) { StringBuilder displayName = new StringBuilder(); diff --git a/src/client/java/dev/thoq/module/impl/visual/DebugModule.java b/src/client/java/dev/thoq/module/impl/visual/DebugModule.java index 923677b..e7e40b4 100644 --- a/src/client/java/dev/thoq/module/impl/visual/DebugModule.java +++ b/src/client/java/dev/thoq/module/impl/visual/DebugModule.java @@ -19,6 +19,7 @@ import dev.thoq.RyeClient; import dev.thoq.config.setting.impl.BooleanSetting; import dev.thoq.event.IEventListener; +import dev.thoq.event.impl.MotionEvent; import dev.thoq.event.impl.PacketReceiveEvent; import dev.thoq.module.Module; import dev.thoq.module.ModuleCategory; @@ -27,21 +28,33 @@ @SuppressWarnings("FieldCanBeLocal") public class DebugModule extends Module { private final BooleanSetting packetLog = new BooleanSetting("Packets", "Log all packets to console, may lag game", false); + private final BooleanSetting motionLog = new BooleanSetting("Motion", "Log motion values to console, may lag game", false); public DebugModule() { super("Debug", "Shows debug info-only of intrest to developers", ModuleCategory.VISUAL); addSetting(packetLog); + addSetting(motionLog); - if(RyeClient.getType().equals("Development")) { + if(RyeClient.getType().equals("Development") || RyeClient.getType().equals("Beta")) { this.setEnabled(true); } } + @SuppressWarnings("unused") private final IEventListener packetEvent = event -> { boolean packetLogEnabled = ((BooleanSetting) getSetting("Packets")).getValue(); if(packetLogEnabled) ChatUtility.sendDebug(event.getPacket().toString()); }; + + @SuppressWarnings("unused") + private final IEventListener motionEvent = event -> { + if(!motionLog.getValue() || mc.player == null) return; + + ChatUtility.sendDebug("X=" + mc.player.getVelocity().x); + ChatUtility.sendDebug("Y=" + mc.player.getVelocity().y); + ChatUtility.sendDebug("Z=" + mc.player.getVelocity().z); + }; } diff --git a/src/client/java/dev/thoq/module/impl/visual/HUDModule.java b/src/client/java/dev/thoq/module/impl/visual/HUDModule.java index 6773542..b1dafb0 100644 --- a/src/client/java/dev/thoq/module/impl/visual/HUDModule.java +++ b/src/client/java/dev/thoq/module/impl/visual/HUDModule.java @@ -17,395 +17,184 @@ package dev.thoq.module.impl.visual; import dev.thoq.RyeClient; -import dev.thoq.config.setting.impl.ModeSetting; import dev.thoq.event.IEventListener; import dev.thoq.event.impl.Render2DEvent; import dev.thoq.module.Module; import dev.thoq.module.ModuleCategory; -import dev.thoq.module.impl.world.NukerModule; -import dev.thoq.module.impl.combat.ReachModule; import dev.thoq.utilities.render.ColorUtility; import dev.thoq.utilities.render.RenderUtility; import dev.thoq.utilities.render.TextRendererUtility; import dev.thoq.utilities.render.Theme; -import org.jetbrains.annotations.NotNull; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.Vec3d; +import org.joml.Vector4f; -import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Date; import java.util.List; -@SuppressWarnings({"FieldCanBeLocal", "SameParameterValue", "unused"}) public class HUDModule extends Module { - - private long animationStartTime = 0; - private boolean isAnimatingIn = false; - private boolean isAnimatingOut = false; - private boolean wasVisible = false; - private static final long ANIMATION_DURATION = 200; - private static final int END_Y_POSITION = 30; - private static String lastDynamicText = ""; - private final ModeSetting themeSetting; - private int targetModuleCount = 0; - private float currentModuleCount = 0; - private long expansionStartTime = 0; - private boolean isExpanding = false; - private static final long EXPANSION_DURATION = 300; + private final List bpsHistory = new ArrayList<>(); public HUDModule() { super("HUD", "Shows Heads Up Display", ModuleCategory.VISUAL); - String[] themeNames = Theme.getThemeNames(); - this.themeSetting = new ModeSetting("Theme", "Select the theme for the HUD", "Rye", themeNames); - this.addSetting(themeSetting); - this.setEnabled(true); } - private enum Mode { - NORMAL, - SCAFFOLD, - SPEED, - FLIGHT, - KILLAURA, - NUKER, - REACH, - } - + @SuppressWarnings("unused") private final IEventListener renderEvent = event -> { if(mc.player == null) return; - boolean killauraEnabled = RyeClient.INSTANCE.getModuleRepository().getModuleByName("Killaura").isEnabled(); - boolean scaffoldEnabled = RyeClient.INSTANCE.getModuleRepository().getModuleByName("Scaffold").isEnabled(); - boolean speedEnabled = RyeClient.INSTANCE.getModuleRepository().getModuleByName("Speed").isEnabled(); - boolean flightEnabled = RyeClient.INSTANCE.getModuleRepository().getModuleByName("Flight").isEnabled(); - boolean nukerEnabled = RyeClient.INSTANCE.getModuleRepository().getModuleByName("Nuker").isEnabled(); - boolean reachEnabled = RyeClient.INSTANCE.getModuleRepository().getModuleByName("Reach").isEnabled(); - - List dynamicTexts = new ArrayList<>(); - String bps = RyeClient.getBps(); - - if(flightEnabled || speedEnabled) { - String speedFlightMsg = String.format("Going %s b/s", bps); - dynamicTexts.add(speedFlightMsg); - } - - if(scaffoldEnabled) { - int scaffoldSlot = mc.player.getInventory().getSelectedSlot(); - int blocksRemaining = mc.player.getInventory().getStack(scaffoldSlot).getCount(); - String scaffoldMsg = String.format("%s Remaining", blocksRemaining); - dynamicTexts.add(scaffoldMsg); - } + final int padding = 7; + final int xPosition = 4; + final int yPosition = 2; + final Vector4f radius = new Vector4f(10f, 10f, 10f, 10f); + final int rectWidth = 200; + final int rectHeight = 120; + final int maxHistorySize = 200; - if(killauraEnabled) { - String killauraMsg = String.format("%.1f/%.1f ♡", - mc.player.getHealth() / 2, mc.player.getMaxHealth() / 2); - dynamicTexts.add(killauraMsg); - } + RenderUtility.drawImage( + Identifier.of("rye", "images/rye_logo_white.png"), + xPosition, + yPosition, + xPosition + padding * 6, + yPosition + padding * 3, + xPosition + padding * 6, + yPosition + padding * 3, + event.getContext() + ); - if(nukerEnabled) { - String nukerMsg = String.format("%s blocks destroyed", NukerModule.getBlocksDestroyed()); - dynamicTexts.add(nukerMsg); - } + RenderUtility.drawGradientRoundedRect( + event.getContext(), + xPosition, + yPosition + (padding * 5), + rectWidth, + rectHeight, + radius, + Theme.COLOR$1, + Theme.COLOR$2 + ); - if(reachEnabled) { - String reachMsg = String.format("Reached %.1f blocks", ReachModule.getLastReach()); - dynamicTexts.add(reachMsg); - } + String currentBps = RyeClient.getBps(); + double bpsValue = Double.parseDouble(currentBps); - int newModuleCount = dynamicTexts.size(); - if(newModuleCount != targetModuleCount) { - targetModuleCount = newModuleCount; - startExpansionAnimation(); + bpsHistory.add(bpsValue); + if(bpsHistory.size() > maxHistorySize) { + bpsHistory.removeFirst(); } - updateExpansionAnimation(); + int contentX = xPosition + padding; + int contentY = yPosition + (padding * 5) + 10; + int graphY; + int graphHeight = 30; + int graphWidth = rectWidth - (padding * 6); + int cordsY = mc.getWindow().getScaledHeight() - 10; + Vec3d position = mc.player.getPos(); + String cordsText = String.format("XYZ: %.1f %.1f %.1f", position.x, position.y, position.z); + contentY += 3; + + TextRendererUtility.renderMdText( + event.getContext(), + "Statistics", + ColorUtility.Colors.WHITE, + contentX, + contentY, + false + ); - String time = RyeClient.getTime(); - String fps = RyeClient.getFps(); - String name = mc.player.getName().getString(); + contentY += TextRendererUtility.getMdTextHeight() + (padding * 2); - String clientName = createAnimatedClientName(); + TextRendererUtility.renderText( + event.getContext(), + "FPS: " + RyeClient.getFps(), + ColorUtility.Colors.WHITE, + contentX, + contentY, + false + ); - boolean shouldShowDynamic = !dynamicTexts.isEmpty(); + contentY += TextRendererUtility.getTextHeight() + 2; - if(shouldShowDynamic && !wasVisible) { - startShowAnimation(); - } else if(!shouldShowDynamic && wasVisible) { - startHideAnimation(); - } - - wasVisible = shouldShowDynamic; + TextRendererUtility.renderText( + event.getContext(), + "BPS: " + currentBps, + ColorUtility.Colors.WHITE, + contentX, + contentY, + false + ); - if(shouldShowDynamic || isAnimatingOut) { - drawAnimatedDynamicModules( - dynamicTexts, - event - ); - } + contentY += 20; - String displayText = String.format( - " %s | %s f/s | %s | %s", - clientName, - fps, - name, - time + TextRendererUtility.renderText( + event.getContext(), + "Speed Monitor", + ColorUtility.Colors.WHITE, + contentX, + contentY, + false ); - final int padding = 15; - final int textWidth = TextRendererUtility.getTextWidth(displayText); - final int textHeight = mc.textRenderer.fontHeight; - final int xPosition = 2; - final int yPosition = 2; - - int backgroundColor = ColorUtility.getColor(ColorUtility.Colors.PANEL); + contentY += TextRendererUtility.getTextHeight() + 2; + graphY = contentY; RenderUtility.drawRect( event.getContext(), - xPosition, - yPosition, - textWidth + padding, - textHeight + padding, - backgroundColor - ); - - renderAnimatedHUDText( - event, - displayText, - xPosition + padding / 2, - yPosition + padding / 2 + contentX, + graphY, + graphWidth, + graphHeight, + 0x44FFFFFF ); - }; - - private void startExpansionAnimation() { - expansionStartTime = System.currentTimeMillis(); - isExpanding = true; - } - - private void updateExpansionAnimation() { - if(!isExpanding) return; - - long elapsed = System.currentTimeMillis() - expansionStartTime; - float progress = Math.min(elapsed / (float) EXPANSION_DURATION, 1.0f); - float easedProgress = 1.0f - (float) Math.pow(1.0f - progress, 3); + if(bpsHistory.size() > 1) { + double maxBps = bpsHistory.stream().mapToDouble(d -> d).max().orElse(10.0); + maxBps = Math.max(maxBps, 10.0); - currentModuleCount = currentModuleCount + (targetModuleCount - currentModuleCount) * easedProgress; + for(int i = 1; i < bpsHistory.size(); i++) { + double prevBps = bpsHistory.get(i - 1); + double currBps = bpsHistory.get(i); - if(progress >= 1.0f) { - currentModuleCount = targetModuleCount; - isExpanding = false; - } - } - - private String createAnimatedClientName() { - return "§r§l" + RyeClient.getName() + "§r"; - } - - private void renderAnimatedHUDText(Render2DEvent event, String text, int x, int y) { - float time = System.currentTimeMillis() / 1000.0f; - float animationFactor = (float) (Math.sin(time * 2.0) + 1.0) / 2.0f; + int x1 = contentX + (int)((double)(i - 1) / (bpsHistory.size() - 1) * graphWidth); + int y1 = graphY + graphHeight - (int)(prevBps / maxBps * graphHeight); + int x2 = contentX + (int)((double)i / (bpsHistory.size() - 1) * graphWidth); + int y2 = graphY + graphHeight - (int)(currBps / maxBps * graphHeight); - String[] parts = text.split("§theme"); - if(parts.length > 1) { - if(!parts[0].isEmpty()) { - TextRendererUtility.renderText( + RenderUtility.drawLine( event.getContext(), - parts[0], - ColorUtility.Colors.WHITE, - x, - y, - false + x1, y1, x2, y2, + 2f, + ColorUtility.getColor(ColorUtility.Colors.WHITE) ); } - - int firstPartWidth = parts[0].isEmpty() ? 0 : TextRendererUtility.getTextWidth(parts[0]); - - String firstChar = String.valueOf(parts[1].charAt(0)); - int themeColor = Theme.getInterpolatedThemeColorInt(animationFactor); - - TextRendererUtility.renderText( - event.getContext(), - "§l" + firstChar, - themeColor, - x + firstPartWidth, - y, - false - ); - - int firstCharWidth = TextRendererUtility.getTextWidth("§l" + firstChar); - - String remainingText = "§r§l" + parts[1].substring(1) + "§r"; - TextRendererUtility.renderText( - event.getContext(), - remainingText, - ColorUtility.Colors.WHITE, - x + firstPartWidth + firstCharWidth, - y, - false - ); - } else { - TextRendererUtility.renderText( - event.getContext(), - text, - ColorUtility.Colors.WHITE, - x, - y, - false - ); - } - } - - private void startShowAnimation() { - animationStartTime = System.currentTimeMillis(); - isAnimatingIn = true; - isAnimatingOut = false; - } - - private void startHideAnimation() { - animationStartTime = System.currentTimeMillis(); - isAnimatingIn = false; - isAnimatingOut = true; - } - - private float getAnimationProgress() { - long elapsed = System.currentTimeMillis() - animationStartTime; - float progress = Math.min(elapsed / (float) ANIMATION_DURATION, 1.0f); - - return 1.0f - (float) Math.pow(1.0f - progress, 3); - } - - private void drawAnimatedDynamicModules( - List dynamicTexts, - Render2DEvent event - ) { - if(mc.player == null || dynamicTexts.isEmpty()) return; - - float progress = getAnimationProgress(); - - if(progress >= 1.0f) { - if(isAnimatingOut) { - isAnimatingOut = false; - return; - } - if(isAnimatingIn) { - isAnimatingIn = false; - } - } - - float animatedProgress; - if(isAnimatingIn) { - animatedProgress = progress; - } else if(isAnimatingOut) { - animatedProgress = 1.0f - progress; - } else { - animatedProgress = 1.0f; } - final int hudPadding = 15; - final int hudTextWidth = TextRendererUtility.getTextWidth(String.format( - " %s | %s f/s | %s | %s", - createAnimatedClientName(), - RyeClient.getFps(), - mc.player.getName().getString(), - new SimpleDateFormat("hh:mm a").format(new Date()) - )); - - final int hudBottomY = 2 + mc.textRenderer.fontHeight + hudPadding; - final int startY = hudBottomY - 10; - final int animatedY = (int) (startY + (END_Y_POSITION - startY) * animatedProgress); - - int alpha = (int) (255 * animatedProgress); - int baseBackgroundColor = ColorUtility.getColor(ColorUtility.Colors.PANEL); - - String displayText = getString(dynamicTexts); - - final int dynamicPadding = 15; - final int dynamicTextWidth = TextRendererUtility.getTextWidth(displayText); - final int dynamicWidth = dynamicTextWidth + dynamicPadding; - final int screenWidth = mc.getWindow().getScaledWidth(); - final int hudX = 2; - final int maxAllowedX = screenWidth - dynamicWidth; - final int alignedX = Math.min(hudX, maxAllowedX); - - drawDynamicRect( - displayText, - event, - alignedX, - animatedY, - dynamicPadding, - baseBackgroundColor, - alpha + String maxLabel = String.format("%.1f", bpsHistory.stream().mapToDouble(d -> d).max().orElse(10.0)); + TextRendererUtility.renderText( + event.getContext(), + maxLabel, + ColorUtility.Colors.LIGHT_GRAY, + contentX + graphWidth + 5, + graphY, + false ); - } - - private @NotNull String getString(List dynamicTexts) { - int modulesToShow = Math.min(dynamicTexts.size(), (int) Math.ceil(currentModuleCount)); - - StringBuilder combinedText = new StringBuilder(); - for(int i = 0; i < modulesToShow; i++) { - if(i > 0) combinedText.append(" | "); - - String moduleText = dynamicTexts.get(i); - - if(i >= (int) currentModuleCount) { - float partialProgress = currentModuleCount - (int) currentModuleCount; - int charactersToShow = (int) (moduleText.length() * partialProgress); - if(charactersToShow > 0) { - combinedText.append(moduleText, 0, Math.min(charactersToShow, moduleText.length())); - } - } else { - combinedText.append(moduleText); - } - } - - return combinedText.toString(); - } - - private int applyAlpha(int color, int alpha) { - int r = (color >> 16) & 0xFF; - int g = (color >> 8) & 0xFF; - int b = color & 0xFF; - int originalAlpha = (color >> 24) & 0xFF; - int combinedAlpha = (originalAlpha * alpha) / 255; - - return (combinedAlpha << 24) | (r << 16) | (g << 8) | b; - } - - private static void drawDynamicRect( - String displayText, - Render2DEvent event, - int xPosition, - int yPosition, - int padding, - int backgroundColor, - int textAlpha - ) { - int textWidth = TextRendererUtility.getTextWidth(displayText); - int textHeight = TextRendererUtility.getTextHeight(); - - lastDynamicText = displayText; - - RenderUtility.drawRect( + TextRendererUtility.renderText( event.getContext(), - xPosition, - yPosition, - textWidth + padding, - textHeight + padding, - backgroundColor + "0.0", + ColorUtility.Colors.LIGHT_GRAY, + contentX + graphWidth + 5, + graphY + graphHeight - TextRendererUtility.getTextHeight(), + false ); - int textColor = ColorUtility.getColor(ColorUtility.Colors.WHITE); - int animatedTextColor = (textAlpha << 24) | (textColor & 0x00FFFFFF); - TextRendererUtility.renderText( event.getContext(), - displayText, - animatedTextColor, - xPosition + padding / 2, - yPosition + padding / 2, - true + cordsText, + ColorUtility.Colors.WHITE, + xPosition - 1, + cordsY, + false ); - } + }; } \ No newline at end of file diff --git a/src/client/java/dev/thoq/module/impl/visual/clickgui/dropdown/DropDownClickGUI.java b/src/client/java/dev/thoq/module/impl/visual/clickgui/dropdown/DropDownClickGUI.java index c481f99..a558e5e 100644 --- a/src/client/java/dev/thoq/module/impl/visual/clickgui/dropdown/DropDownClickGUI.java +++ b/src/client/java/dev/thoq/module/impl/visual/clickgui/dropdown/DropDownClickGUI.java @@ -57,20 +57,18 @@ public class DropDownClickGUI extends Screen { private static final int BACKGROUND_COLOR = ColorUtility.getColor(ColorUtility.Colors.GRAY); private static final int CATEGORY_COLOR = 0xFF222222; private static final int HOVER_COLOR = 0x10FFFFFF; - private static final float CORNER_RADIUS = 5.0f; + private static final float CORNER_RADIUS = 4f; private static final int TOOLTIP_BACKGROUND = 0xFF000000; private static final int TOOLTIP_BORDER = 0xFF212121; private static final int TOOLTIP_MAX_WIDTH = 200; private static final int TOOLTIP_PADDING = 2; private static final int TOOLTIP_OFFSET = 10; - private String hoveredTooltip = null; private int tooltipX = 0; private int tooltipY = 0; private final boolean showTooltips; private int scrollOffset = 0; private ModuleCategory draggingCategory = null; - private boolean draggingNumberSetting = false; private NumberSetting currentDraggedNumberSetting = null; private int sliderStartX = 0; @@ -109,10 +107,6 @@ private void initializeModules() { @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { - if(Theme.get("Rye") == null) { - Theme.init(); - } - hoveredTooltip = null; for(Map.Entry> entry : categorizedModules.entrySet()) { @@ -170,9 +164,8 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { } if(module.isEnabled()) { - Theme currentTheme = Theme.getCurrentTheme(); - int primaryColor = currentTheme.getPrimaryColorInt(); - int secondaryColor = currentTheme.getSecondaryColorInt(); + int primaryColor = Theme.COLOR$1; + int secondaryColor = Theme.COLOR$2; primaryColor = primaryColor | 0xFF000000; secondaryColor = secondaryColor | 0xFF000000; @@ -302,7 +295,7 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { int filledWidth = (int) (sliderWidth * percentage); if(filledWidth > 0) { - RenderUtility.drawRoundedRect(context, sliderX, sliderY, filledWidth, sliderHeight, new Vector4f(2, 2, 2, 2), Theme.getCurrentTheme().getPrimaryColorInt()); + RenderUtility.drawRoundedRect(context, sliderX, sliderY, filledWidth, sliderHeight, new Vector4f(2, 2, 2, 2), Theme.COLOR$1); } int knobSize = 10; @@ -378,7 +371,8 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) { dropdownWidth - 4, optionHeight - 4, new Vector4f(3, 3, 3, 3), - Theme.getCurrentTheme().getPrimaryColorInt()); + Theme.COLOR$1 + ); int checkboxSize = 8; int checkboxX = dropdownX + dropdownWidth - checkboxSize - 5; diff --git a/src/client/java/dev/thoq/utilities/misc/ChatUtility.java b/src/client/java/dev/thoq/utilities/misc/ChatUtility.java index 027e17c..390dcf7 100644 --- a/src/client/java/dev/thoq/utilities/misc/ChatUtility.java +++ b/src/client/java/dev/thoq/utilities/misc/ChatUtility.java @@ -27,6 +27,7 @@ @SuppressWarnings("unused") public class ChatUtility { private static final MinecraftClient mc = MinecraftClient.getInstance(); + private static final String RYE = "§5Rye§r"; /** * Sends a formatted message to the player @@ -36,17 +37,17 @@ public class ChatUtility { */ public static void sendMessage(String message, Formatting formatting) { if(mc.player != null) { + String newMessage = String.format("%s %s", RYE, message.replace("»", "§0»")); MutableText text = Text.literal(message).setStyle(Style.EMPTY.withColor(formatting)); mc.player.sendMessage(text, false); } } - public static void sendDebug(String message) { boolean debug = RyeClient.INSTANCE.getModuleRepository().getModule(DebugModule.class).isEnabled(); if(mc.player != null && debug) { - MutableText text = Text.literal("DEBUG >> " + message); + MutableText text = Text.literal("Debug » " + message); mc.player.sendMessage(text, false); } } @@ -66,7 +67,7 @@ public static void sendMessage(String message) { * @param message The error message */ public static void sendError(String message) { - sendMessage("Error: " + message, Formatting.RED); + sendMessage("Error » " + message, Formatting.RED); } /** @@ -107,7 +108,7 @@ public static void sendWarning(String message) { public static void sendPrefixedMessage(String prefix, String message, Formatting prefixFormatting, Formatting messageFormatting) { if(mc.player == null) return; - MutableText prefixText = Text.literal("[" + prefix + "] ").setStyle(Style.EMPTY.withColor(prefixFormatting)); + MutableText prefixText = Text.literal(RYE + " " + prefix + " » ").setStyle(Style.EMPTY.withColor(prefixFormatting)); MutableText messageText = Text.literal(message).setStyle(Style.EMPTY.withColor(messageFormatting)); mc.player.sendMessage(prefixText.append(messageText), false); } diff --git a/src/client/java/dev/thoq/utilities/misc/DoubleBlockPos.java b/src/client/java/dev/thoq/utilities/misc/DoubleBlockPos.java new file mode 100644 index 0000000..df7b19b --- /dev/null +++ b/src/client/java/dev/thoq/utilities/misc/DoubleBlockPos.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) Rye Client 2024-2025. + * + * This file belongs to Rye Client, + * an open-source Fabric injection client. + * Rye GitHub: https://github.com/RyeClient/rye-v1.git + * + * THIS PROJECT DOES NOT HAVE A WARRANTY. + * + * Rye (and subsequently, its files) are all licensed under the MIT License. + * Rye 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 dev.thoq.utilities.misc; + +import net.minecraft.util.math.BlockPos; + +public record DoubleBlockPos(double x, double y, double z) { + + public BlockPos toBlockPos() { + return new BlockPos((int) x, (int) y, (int) z); + } +} \ No newline at end of file diff --git a/src/client/java/dev/thoq/utilities/misc/RyeConstants.java b/src/client/java/dev/thoq/utilities/misc/RyeConstants.java index ea50f70..f43cfa6 100644 --- a/src/client/java/dev/thoq/utilities/misc/RyeConstants.java +++ b/src/client/java/dev/thoq/utilities/misc/RyeConstants.java @@ -18,7 +18,7 @@ public class RyeConstants { public static final String NAME = "Rye"; - public static final String VERSION = "0.1.27"; + public static final String VERSION = "0.1"; public static final String KIND = "Beta"; public static final String BUILD_NUMBER = "070225.5"; } diff --git a/src/client/java/dev/thoq/utilities/player/MoveUtility.java b/src/client/java/dev/thoq/utilities/player/MoveUtility.java index a1da54a..e0d90d4 100644 --- a/src/client/java/dev/thoq/utilities/player/MoveUtility.java +++ b/src/client/java/dev/thoq/utilities/player/MoveUtility.java @@ -22,6 +22,8 @@ @SuppressWarnings("unused") public class MoveUtility { private static final double VANILLA_PLAYER_FALL_MOTION = -0.0784000015258789; + private static final double VANILLA_PLAYER_SPEED = 0.11681545167924458; + private static final double VANILLA_PLAYER_SPRINT_SPEED = 0.1523673105277881; /** * Sets the player's movement speed @@ -197,4 +199,41 @@ public static void setMotionZ(double z) { public static double getVanillaFallingSpeed() { return VANILLA_PLAYER_FALL_MOTION; } + + /** + * Retrieves the default movement speed value for a vanilla player. + * + * @return The standard speed value for vanilla player movement. + */ + public static double getVanillaPlayerSpeed() { + return VANILLA_PLAYER_SPEED; + } + + /** + * Retrieves the default sprinting speed value for a vanilla player. + * + * @return The standard sprint speed defined for vanilla player mechanics. + */ + public static double getVanillaPlayerSprintSpeed() { + return VANILLA_PLAYER_SPRINT_SPEED; + } + + /** + * Calculates the square of the horizontal speed of the player. + * The computation is based on the player's velocity along the X and Z axes. + * If the player instance is null, the method will return 0.0. + * + * @return The squared horizontal speed of the player, or 0.0 if the player is not present. + */ + public static double getSpeed() { + MinecraftClient mc = MinecraftClient.getInstance(); + ClientPlayerEntity player = mc.player; + + if(player == null) return 0.0; + + double motionX = player.getVelocity().x; + double motionZ = player.getVelocity().z; + + return motionX * motionX + motionZ * motionZ; + } } diff --git a/src/client/java/dev/thoq/utilities/player/PlayerUtility.java b/src/client/java/dev/thoq/utilities/player/PlayerUtility.java index 724b9f7..e7bcf61 100644 --- a/src/client/java/dev/thoq/utilities/player/PlayerUtility.java +++ b/src/client/java/dev/thoq/utilities/player/PlayerUtility.java @@ -16,12 +16,16 @@ package dev.thoq.utilities.player; +import dev.thoq.utilities.misc.DoubleBlockPos; +import net.minecraft.block.AirBlock; +import net.minecraft.block.Block; import net.minecraft.client.MinecraftClient; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; +import net.minecraft.util.math.BlockPos; public class PlayerUtility { - public static void applyDamage(MinecraftClient mc, int height) { + public void applyDamage(MinecraftClient mc, int height) { if(mc.player == null || mc.getNetworkHandler() == null) return; double x = mc.player.getX(); @@ -35,4 +39,30 @@ public static void applyDamage(MinecraftClient mc, int height) { mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.Full(x, baseY + height, z, yaw, pitch, onGround, horizontalCollision)); mc.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.Full(x, baseY, z, yaw, pitch, false, horizontalCollision)); } + + /** + * @return true if the player is over void, false otherwise + * @author slqnt + * @since 0.1 + */ + public boolean isOverVoid() { + MinecraftClient mc = MinecraftClient.getInstance(); + + if(mc.player == null) return false; + if(mc.world == null) return false; + + if(!mc.player.isOnGround()) { + for(double y = mc.player.getPos().y - 1; y >= 0.0; y--) { + BlockPos blockPos = new DoubleBlockPos(mc.player.getPos().x, y, mc.player.getPos().z).toBlockPos(); + Block block = mc.world.getBlockState(blockPos).getBlock(); + + if(!(block instanceof AirBlock)) + return false; + } + + return true; + } + + return false; + } } diff --git a/src/client/java/dev/thoq/utilities/render/RenderUtility.java b/src/client/java/dev/thoq/utilities/render/RenderUtility.java index 60edb13..7903456 100644 --- a/src/client/java/dev/thoq/utilities/render/RenderUtility.java +++ b/src/client/java/dev/thoq/utilities/render/RenderUtility.java @@ -29,6 +29,25 @@ public class RenderUtility { private static final MinecraftClient MC = MinecraftClient.getInstance(); + /** + * Represents the four corners of a rectangle. + *

+ * This enum is used to specify which corner of a rectangle is being targeted + * for rendering or calculation tasks in graphical operations. The enumeration + * includes: + * - TOP_LEFT: The top-left corner of a rectangle. + * - TOP_RIGHT: The top-right corner of a rectangle. + * - BOTTOM_RIGHT: The bottom-right corner of a rectangle. + * - BOTTOM_LEFT: The bottom-left corner of a rectangle. + *

+ * It is typically utilized in graphical rendering methods to define or modify + * specific corners of a rounded rectangle, such as drawing filled or outlined + * corners, calculating pixel coverage, or rendering individual corner details. + */ + private enum CornerType { + TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT + } + /** * Draws a filled rounded rectangle with the specified position, dimensions, corner radius, and color. * @@ -270,22 +289,76 @@ public static void drawRoundedRectOutline(DrawContext context, float x, float y, } public static void drawGradientRoundedRect(DrawContext context, int x, int y, int width, int height, Vector4f radius, int colorLeft, int colorRight) { - for (int i = 0; i < width; i++) { - float factor = (float) i / width; + int cornerSize = (int) Math.max(Math.max(radius.x, radius.y), Math.max(radius.z, radius.w)); + int segments = Math.max(width / 2, 1); + + for(int i = 0; i < segments; i++) { + int segmentStartX = x + (i * width) / segments; + int segmentEndX = x + ((i + 1) * width) / segments; + int segmentWidth = segmentEndX - segmentStartX; + + float factor = segments > 1 ? (float) i / (segments - 1) : 0.0f; int interpolatedColor = ColorUtility.interpolateColor(colorLeft, colorRight, factor); - Vector4f columnRadius = new Vector4f(0, 0, 0, 0); - - if (i == 0) { - columnRadius.x = radius.x; - columnRadius.w = radius.w; + context.fill(segmentStartX, y + (int) Math.max(radius.x, radius.y), + segmentEndX, y + height - (int) Math.max(radius.z, radius.w), interpolatedColor); + } + + for(int i = 0; i < segments; i++) { + int segmentStartX = x + (i * width) / segments; + int segmentEndX = x + ((i + 1) * width) / segments; + + float factor = segments > 1 ? (float) i / (segments - 1) : 0.0f; + int interpolatedColor = ColorUtility.interpolateColor(colorLeft, colorRight, factor); + + int topStartX = Math.max(segmentStartX, x + (int) radius.x); + int topEndX = Math.min(segmentEndX, x + width - (int) radius.y); + if(topStartX < topEndX) { + context.fill(topStartX, y, topEndX, y + (int) Math.max(radius.x, radius.y), interpolatedColor); } - if (i == width - 1) { - columnRadius.y = radius.y; - columnRadius.z = radius.z; + + int bottomStartX = Math.max(segmentStartX, x + (int) radius.w); + int bottomEndX = Math.min(segmentEndX, x + width - (int) radius.z); + if(bottomStartX < bottomEndX) { + context.fill(bottomStartX, y + height - (int) Math.max(radius.z, radius.w), + bottomEndX, y + height, interpolatedColor); } + } + + drawGradientCorner(context, x, y, (int) radius.x, colorLeft, CornerType.TOP_LEFT); + drawGradientCorner(context, x + width - (int) radius.y, y, (int) radius.y, colorRight, CornerType.TOP_RIGHT); + drawGradientCorner(context, x + width - (int) radius.z, y + height - (int) radius.z, (int) radius.z, colorRight, CornerType.BOTTOM_RIGHT); + drawGradientCorner(context, x, y + height - (int) radius.w, (int) radius.w, colorLeft, CornerType.BOTTOM_LEFT); + } + + /** + * Draws a single corner with anti-aliasing and the specified color. + * This method uses the same anti-aliasing technique as your existing drawCorner method. + */ + private static void drawGradientCorner(DrawContext context, int x, int y, int radius, int color, CornerType corner) { + if(radius <= 0) return; + + int baseAlpha = (color >> 24) & 0xFF; + int red = (color >> 16) & 0xFF; + int green = (color >> 8) & 0xFF; + int blue = color & 0xFF; + + for(int py = 0; py < radius; py++) { + for(int px = 0; px < radius; px++) { + float coverage = getPixelCoverage(px, py, radius, corner); + + if(coverage > 0) { + int alpha = (int) (baseAlpha * coverage); + if(alpha > 0) { + int pixelColor = (alpha << 24) | (red << 16) | (green << 8) | blue; - drawRoundedRect(context, x + i, y, 1, height, columnRadius, interpolatedColor); + int drawX = x + (corner == CornerType.TOP_RIGHT || corner == CornerType.BOTTOM_RIGHT ? radius - px - 1 : px); + int drawY = y + (corner == CornerType.BOTTOM_LEFT || corner == CornerType.BOTTOM_RIGHT ? radius - py - 1 : py); + + context.fill(drawX, drawY, drawX + 1, drawY + 1, pixelColor); + } + } + } } } @@ -293,7 +366,30 @@ public static void drawRect(DrawContext context, float x, float y, float width, context.fill((int) x, (int) y, (int) (x + width), (int) (y + height), color); } - private enum CornerType { - TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT + /** + * Draws a line between two points with specified thickness and color. + * + * @param context The {@code DrawContext} used for rendering the line. + * @param x The x-coordinate of the starting point of the line. + * @param y The y-coordinate of the starting point of the line. + * @param toX The*/ + public static void drawLine( + DrawContext context, + int x, + int y, + int toX, + int toY, + float thickness, + int color + ) { + ExtendedDrawContext.drawLine( + context, + x, + y, + toX, + toY, + thickness, + new Color(color) + ); } } \ No newline at end of file diff --git a/src/client/java/dev/thoq/utilities/render/TextRendererUtility.java b/src/client/java/dev/thoq/utilities/render/TextRendererUtility.java index bcc17d7..6d70f40 100644 --- a/src/client/java/dev/thoq/utilities/render/TextRendererUtility.java +++ b/src/client/java/dev/thoq/utilities/render/TextRendererUtility.java @@ -24,6 +24,7 @@ public class TextRendererUtility { static TextRenderer renderer = FontManager.getFont("sf_pro_rounded_regular", 11); + static TextRenderer rendererMd = FontManager.getFont("sf_pro_rounded_regular", 15); static TextRenderer rendererXl = FontManager.getFont("sf_pro_rounded_regular", 50); /** @@ -82,6 +83,34 @@ public static void renderXlText( ); } + /** + * Renders a medium (Md) text string on the screen at the specified position with a designated color and optional shadow. + * + * @param context The drawing context used for rendering the text. + * @param text The text to be rendered. + * @param color The color of the text, specified as an enum value from {@link Colors}. + * @param posX The X-coordinate where the text should be rendered. + * @param posY The Y-coordinate where the text should be rendered. + * @param shadow A boolean value indicating whether to render the text with a shadow effect. + */ + public static void renderMdText( + DrawContext context, + String text, + Colors color, + int posX, + int posY, + boolean shadow + ) { + context.drawText( + rendererMd, + text, + posX, + posY, + ColorUtility.getColor(color), + shadow + ); + } + /** * Renders a text string on the screen at the specified position with a designated color and optional shadow. * @@ -138,4 +167,22 @@ public static int getXlTextWidth(String text) { public static int getTextHeight() { return renderer.fontHeight; } + + /** + * Retrieves the height of the extra-large text font used by the renderer. + * + * @return The height of the extra-large font in pixels. + */ + public static int getXlTextHeight() { + return rendererXl.fontHeight; + } + + /** + * Retrieves the height of the medium (Md) text font used by the renderer. + * + * @return The height of the medium font in pixels. + */ + public static int getMdTextHeight() { + return rendererMd.fontHeight; + } } diff --git a/src/client/java/dev/thoq/utilities/render/Theme.java b/src/client/java/dev/thoq/utilities/render/Theme.java index 4d9b7da..64039b3 100644 --- a/src/client/java/dev/thoq/utilities/render/Theme.java +++ b/src/client/java/dev/thoq/utilities/render/Theme.java @@ -16,137 +16,15 @@ package dev.thoq.utilities.render; -import dev.thoq.config.setting.Setting; -import dev.thoq.config.setting.impl.ModeSetting; -import dev.thoq.module.Module; -import dev.thoq.module.ModuleRepository; -import dev.thoq.utilities.types.Pair; - -import java.awt.*; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -@SuppressWarnings({"FieldCanBeLocal", "unused"}) -public enum Theme { - RYE("Rye", new Color(92, 58, 220), new Color(100, 88, 147)), - PINK_LEMONADE("Pink Lemonade", new Color(255, 105, 180), new Color(255, 182, 193)), - SORBET("Sorbet", new Color(250, 171, 189), new Color(173, 81, 102)); - - private static final Map themeMap = new HashMap<>(); - private static Theme currentTheme = RYE; - - private final String name; - private final Pair colors; - - Theme(String name, Color color, Color colorAlternative) { - this.name = name; - System.out.println("Registering theme: " + name); - colors = Pair.of(color, colorAlternative); - } - - public static void init() { - Arrays.stream(values()).forEach(theme -> themeMap.put(theme.name, theme)); - } - - public Pair getColors() { - return colors; - } - - public String getName() { - return name; - } - - public Color getPrimaryColor() { - return colors.getFirst(); - } - - public Color getSecondaryColor() { - return colors.getSecond(); - } - - public int getPrimaryColorInt() { - return ColorUtility.getIntFromColor(getPrimaryColor()); - } - - public int getSecondaryColorInt() { - return ColorUtility.getIntFromColor(getSecondaryColor()); - } - - public static Pair getThemeColors(String name) { - return get(name).getColors(); - } - - public static Theme get(String name) { - return themeMap.get(name); - } - - public static Theme getCurrentTheme() { - try { - ModuleRepository repository = ModuleRepository.getInstance(); - Module hudModule = repository.getModuleByName("HUD"); - if(hudModule == null) - throw new IllegalStateException("HUD module either found or not loaded"); - - for(Setting setting : hudModule.getSettings()) { - if(setting.getName().equals("Theme") && setting instanceof ModeSetting themeSetting) { - String currentThemeName = themeSetting.getValue(); - if(currentThemeName == null) { - currentThemeName = RYE.getName(); - currentTheme = RYE; - } - - Theme theme = get(currentThemeName); - if(theme == null) { - theme = RYE; - } - - currentTheme = theme; - return currentTheme; - } - } - } catch(Exception ignored) { - } - - return currentTheme; - } - - public static void setCurrentTheme(Theme theme) { - currentTheme = theme; - } - - public static void setCurrentTheme(String themeName) { - Theme theme = get(themeName); - if(theme != null) { - currentTheme = theme; - } - } - - public static Color interpolateColor(Color color1, Color color2, float factor) { - factor = Math.max(0.0f, Math.min(1.0f, factor)); - - int r = (int) (color1.getRed() + factor * (color2.getRed() - color1.getRed())); - int g = (int) (color1.getGreen() + factor * (color2.getGreen() - color1.getGreen())); - int b = (int) (color1.getBlue() + factor * (color2.getBlue() - color1.getBlue())); - int a = (int) (color1.getAlpha() + factor * (color2.getAlpha() - color1.getAlpha())); - - return new Color(r, g, b, a); - } - - public static int interpolateColorInt(Color color1, Color color2, float factor) { - return ColorUtility.getIntFromColor(interpolateColor(color1, color2, factor)); - } - - public static Color getInterpolatedThemeColor(float factor) { - Theme theme = getCurrentTheme(); - return interpolateColor(theme.getPrimaryColor(), theme.getSecondaryColor(), factor); - } - - public static int getInterpolatedThemeColorInt(float factor) { - return ColorUtility.getIntFromColor(getInterpolatedThemeColor(factor)); - } - - public static String[] getThemeNames() { - return Arrays.stream(values()).map(Theme::getName).toArray(String[]::new); +public class Theme { + public static int COLOR$1 = 0xFFB734EB; + public static int COLOR$2 = 0xFF8334EB; + + public static int getInterpolatedColors(float factor) { + return ColorUtility.interpolateColor( + COLOR$1, + COLOR$2, + factor + ); } } \ No newline at end of file diff --git a/src/client/java/dev/thoq/utilities/render/ThemeUtility.java b/src/client/java/dev/thoq/utilities/render/ThemeUtility.java index b12b8a7..b98d9e0 100644 --- a/src/client/java/dev/thoq/utilities/render/ThemeUtility.java +++ b/src/client/java/dev/thoq/utilities/render/ThemeUtility.java @@ -21,7 +21,7 @@ @SuppressWarnings("unused") public class ThemeUtility { private static Color themeColorFirst = Color.PINK; - private static Color themeColorSecond = Color.GREEN; + private static Color themeColorSecond = Color.BLUE; public static Color getThemeColorFirst() { return themeColorFirst; diff --git a/src/main/resources/assets/rye/images/rye_logo_white.png b/src/main/resources/assets/rye/images/rye_logo_white.png new file mode 100644 index 0000000..f2c7d6c Binary files /dev/null and b/src/main/resources/assets/rye/images/rye_logo_white.png differ