@@ -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,14 @@ 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
+
352
+ if (list .size () == Baritone .settings ().placementLimit .value ) return Optional .of (list );
351
353
}
352
354
}
353
355
}
356
+ if (!list .isEmpty ()) return Optional .of (list );
354
357
return Optional .empty ();
355
358
}
356
359
@@ -561,14 +564,20 @@ public int lengthZ() {
561
564
return new PathingCommand (null , PathingCommandType .CANCEL_AND_SET_GOAL );
562
565
}
563
566
List <BlockState > desirableOnHotbar = new ArrayList <>();
564
- Optional <Placement > toPlace = searchForPlacables (bcc , desirableOnHotbar );
567
+ Optional <List < Placement > > toPlace = searchForPlacables (bcc , desirableOnHotbar );
565
568
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 );
569
+ logDebug ("We have " + toPlace .get ().size () + " placement options right now" );
570
+ for (Placement placement : toPlace .get ()) {
571
+ Rotation rot = placement .rot ;
572
+ baritone .getLookBehavior ().updateTarget (rot , true );
573
+ ctx .player ().getInventory ().selected = placement .hotbarSelection ;
574
+ baritone .getInputOverrideHandler ().setInputForceState (Input .SNEAK , true );
575
+ if ((ctx .isLookingAt (placement .placeAgainst ) &&
576
+ ((BlockHitResult ) ctx .objectMouseOver ()).getDirection ().equals (placement .side ))
577
+ || ctx .playerRotations ().isReallyCloseTo (rot )
578
+ ) {
579
+ baritone .getInputOverrideHandler ().setInputForceState (Input .CLICK_RIGHT , true );
580
+ }
572
581
}
573
582
return new PathingCommand (null , PathingCommandType .CANCEL_AND_SET_GOAL );
574
583
}
0 commit comments