Reorganize

This commit is contained in:
Brady 2023-07-01 22:19:51 -05:00
parent 15621ea763
commit 7f27c9d85f
No known key found for this signature in database
GPG Key ID: 73A788379A197567
2 changed files with 21 additions and 7 deletions

View File

@ -164,13 +164,27 @@ public final class InventoryBehavior extends Behavior implements Helper {
public boolean selectThrowawayForLocation(boolean select, int x, int y, int z) {
IBlockState maybe = baritone.getBuilderProcess().placeAt(x, y, z, baritone.bsi.get0(x, y, z));
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof ItemBlock && maybe.equals(((ItemBlock) stack.getItem()).getBlock().getStateForPlacement(ctx.world(), ctx.playerFeet(), EnumFacing.UP, (float) ctx.player().posX, (float) ctx.player().posY, (float) ctx.player().posZ, stack.getItem().getMetadata(stack.getMetadata()), ctx.player())))) {
return true; // gotem
if (maybe != null) {
return this.throwaway(select, stack -> {
if (!(stack.getItem() instanceof ItemBlock)) {
return false;
}
Block block = ((ItemBlock) stack.getItem()).getBlock();
return maybe.equals(block.getStateForPlacement(
ctx.world(),
ctx.playerFeet(),
EnumFacing.UP,
0.5f, 1.0f, 0.5f,
stack.getItem().getMetadata(stack.getMetadata()),
ctx.player()
));
}) || this.throwaway(select, stack -> {
// Since a stack didn't match the desired block state, accept a match of just the block
return stack.getItem() instanceof ItemBlock
&& ((ItemBlock) stack.getItem()).getBlock().equals(maybe.getBlock());
});
}
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof ItemBlock && ((ItemBlock) stack.getItem()).getBlock().equals(maybe.getBlock()))) {
return true;
}
return throwaway(select, this::isThrowawayItem);
return this.throwaway(select, this::isThrowawayItem);
}
public boolean canSelectItem(Predicate<? super ItemStack> desired) {

View File

@ -38,7 +38,7 @@ import java.util.function.Function;
*
* @author Avery, Brady, leijurv
*/
public class ToolSet {
public final class ToolSet {
/**
* A cache mapping a {@link Block} to how long it will take to break