Skip to content

Commit

Permalink
= Pests Destroyer - Sprinting changed to optional sprinting (default …
Browse files Browse the repository at this point in the history
…is disabled)

= Fly pathfinder - Fixes to sprinting and lag back
+ Added separate rotation delays for small distance (smaller than 2.5m) and medium (smaller than 10m)
  • Loading branch information
May2Beez committed Dec 17, 2023
1 parent 3ed66d6 commit d6dddcf
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2
mcVersion=1.8.9
modid=farmhelperv2
modName=FarmHelper
version=2.2.3
version=2.2.4
shouldRelease=true
37 changes: 31 additions & 6 deletions src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,13 @@ public enum SPRAYONATOR_ITEM {
min = 0, max = 5000
)
public static int pestAdditionalGUIDelay = 0;

@Switch(
name = "Sprint while flying", category = PESTS_DESTROYER, subcategory = "Pests Destroyer",
description = "Springs while flying"
)
public static boolean sprintWhileFlying = false;

@Switch(
name = "Pause the Pests Destroyer during Jacob's contests", category = PESTS_DESTROYER, subcategory = "Pests Destroyer",
description = "Pauses the Pests Destroyer during Jacob's contests",
Expand Down Expand Up @@ -1333,17 +1340,31 @@ public static void triggerManuallyPestsDestroyer() {

//<editor-fold desc="Pests Destroyer Time">
@Slider(
name = "Pests Destroyer Rotation Time", category = DELAYS, subcategory = "Pests Destroyer",
name = "Pests Destroyer Small Distance Rotation Time", category = DELAYS, subcategory = "Pests Destroyer",
description = "The time it takes to rotate the player",
min = 50f, max = 750
)
public static float pestsKillerRotationTimeSmallDistance = 200f;
@Slider(
name = "Additional random Pests Destroyer Small Distance Rotation Time", category = DELAYS, subcategory = "Pests Destroyer",
description = "The maximum random time added to the delay time it takes to rotate the player (in seconds)",
min = 0f, max = 750
)
public static float pestsKillerRotationTimeRandomnessSmallDistance = 150;

@Slider(
name = "Pests Destroyer Medium Distance Rotation Time", category = DELAYS, subcategory = "Pests Destroyer",
description = "The time it takes to rotate the player",
min = 50f, max = 750
)
public static float pestsKillerRotationTime = 200f;
public static float pestsKillerRotationTimeMediumDistance = 300f;
@Slider(
name = "Additional random Pests Destroyer Rotation Time", category = DELAYS, subcategory = "Pests Destroyer",
name = "Additional random Pests Destroyer Medium Distance Rotation Time", category = DELAYS, subcategory = "Pests Destroyer",
description = "The maximum random time added to the delay time it takes to rotate the player (in seconds)",
min = 0f, max = 750
)
public static float pestsKillerRotationTimeRandomness = 150;
public static float pestsKillerRotationTimeRandomnessMediumDistance = 120;

@Slider(
name = "Pests Destroyer Stuck Time (in minutes)", category = DELAYS, subcategory = "Pests Destroyer",
description = "Pests Destroyer Stuck Time (in minutes) for single pest",
Expand Down Expand Up @@ -1756,8 +1777,12 @@ public static long getRandomRotationTime() {
return (long) (rotationTime + (float) Math.random() * rotationTimeRandomness);
}

public static long getRandomPestsKillerRotationTime() {
return (long) (pestsKillerRotationTime + (float) Math.random() * pestsKillerRotationTimeRandomness);
public static long getRandomPestsKillerRotationTimeSmallDistance() {
return (long) (pestsKillerRotationTimeSmallDistance + (float) Math.random() * pestsKillerRotationTimeRandomnessSmallDistance);
}

public static long getRandomPestsKillerRotationTimeMediumDistance() {
return (long) (pestsKillerRotationTimeMediumDistance + (float) Math.random() * pestsKillerRotationTimeRandomnessMediumDistance);
}

public static long getRandomGUIMacroDelay() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ public void onTickExecute(TickEvent.ClientTickEvent event) {
boolean objects = objectsInFrontOfPlayer();
KeyBindUtils.holdThese(
!objects ? mc.gameSettings.keyBindForward : null,
mc.gameSettings.keyBindSprint,
FarmHelperConfig.sprintWhileFlying ? mc.gameSettings.keyBindSprint : null,
objects ? mc.gameSettings.keyBindJump : null
);
break;
Expand Down Expand Up @@ -587,18 +587,19 @@ public void onTickExecute(TickEvent.ClientTickEvent event) {
KeyBindUtils.stopMovement();
}
if (Math.abs(mc.thePlayer.motionX) > 0.1 || Math.abs(mc.thePlayer.motionZ) > 0.1) {
KeyBindUtils.holdThese(mc.gameSettings.keyBindUseItem);
if (delayBetweenBackTaps.passed()) {
KeyBindUtils.holdThese(mc.gameSettings.keyBindBack, mc.gameSettings.keyBindUseItem);
delayBetweenBackTaps.schedule(100 + (long) (Math.random() * 100));
} else {
KeyBindUtils.holdThese(mc.gameSettings.keyBindUseItem);
}
break;
}
if (!RotationHandler.getInstance().isRotating()) {
RotationHandler.getInstance().reset();
RotationHandler.getInstance().easeTo(new RotationConfiguration(
new Target(entity).additionalY(0.42f),
FarmHelperConfig.getRandomPestsKillerRotationTime(),
FarmHelperConfig.getRandomPestsKillerRotationTimeSmallDistance(),
null
));
}
Expand All @@ -615,11 +616,12 @@ public void onTickExecute(TickEvent.ClientTickEvent event) {
flyPathfinding(entity);
break;
} else {
if (distanceXZ <= 1.5 && (Math.abs(mc.thePlayer.motionX) > 0.1 || Math.abs(mc.thePlayer.motionZ) > 0.1)) {
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null);
if (distanceXZ <= 1 && (Math.abs(mc.thePlayer.motionX) > 0.1 || Math.abs(mc.thePlayer.motionZ) > 0.1)) {
if (delayBetweenBackTaps.passed()) {
KeyBindUtils.holdThese(mc.gameSettings.keyBindBack, distance < 6 ? mc.gameSettings.keyBindUseItem : null);
delayBetweenBackTaps.schedule(100 + (long) (Math.random() * 200));
} else {
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null);
}
break;
}
Expand All @@ -628,7 +630,7 @@ public void onTickExecute(TickEvent.ClientTickEvent event) {
RotationHandler.getInstance().reset();
RotationHandler.getInstance().easeTo(new RotationConfiguration(
new Target(entity),
FarmHelperConfig.getRandomRotationTime(),
FarmHelperConfig.getRandomPestsKillerRotationTimeMediumDistance(),
null
).easeOutBack(true).randomness(true));
}
Expand All @@ -651,11 +653,11 @@ public void onTickExecute(TickEvent.ClientTickEvent event) {
boolean objects = objectsInFrontOfPlayer();

if (!GameStateHandler.getInstance().isLeftWalkable() && GameStateHandler.getInstance().isRightWalkable()) {
KeyBindUtils.holdThese(objects ? mc.gameSettings.keyBindJump : null, distanceXZ > 2 && yawDifference < 90 ? mc.gameSettings.keyBindForward : null, mc.gameSettings.keyBindRight, distanceXZ > 10 && yawDifference < 30 ? mc.gameSettings.keyBindSprint : null);
KeyBindUtils.holdThese(objects ? mc.gameSettings.keyBindJump : null, distanceXZ > 2 && yawDifference < 90 ? mc.gameSettings.keyBindForward : null, mc.gameSettings.keyBindRight, distanceXZ > 10 && yawDifference < 30 ? FarmHelperConfig.sprintWhileFlying ? mc.gameSettings.keyBindSprint : null : null);
} else if (GameStateHandler.getInstance().isLeftWalkable() && !GameStateHandler.getInstance().isRightWalkable()) {
KeyBindUtils.holdThese(objects ? mc.gameSettings.keyBindJump : null, distanceXZ > 2 && yawDifference < 90 ? mc.gameSettings.keyBindForward : null, mc.gameSettings.keyBindLeft, distanceXZ > 10 && yawDifference < 30 ? mc.gameSettings.keyBindSprint : null);
KeyBindUtils.holdThese(objects ? mc.gameSettings.keyBindJump : null, distanceXZ > 2 && yawDifference < 90 ? mc.gameSettings.keyBindForward : null, mc.gameSettings.keyBindLeft, distanceXZ > 10 && yawDifference < 30 ? FarmHelperConfig.sprintWhileFlying ? mc.gameSettings.keyBindSprint : null : null);
} else {
KeyBindUtils.holdThese(objects ? mc.gameSettings.keyBindJump : null, distanceXZ > 2 && yawDifference < 90 ? mc.gameSettings.keyBindForward : null, distanceXZ > 10 && yawDifference < 30 ? mc.gameSettings.keyBindSprint : null);
KeyBindUtils.holdThese(objects ? mc.gameSettings.keyBindJump : null, distanceXZ > 2 && yawDifference < 90 ? mc.gameSettings.keyBindForward : null, distanceXZ > 10 && yawDifference < 30 ? FarmHelperConfig.sprintWhileFlying ? mc.gameSettings.keyBindSprint : null : null);
}

if (!RotationHandler.getInstance().isRotating()) {
Expand Down Expand Up @@ -779,17 +781,17 @@ private boolean isInventoryOpen() {

private void manipulateHeight(Entity entity, double distance, double distanceWithoutY, float yawDifference) {
if (objectsInFrontOfPlayer() || entity.posY + entity.getEyeHeight() + 1 - mc.thePlayer.posY >= 2) {
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null, mc.thePlayer.capabilities.isFlying ? mc.gameSettings.keyBindJump : null, distanceWithoutY > 6 && yawDifference < 25 ? mc.gameSettings.keyBindForward : null, distanceWithoutY < 1 && (GameStateHandler.getInstance().getDx() > 0.04 || GameStateHandler.getInstance().getDz() > 0.04) ? mc.gameSettings.keyBindBack : null, distanceWithoutY > 7 && yawDifference < 25 ? mc.gameSettings.keyBindSprint : null);
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null, mc.thePlayer.capabilities.isFlying ? mc.gameSettings.keyBindJump : null, distanceWithoutY > 6 && yawDifference < 25 ? mc.gameSettings.keyBindForward : null, distanceWithoutY < 1 && (GameStateHandler.getInstance().getDx() > 0.04 || GameStateHandler.getInstance().getDz() > 0.04) ? mc.gameSettings.keyBindBack : null, distanceWithoutY > 7 && yawDifference < 25 ? FarmHelperConfig.sprintWhileFlying ? mc.gameSettings.keyBindSprint : null : null);
} else if (entity.posY + entity.getEyeHeight() + 1 - mc.thePlayer.posY <= -2) {
if (hasBlockUnderThePlayer()) {
LogUtils.sendDebug("Has block under the player");
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null, getMovementToEvadeBottomBlock(), distanceWithoutY < 1 && (GameStateHandler.getInstance().getDx() > 0.04 || GameStateHandler.getInstance().getDz() > 0.04) ? mc.gameSettings.keyBindBack : null);
} else {
LogUtils.sendDebug("Doesn't have block under the player");
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null, mc.gameSettings.keyBindSneak, distanceWithoutY > 6 && yawDifference < 25 ? mc.gameSettings.keyBindForward : null, distanceWithoutY < 1 && (GameStateHandler.getInstance().getDx() > 0.04 || GameStateHandler.getInstance().getDz() > 0.04) ? mc.gameSettings.keyBindBack : null, distanceWithoutY > 7 && yawDifference < 25 ? mc.gameSettings.keyBindSprint : null);
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null, mc.gameSettings.keyBindSneak, distanceWithoutY > 6 && yawDifference < 25 ? mc.gameSettings.keyBindForward : null, distanceWithoutY < 1 && (GameStateHandler.getInstance().getDx() > 0.04 || GameStateHandler.getInstance().getDz() > 0.04) ? mc.gameSettings.keyBindBack : null, distanceWithoutY > 7 && yawDifference < 25 ? FarmHelperConfig.sprintWhileFlying ? mc.gameSettings.keyBindSprint : null : null);
}
} else {
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null, distanceWithoutY > 3 && yawDifference < 25 ? mc.gameSettings.keyBindForward : null, distanceWithoutY < 1 && (GameStateHandler.getInstance().getDx() > 0.04 || GameStateHandler.getInstance().getDz() > 0.04) ? mc.gameSettings.keyBindBack : null, distanceWithoutY > 7 && yawDifference < 25 ? mc.gameSettings.keyBindSprint : null);
KeyBindUtils.holdThese(distance < 6 ? mc.gameSettings.keyBindUseItem : null, distanceWithoutY > 3 && yawDifference < 25 ? mc.gameSettings.keyBindForward : null, distanceWithoutY < 1 && (GameStateHandler.getInstance().getDx() > 0.04 || GameStateHandler.getInstance().getDz() > 0.04) ? mc.gameSettings.keyBindBack : null, distanceWithoutY > 7 && yawDifference < 25 ? FarmHelperConfig.sprintWhileFlying ? mc.gameSettings.keyBindSprint : null : null);
}
}

Expand Down

0 comments on commit d6dddcf

Please sign in to comment.