mirror of https://github.com/cabaletta/baritone
block break delay setting
This commit is contained in:
parent
4144344acd
commit
413c11a23e
|
@ -385,6 +385,13 @@ public final class Settings {
|
|||
*/
|
||||
public final Setting<Float> blockReachDistance = new Setting<>(4.5f);
|
||||
|
||||
|
||||
/**
|
||||
* Delay between breaking a block and starting to break the next block. The vanilla delay is 6 ticks.
|
||||
* Baritone waits an additional 2 ticks on top of this setting value.
|
||||
*/
|
||||
public final Setting<Integer> blockBreakDelay = new Setting<>(4);
|
||||
|
||||
/**
|
||||
* How many degrees to randomize the pitch and yaw every tick. Set to 0 to disable
|
||||
*/
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package baritone.utils;
|
||||
|
||||
import baritone.api.BaritoneAPI;
|
||||
import baritone.api.utils.IPlayerContext;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
@ -30,6 +31,7 @@ public final class BlockBreakHelper {
|
|||
|
||||
private final IPlayerContext ctx;
|
||||
private boolean didBreakLastTick;
|
||||
private int breakDelay = 0;
|
||||
|
||||
BlockBreakHelper(IPlayerContext ctx) {
|
||||
this.ctx = ctx;
|
||||
|
@ -48,6 +50,11 @@ public final class BlockBreakHelper {
|
|||
}
|
||||
|
||||
public void tick(boolean isLeftClick) {
|
||||
if (breakDelay > 0) {
|
||||
breakDelay--;
|
||||
return;
|
||||
}
|
||||
|
||||
HitResult trace = ctx.objectMouseOver();
|
||||
boolean isBlockTrace = trace != null && trace.getType() == HitResult.Type.BLOCK;
|
||||
|
||||
|
@ -68,6 +75,7 @@ public final class BlockBreakHelper {
|
|||
didBreakLastTick = true;
|
||||
} else if (didBreakLastTick) {
|
||||
stopBreakingBlock();
|
||||
breakDelay = BaritoneAPI.getSettings().blockBreakDelay.value;
|
||||
didBreakLastTick = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue