@@ -256,7 +256,12 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
256
256
}
257
257
258
258
baritone .getInputOverrideHandler ().clearAllKeys ();
259
+ BetterBlockPos playerPos = ctx .playerFeet ();
260
+ double blockReachDistance = ctx .playerController ().getBlockReachDistance ();
259
261
for (BlockPos pos : toBreak ) {
262
+ if (playerPos .distSqr (pos ) > blockReachDistance * blockReachDistance ) {
263
+ continue ;
264
+ }
260
265
Optional <Rotation > rot = RotationUtils .reachable (ctx , pos );
261
266
if (rot .isPresent () && isSafeToCancel ) {
262
267
baritone .getLookBehavior ().updateTarget (rot .get (), true );
@@ -270,10 +275,13 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
270
275
ArrayList <BlockPos > both = new ArrayList <>(openFarmland );
271
276
both .addAll (openSoulsand );
272
277
for (BlockPos pos : both ) {
278
+ if (playerPos .distSqr (pos ) > blockReachDistance * blockReachDistance ) {
279
+ continue ;
280
+ }
273
281
boolean soulsand = openSoulsand .contains (pos );
274
- Optional <Rotation > rot = RotationUtils .reachableOffset (ctx , pos , new Vec3 (pos .getX () + 0.5 , pos .getY () + 1 , pos .getZ () + 0.5 ), ctx . playerController (). getBlockReachDistance () , false );
282
+ Optional <Rotation > rot = RotationUtils .reachableOffset (ctx , pos , new Vec3 (pos .getX () + 0.5 , pos .getY () + 1 , pos .getZ () + 0.5 ), blockReachDistance , false );
275
283
if (rot .isPresent () && isSafeToCancel && baritone .getInventoryBehavior ().throwaway (true , soulsand ? this ::isNetherWart : this ::isPlantable )) {
276
- HitResult result = RayTraceUtils .rayTraceTowards (ctx .player (), rot .get (), ctx . playerController (). getBlockReachDistance () );
284
+ HitResult result = RayTraceUtils .rayTraceTowards (ctx .player (), rot .get (), blockReachDistance );
277
285
if (result instanceof BlockHitResult && ((BlockHitResult ) result ).getDirection () == Direction .UP ) {
278
286
baritone .getLookBehavior ().updateTarget (rot .get (), true );
279
287
if (ctx .isLookingAt (pos )) {
@@ -284,14 +292,17 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
284
292
}
285
293
}
286
294
for (BlockPos pos : openLog ) {
295
+ if (playerPos .distSqr (pos ) > blockReachDistance * blockReachDistance ) {
296
+ continue ;
297
+ }
287
298
for (Direction dir : Direction .Plane .HORIZONTAL ) {
288
299
if (!(ctx .world ().getBlockState (pos .relative (dir )).getBlock () instanceof AirBlock )) {
289
300
continue ;
290
301
}
291
302
Vec3 faceCenter = Vec3 .atCenterOf (pos ).add (Vec3 .atLowerCornerOf (dir .getNormal ()).scale (0.5 ));
292
- Optional <Rotation > rot = RotationUtils .reachableOffset (ctx , pos , faceCenter , ctx . playerController (). getBlockReachDistance () , false );
303
+ Optional <Rotation > rot = RotationUtils .reachableOffset (ctx , pos , faceCenter , blockReachDistance , false );
293
304
if (rot .isPresent () && isSafeToCancel && baritone .getInventoryBehavior ().throwaway (true , this ::isCocoa )) {
294
- HitResult result = RayTraceUtils .rayTraceTowards (ctx .player (), rot .get (), ctx . playerController (). getBlockReachDistance () );
305
+ HitResult result = RayTraceUtils .rayTraceTowards (ctx .player (), rot .get (), blockReachDistance );
295
306
if (result instanceof BlockHitResult && ((BlockHitResult ) result ).getDirection () == dir ) {
296
307
baritone .getLookBehavior ().updateTarget (rot .get (), true );
297
308
if (ctx .isLookingAt (pos )) {
@@ -303,6 +314,9 @@ public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
303
314
}
304
315
}
305
316
for (BlockPos pos : bonemealable ) {
317
+ if (playerPos .distSqr (pos ) > blockReachDistance * blockReachDistance ) {
318
+ continue ;
319
+ }
306
320
Optional <Rotation > rot = RotationUtils .reachable (ctx , pos );
307
321
if (rot .isPresent () && isSafeToCancel && baritone .getInventoryBehavior ().throwaway (true , this ::isBoneMeal )) {
308
322
baritone .getLookBehavior ().updateTarget (rot .get (), true );
0 commit comments