diff --git a/README.md b/README.md index bc76f0f..5526ef2 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ To submit a bug open an issue in this repository. Before doing so please assure yourself that the issues isn't already listed under [Known issues](#known-issues). ## Known issues -- Buggy modules like Tick-Shift, PacketMine. +- Buggy modules like Tick-Shift. - Incomplete modules like Phase, Fucker, InventoryTweaks. - ~~HudElements don't resize to their proper locations sometimes.~~ - Scripting System (WIP). diff --git a/src/main/java/dev/heliosclient/event/events/player/PlayerMotionEvent.java b/src/main/java/dev/heliosclient/event/events/player/PlayerMotionEvent.java index eef4da9..a79a943 100644 --- a/src/main/java/dev/heliosclient/event/events/player/PlayerMotionEvent.java +++ b/src/main/java/dev/heliosclient/event/events/player/PlayerMotionEvent.java @@ -3,6 +3,7 @@ import dev.heliosclient.event.Cancelable; import dev.heliosclient.event.Event; import dev.heliosclient.event.LuaEvent; +import dev.heliosclient.system.mixininterface.IVec3d; import net.minecraft.entity.MovementType; import net.minecraft.util.math.Vec3d; @@ -24,4 +25,8 @@ public MovementType getType() { public Vec3d getMovement() { return movement; } + + public IVec3d modifyMovement(){ + return (IVec3d)movement; + } } diff --git a/src/main/java/dev/heliosclient/module/modules/movement/Speed.java b/src/main/java/dev/heliosclient/module/modules/movement/Speed.java index c5c69bc..d45dd66 100644 --- a/src/main/java/dev/heliosclient/module/modules/movement/Speed.java +++ b/src/main/java/dev/heliosclient/module/modules/movement/Speed.java @@ -66,7 +66,7 @@ public Speed() { @SubscribeEvent @SuppressWarnings("all") public void onMotion(PlayerMotionEvent e) { - if (mc.options.sneakKey.isPressed() && !whileSneaking.value) + if ((mc.options.sneakKey.isPressed() && !whileSneaking.value) || mc.getCameraEntity() != mc.player) return; // Strafe Mode @@ -94,14 +94,18 @@ public void onMotion(PlayerMotionEvent e) { mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_SPRINTING)); } - double prevX = e.getMovement().x * (1.0 - speed.value/10.1); - double prevZ = e.getMovement().z * (1.0 - speed.value/10.1); - double useSpeed = mc.player.getVelocity().horizontalLength() * (speed.value/10.0); + double prevX = e.getMovement().x * speed.value; + double prevZ = e.getMovement().z * speed.value; + double useSpeed = mc.player.getVelocity().horizontalLength() * (speed.value / 10.0); - double angle = Math.toRadians(mc.player.getYaw(mc.getTickDelta())); - double x = (-Math.sin(angle) * useSpeed) + prevX; - double z = (Math.cos(angle) * useSpeed) + prevZ; - ((IVec3d) e.getMovement()).heliosClient$setXZ(x,z); + double angle = Math.toRadians(mc.player.getYaw(mc.getTickDelta())); + double forward = mc.player.input.movementForward; + double strafe = mc.player.input.movementSideways; + + double x = (-Math.sin(angle) * forward + Math.cos(angle) * strafe) * useSpeed + prevX; + double z = (Math.cos(angle) * forward + Math.sin(angle) * strafe) * useSpeed + prevZ; + + e.modifyMovement().heliosClient$setXZ(x, z); } // OnGround Mode else if (speedMode.getOption() == Modes.OnGround) { diff --git a/src/main/java/dev/heliosclient/module/modules/movement/Sprint.java b/src/main/java/dev/heliosclient/module/modules/movement/Sprint.java index 1dafd40..d8493f3 100644 --- a/src/main/java/dev/heliosclient/module/modules/movement/Sprint.java +++ b/src/main/java/dev/heliosclient/module/modules/movement/Sprint.java @@ -41,7 +41,7 @@ public boolean strictModeCheck() { if(!strictMode.value){ return mc.currentScreen == null; } - return mc.player.forwardSpeed > 0.00f && + return (mc.player.forwardSpeed != 0 || mc.player.sidewaysSpeed != 0) && !mc.player.horizontalCollision && !mc.player.isTouchingWater() && !mc.player.isSubmergedInWater() && diff --git a/src/main/java/dev/heliosclient/module/modules/player/AutoEat.java b/src/main/java/dev/heliosclient/module/modules/player/AutoEat.java index 87d6cc0..2494962 100644 --- a/src/main/java/dev/heliosclient/module/modules/player/AutoEat.java +++ b/src/main/java/dev/heliosclient/module/modules/player/AutoEat.java @@ -122,7 +122,9 @@ public void onTick(TickEvent.PLAYER event) { if ((isEating && !shouldEat()) || mc.player.getInventory().getStack(bestFoodSlot) == null) { isEating = false; mc.options.useKey.setPressed(false); - InventoryUtils.swapBackHotbar(); + + if(bestFoodSlot != InventoryUtils.OFFHAND) + InventoryUtils.swapBackHotbar(); } } diff --git a/src/main/java/dev/heliosclient/module/settings/KeyBind.java b/src/main/java/dev/heliosclient/module/settings/KeyBind.java index a70b529..9eeedd4 100644 --- a/src/main/java/dev/heliosclient/module/settings/KeyBind.java +++ b/src/main/java/dev/heliosclient/module/settings/KeyBind.java @@ -16,6 +16,9 @@ import java.util.Locale; import java.util.function.BooleanSupplier; +/** + * The keybind setting only provides a way to get key codes which the user has selected. On its own, it does not perform anything when the key is pressed. + */ public class KeyBind extends Setting { public static boolean listeningKey = false; public static boolean listeningMouse = false; @@ -146,11 +149,6 @@ public void loadFromFile(MapReader map) { value = map.getInt(this.getSaveName(),defaultValue); } - @Override - public void mouseReleased(double mouseX, double mouseY, int button) { - super.mouseReleased(mouseX, mouseY, button); - } - public static class Builder extends SettingBuilder { ISettingChange iSettingChange; diff --git a/src/main/java/dev/heliosclient/util/player/InventoryUtils.java b/src/main/java/dev/heliosclient/util/player/InventoryUtils.java index aaa1231..25789b5 100644 --- a/src/main/java/dev/heliosclient/util/player/InventoryUtils.java +++ b/src/main/java/dev/heliosclient/util/player/InventoryUtils.java @@ -31,8 +31,6 @@ public static void swapBackHotbar() { } } - - public static boolean swapToSlot(int hotbarSlot, boolean swapBack) { if (hotbarSlot == InventoryUtils.OFFHAND) return true; if (HeliosClient.MC.player.getInventory().selectedSlot == hotbarSlot) return true; @@ -269,9 +267,4 @@ public static void moveItem(int fromSlot, int toSlot, SlotActionType fromAction, HeliosClient.MC.interactionManager.clickSlot(player.currentScreenHandler.syncId, toSlot, 0, toAction, player); } } - - public static void moveItemPickup(int fromSlot, int toSlot) { - moveItem(fromSlot,toSlot,SlotActionType.PICKUP,SlotActionType.PICKUP); - } - } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 23d8a02..6e47e83 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -30,8 +30,7 @@ "fabricloader": ">=0.15.0", "fabric-api": "*", "minecraft": "~1.20", - "java": ">=17", - "modmenu": ">=9.0.0" + "java": ">=17" }, "suggests": { "ModMenu": "*"