@@ -325,7 +325,9 @@ public Placement(int hotbarSelection, BlockPos placeAgainst, Direction side, Rot
325325 }
326326 }
327327
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+
329331 BetterBlockPos center = ctx .playerFeet ();
330332 for (int dx = -5 ; dx <= 5 ; dx ++) {
331333 for (int dy = -5 ; dy <= 1 ; dy ++) {
@@ -344,13 +346,14 @@ private Optional<Placement> searchForPlacables(BuilderCalculationContext bcc, Li
344346 }
345347 desirableOnHotbar .add (desired );
346348 Optional <Placement > opt = possibleToPlace (desired , x , y , z , bcc .bsi );
347- if (opt .isPresent ()) {
348- return opt ;
349- }
349+ opt .ifPresent (list ::add );
350350 }
351+
352+ if (list .size () == Baritone .settings ().placementLimit .value ) return Optional .of (list );
351353 }
352354 }
353355 }
356+ if (!list .isEmpty ()) return Optional .of (list );
354357 return Optional .empty ();
355358 }
356359
@@ -561,14 +564,20 @@ public int lengthZ() {
561564 return new PathingCommand (null , PathingCommandType .CANCEL_AND_SET_GOAL );
562565 }
563566 List <BlockState > desirableOnHotbar = new ArrayList <>();
564- Optional <Placement > toPlace = searchForPlacables (bcc , desirableOnHotbar );
567+ Optional <List < Placement > > toPlace = searchForPlacables (bcc , desirableOnHotbar );
565568 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+ }
572581 }
573582 return new PathingCommand (null , PathingCommandType .CANCEL_AND_SET_GOAL );
574583 }
0 commit comments