@@ -325,7 +325,9 @@ public Placement(int hotbarSelection, BlockPos placeAgainst, Direction side, Rot
325
325
}
326
326
}
327
327
328
- private Optional <Placement > searchForPlacables (BuilderCalculationContext bcc , List <BlockState > desirableOnHotbar ) {
328
+ private Optional <List <Placement >> searchForPlacables (BuilderCalculationContext bcc , List <BlockState > desirableOnHotbar ) {
329
+ ArrayList <Placement > list = new ArrayList <>();
330
+
329
331
BetterBlockPos center = ctx .playerFeet ();
330
332
for (int dx = -5 ; dx <= 5 ; dx ++) {
331
333
for (int dy = -5 ; dy <= 1 ; dy ++) {
@@ -344,13 +346,13 @@ private Optional<Placement> searchForPlacables(BuilderCalculationContext bcc, Li
344
346
}
345
347
desirableOnHotbar .add (desired );
346
348
Optional <Placement > opt = possibleToPlace (desired , x , y , z , bcc .bsi );
347
- if (opt .isPresent ()) {
348
- return opt ;
349
- }
349
+ opt .ifPresent (list ::add );
350
350
}
351
+
351
352
}
352
353
}
353
354
}
355
+ if (!list .isEmpty ()) return Optional .of (list );
354
356
return Optional .empty ();
355
357
}
356
358
@@ -561,14 +563,24 @@ public int lengthZ() {
561
563
return new PathingCommand (null , PathingCommandType .CANCEL_AND_SET_GOAL );
562
564
}
563
565
List <BlockState > desirableOnHotbar = new ArrayList <>();
564
- Optional <Placement > toPlace = searchForPlacables (bcc , desirableOnHotbar );
566
+ Optional <List < Placement > > toPlace = searchForPlacables (bcc , desirableOnHotbar );
565
567
if (toPlace .isPresent () && isSafeToCancel && ctx .player ().isOnGround () && ticks <= 0 ) {
566
- Rotation rot = toPlace .get ().rot ;
567
- baritone .getLookBehavior ().updateTarget (rot , true );
568
- ctx .player ().getInventory ().selected = toPlace .get ().hotbarSelection ;
569
- baritone .getInputOverrideHandler ().setInputForceState (Input .SNEAK , true );
570
- if ((ctx .isLookingAt (toPlace .get ().placeAgainst ) && ((BlockHitResult ) ctx .objectMouseOver ()).getDirection ().equals (toPlace .get ().side )) || ctx .playerRotations ().isReallyCloseTo (rot )) {
571
- baritone .getInputOverrideHandler ().setInputForceState (Input .CLICK_RIGHT , true );
568
+ logDebug ("We have " + toPlace .get ().size () + " placement options right now" );
569
+ int i = 0 ;
570
+ for (Placement placement : toPlace .get ()) {
571
+ if (i > Baritone .settings ().placementLimit .value ) break ;
572
+ i ++;
573
+
574
+ Rotation rot = placement .rot ;
575
+ baritone .getLookBehavior ().updateTarget (rot , true );
576
+ ctx .player ().getInventory ().selected = placement .hotbarSelection ;
577
+ baritone .getInputOverrideHandler ().setInputForceState (Input .SNEAK , true );
578
+ if ((ctx .isLookingAt (placement .placeAgainst ) &&
579
+ ((BlockHitResult ) ctx .objectMouseOver ()).getDirection ().equals (placement .side ))
580
+ || ctx .playerRotations ().isReallyCloseTo (rot )
581
+ ) {
582
+ baritone .getInputOverrideHandler ().setInputForceState (Input .CLICK_RIGHT , true );
583
+ }
572
584
}
573
585
return new PathingCommand (null , PathingCommandType .CANCEL_AND_SET_GOAL );
574
586
}
0 commit comments