Skip to content

Commit

Permalink
improve velocity
Browse files Browse the repository at this point in the history
add sneak mode to rotation mode of scaffold
improve scaffold rotation
  • Loading branch information
xia-mc committed Jul 11, 2024
1 parent 3d936ea commit a0d3656
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import keystrokesmod.module.impl.movement.NoSlow;
import keystrokesmod.module.impl.movement.Sprint;
import keystrokesmod.module.impl.other.RotationHandler;
import keystrokesmod.module.impl.world.Scaffold;
import keystrokesmod.utility.RotationUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/keystrokesmod/module/impl/combat/Velocity.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class Velocity extends Module {
public static ModeSetting mode;
public static SliderSetting horizontal;
public static SliderSetting vertical;
private final SliderSetting reduce;
private final ButtonSetting cancelExplosion;
private final ButtonSetting cancelAir;
private final ButtonSetting damageBoost;
Expand All @@ -61,6 +62,7 @@ public Velocity() {
final ModeOnly canChangeMode = new ModeOnly(mode, 0, 1);
this.registerSetting(horizontal = new SliderSetting("Horizontal", 0.0, -100.0, 100.0, 1.0, canChangeMode));
this.registerSetting(vertical = new SliderSetting("Vertical", 0.0, 0.0, 100.0, 1.0, canChangeMode));
this.registerSetting(reduce = new SliderSetting("Reduce", 5, 0, 5, 1, new ModeOnly(mode, 3)));
this.registerSetting(cancelExplosion = new ButtonSetting("Cancel explosion packet", true, canChangeMode));
this.registerSetting(cancelAir = new ButtonSetting("Cancel air", false, canChangeMode));
this.registerSetting(damageBoost = new ButtonSetting("Damage boost", false));
Expand Down Expand Up @@ -123,7 +125,7 @@ public void onRotation(PreMotionEvent event) {
}

private void grimAC$reduce() {
for (int i = 0; i < 5; i++) {
for (int i = 0; i < (int) reduce.getInput(); i++) {
PacketUtils.sendPacketNoEvent(new C0APacketAnimation());
PacketUtils.sendPacketNoEvent(new C02PacketUseEntity(lastAttack, C02PacketUseEntity.Action.ATTACK));
mc.thePlayer.motionX *= 0.6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import keystrokesmod.event.MoveInputEvent;
import keystrokesmod.event.RotationEvent;
import keystrokesmod.module.Module;
import keystrokesmod.module.impl.world.Scaffold;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.DescriptionSetting;
import keystrokesmod.module.setting.impl.ModeSetting;
Expand Down Expand Up @@ -83,7 +84,7 @@ public static float getLastRotationPitch() {
* Fix movement
* @param event before update living entity (move)
*/
@SubscribeEvent(priority = EventPriority.LOWEST)
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPreMotion(MoveInputEvent event) {
if (isSet) {
lastRotationYaw = rotationYaw;
Expand Down Expand Up @@ -144,7 +145,10 @@ public void onPreMotion(MoveInputEvent event) {
}
}

event.setForward(closestForward);
if (!Scaffold.sprint() || Math.abs(closestForward) != Math.abs(forward))
event.setForward(closestForward);
else
event.setForward(-forward);
event.setStrafe(closestStrafe);
break;
case 2:
Expand Down
37 changes: 24 additions & 13 deletions src/main/java/keystrokesmod/module/impl/world/Scaffold.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package keystrokesmod.module.impl.world;

import keystrokesmod.Raven;
import keystrokesmod.event.JumpEvent;
import keystrokesmod.event.PreMotionEvent;
import keystrokesmod.event.PreUpdateEvent;
import keystrokesmod.event.RotationEvent;
import keystrokesmod.event.*;
import keystrokesmod.mixins.impl.client.KeyBindingAccessor;
import keystrokesmod.module.Module;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.impl.other.RotationHandler;
import keystrokesmod.module.impl.other.SlotHandler;
import keystrokesmod.module.impl.render.HUD;
Expand Down Expand Up @@ -67,7 +65,7 @@ public class Scaffold extends Module { // from b4 :)
protected MovingObjectPosition placeBlock;
private int lastSlot;
private static final String[] rotationModes = new String[]{"None", "Backwards", "Strict", "Precise", "Telly", "Constant", "Snap"};
private static final String[] fastScaffoldModes = new String[]{"Disabled", "Sprint", "Edge", "Jump A", "Jump B", "Jump C", "Float", "Side", "Legit", "Auto Jump", "GrimAC"};
private static final String[] fastScaffoldModes = new String[]{"Disabled", "Sprint", "Edge", "Jump A", "Jump B", "Jump C", "Float", "Side", "Legit", "Auto Jump", "GrimAC", "Sneak"};
private static final String[] precisionModes = new String[]{"Very low", "Low", "Moderate", "High", "Very high"};
public float placeYaw;
public float placePitch;
Expand Down Expand Up @@ -154,7 +152,7 @@ public void onRotation(RotationEvent event) {
pitch = 85;
break;
case 2:
if (!forceStrict) {
if (!forceStrict && MoveUtil.isMoving()) {
yaw = getYaw() + (float) strafe.getInput();
pitch = 85;
break;
Expand Down Expand Up @@ -182,10 +180,12 @@ public void onRotation(RotationEvent event) {
if (MoveUtil.isMoving()) {
mc.thePlayer.setSprinting(true);
}
if (place || !MoveUtil.isMoving()) {
if (!MoveUtil.isMoving()) {
yaw = placeYaw;
} else if (place) {
yaw = forceStrict ? placeYaw : getYaw();
} else {
yaw = event.getYaw();
yaw = (float) (event.getYaw() + (Math.random() - 0.5) * 0.940004);
}
pitch = placePitch;
break;
Expand Down Expand Up @@ -217,6 +217,14 @@ public void onJump(JumpEvent e) {
delay = true;
}

@SubscribeEvent
public void onMoveInput(@NotNull MoveInputEvent event) {
if (fastScaffold.getInput() == 11) {
event.setSneak(true);
event.setSneakSlowDownMultiplier(1);
}
}

@SubscribeEvent
public void onPreUpdate(PreUpdateEvent e) { // place here
if (mc.thePlayer.onGround) {
Expand Down Expand Up @@ -262,7 +270,6 @@ public void onPreUpdate(PreUpdateEvent e) { // place here
}
}


if (delay && delayOnJump.isToggled()) {
delay = false;
return;
Expand Down Expand Up @@ -534,20 +541,24 @@ public void onRenderWorld(RenderWorldLastEvent e) {
}
}

public boolean sprint() {
if (this.isEnabled() && fastScaffold.getInput() > 0 && placeBlock != null && (!fastOnRMB.isToggled() || Mouse.isButtonDown(1))) {
switch ((int) fastScaffold.getInput()) {
public static boolean sprint() {
if (ModuleManager.scaffold.isEnabled()
&& ModuleManager.scaffold.fastScaffold.getInput() > 0
&& ModuleManager.scaffold.placeBlock != null
&& (!ModuleManager.scaffold.fastOnRMB.isToggled() || Mouse.isButtonDown(1))) {
switch ((int) ModuleManager.scaffold.fastScaffold.getInput()) {
case 1:
case 7:
case 10:
case 11:
return true;
case 2:
return Utils.onEdge();
case 3:
case 4:
case 5:
case 6:
return keepYPosition();
return ModuleManager.scaffold.keepYPosition();
case 8:
return Math.abs(MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - MathHelper.wrapAngleTo180_float(RotationHandler.getRotationYaw())) <= 45;
}
Expand Down

0 comments on commit a0d3656

Please sign in to comment.