Skip to content

Commit

Permalink
Some changes and forgot to remove 1 line in fabric.mod.json. Readme c…
Browse files Browse the repository at this point in the history
…hange.
  • Loading branch information
tanishisherewithhh committed Sep 24, 2024
1 parent ce4d26d commit ee2f3e9
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -24,4 +25,8 @@ public MovementType getType() {
public Vec3d getMovement() {
return movement;
}

public IVec3d modifyMovement(){
return (IVec3d)movement;
}
}
20 changes: 12 additions & 8 deletions src/main/java/dev/heliosclient/module/modules/movement/Speed.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down
8 changes: 3 additions & 5 deletions src/main/java/dev/heliosclient/module/settings/KeyBind.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Integer> {
public static boolean listeningKey = false;
public static boolean listeningMouse = false;
Expand Down Expand Up @@ -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<Builder, Integer, KeyBind> {
ISettingChange iSettingChange;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

}
3 changes: 1 addition & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"fabricloader": ">=0.15.0",
"fabric-api": "*",
"minecraft": "~1.20",
"java": ">=17",
"modmenu": ">=9.0.0"
"java": ">=17"
},
"suggests": {
"ModMenu": "*"
Expand Down

0 comments on commit ee2f3e9

Please sign in to comment.