Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
fix scaffold
Browse files Browse the repository at this point in the history
add lowhop to tower
remove double block from tower
  • Loading branch information
xia-mc committed Jul 8, 2024
1 parent f8d752e commit 312b286
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public void onPreUpdate(PreUpdateEvent e) { // place here
}
}

if (fastScaffold.getInput() == 7 && sameY$bridged != 0 && sameY$bridged % 2 == 0 && placeBlock != null && !Utils.jumpDown()) {
if (fastScaffold.getInput() == 7 && !Utils.jumpDown() && sameY$bridged != 0 && sameY$bridged % 2 == 0 && placeBlock != null && !Utils.jumpDown()) {
List<BlockPos> possible = new ArrayList<>(Arrays.asList(
placeBlock.getBlockPos().west(),
placeBlock.getBlockPos().east(),
Expand Down
71 changes: 33 additions & 38 deletions src/main/java/keystrokesmod/module/impl/world/Tower.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ public class Tower extends Module {
private final ButtonSetting sprintJumpForward;
private final ButtonSetting hypixelNoStrafe;
private final SliderSetting hypixelOffGroundSpeed;
private final SliderSetting doubleBlockDelay;
private final ButtonSetting doubleBlock;
private final ButtonSetting lowHop;
private int slowTicks;
private boolean wasTowering;
private int offGroundTicks = 0;
Expand All @@ -59,8 +58,7 @@ public Tower() {
this.registerSetting(slowedTicks = new SliderSetting("Slowed ticks", 1, 0, 20, 1, mode0));
this.registerSetting(hypixelOffGroundSpeed = new SliderSetting("Hypixel off ground speed", 0.5, 0.0, 1.0, 0.01, mode1));
this.registerSetting(hypixelNoStrafe = new ButtonSetting("Hypixel no strafe", false, mode1));
this.registerSetting(doubleBlock = new ButtonSetting("Double block", false));
this.registerSetting(doubleBlockDelay = new SliderSetting("Double block delay", 100, 0, 2500, 10, "ms"));
this.registerSetting(lowHop = new ButtonSetting("Low hop", false, mode1));
this.registerSetting(disableWhileCollided = new ButtonSetting("Disable while collided", false));
this.registerSetting(disableWhileHurt = new ButtonSetting("Disable while hurt", false));
this.registerSetting(sprintJumpForward = new ButtonSetting("Sprint jump forward", true));
Expand All @@ -79,27 +77,6 @@ public void onPreMotion(PreMotionEvent e) throws IllegalAccessException {
if (canTower()) {
wasTowering = true;

final boolean didDoubleBlock = doubleBlock.isToggled() && mc.thePlayer.motionX == 0 && mc.thePlayer.motionZ == 0;
if (didDoubleBlock) {
if (scaffold.placeBlock != null) {
BlockPos groundBlock = scaffold.placeBlock.getBlockPos().add(1, -1, 0);
if (BlockUtils.isFullBlock(mc.theWorld.getBlockState(groundBlock))) {
toweredBlock = groundBlock.up();
} else {
toweredBlock = null;
}
if (toweredBlock != null) {
BlockIn.getPlaceSide(toweredBlock).ifPresent(placeSide ->
Raven.getExecutor().schedule(() ->
scaffold.place(
new MovingObjectPosition(placeSide.getRight().toVec3(), placeSide.getMiddle(), placeSide.getLeft())
, true)
, (long) doubleBlockDelay.getInput(), TimeUnit.MILLISECONDS)
);
}
}
}

switch ((int) mode.getInput()) {
case 0:
Utils.setSpeed(Math.max((diagonal() ? diagonalSpeed.getInput() : speed.getInput()) * 0.1 - 0.25, 0));
Expand All @@ -109,23 +86,20 @@ public void onPreMotion(PreMotionEvent e) throws IllegalAccessException {
Reflection.jumpTicks.set(mc.thePlayer, 0);
e.setSprinting(false);

if (!didDoubleBlock) {
toweredBlock = null;
double moveSpeed = e.isOnGround() ? speed.getInput() : hypixelOffGroundSpeed.getInput();
if (hypixelNoStrafe.isToggled()) {
if (Math.abs(mc.thePlayer.motionX) >= Math.abs(mc.thePlayer.motionZ)) {
mc.thePlayer.motionX *= moveSpeed;
mc.thePlayer.motionZ = 0;
} else {
mc.thePlayer.motionZ *= moveSpeed;
mc.thePlayer.motionX = 0;
}
} else {
toweredBlock = null;
double moveSpeed = e.isOnGround() ? speed.getInput() : hypixelOffGroundSpeed.getInput();
if (hypixelNoStrafe.isToggled()) {
if (Math.abs(mc.thePlayer.motionX) >= Math.abs(mc.thePlayer.motionZ)) {
mc.thePlayer.motionX *= moveSpeed;
mc.thePlayer.motionZ = 0;
} else {
mc.thePlayer.motionZ *= moveSpeed;
mc.thePlayer.motionX = 0;
}
} else {
mc.thePlayer.motionX *= moveSpeed;
mc.thePlayer.motionZ *= moveSpeed;
}
break;
case 2:
if (mc.thePlayer.onGround)
mc.thePlayer.motionY = 0.42F;
Expand Down Expand Up @@ -173,6 +147,27 @@ public void onPreUpdate(PreUpdateEvent event) {
} else {
offGroundTicks++;
}

if (canTower() && lowHop.isToggled() && Utils.isMoving()) {
switch (offGroundTicks) {
case 0:
mc.thePlayer.motionY = 0.4196;
break;
case 3:
case 4:
mc.thePlayer.motionY = 0;
break;
case 5:
mc.thePlayer.motionY = 0.4191;
break;
case 6:
mc.thePlayer.motionY = 0.3275;
break;
case 11:
mc.thePlayer.motionY = -0.5;
break;
}
}
}

private void reset() {
Expand Down

0 comments on commit 312b286

Please sign in to comment.