Merge branch '1.13.2' into 1.14.4

This commit is contained in:
Leijurv
2019-08-20 14:33:18 -07:00
5 changed files with 71 additions and 22 deletions

View File

@@ -26,7 +26,11 @@ import net.minecraft.block.Blocks;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.item.*;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.Vec3d;
import java.util.ArrayList;
import java.util.OptionalInt;
@@ -132,9 +136,12 @@ public final class InventoryBehavior extends Behavior {
public boolean selectThrowawayForLocation(boolean select, int x, int y, int z) {
BlockState maybe = baritone.getBuilderProcess().placeAt(x, y, z);
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock().equals(maybe.getBlock()))) {
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof BlockItem && maybe.equals(((BlockItem) stack.getItem()).getBlock().getStateForPlacement(new BlockItemUseContext(new ItemUseContext(ctx.world(), ctx.player(), Hand.MAIN_HAND, stack, new BlockRayTraceResult(new Vec3d(ctx.player().posX, ctx.player().posY, ctx.player().posZ), Direction.UP, ctx.playerFeet(), false)) {}))))) {
return true; // gotem
}
if (maybe != null && throwaway(select, stack -> stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock().equals(maybe.getBlock()))) {
return true;
}
for (Item item : Baritone.settings().acceptableThrowawayItems.value) {
if (throwaway(select, stack -> item.equals(stack.getItem()))) {
return true;

View File

@@ -34,6 +34,7 @@ import baritone.utils.BaritoneProcessHelper;
import baritone.utils.BlockStateInterface;
import baritone.utils.PathingCommandContext;
import baritone.utils.schematic.AirSchematic;
import baritone.utils.schematic.MapArtSchematic;
import baritone.utils.schematic.Schematic;
import baritone.utils.schematic.schematica.SchematicaHelper;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
@@ -134,7 +135,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
}
private static ISchematic parse(CompoundNBT schematic) {
return new Schematic(schematic);
return Baritone.settings().mapArtMode.value ? new MapArtSchematic(schematic) : new Schematic(schematic);
}
@Override
@@ -528,6 +529,9 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
} else {
incorrectPositions.add(new BetterBlockPos(blockX, blockY, blockZ));
observedCompleted.remove(BetterBlockPos.longHash(blockX, blockY, blockZ));
if (incorrectPositions.size() > Baritone.settings().incorrectSize.value) {
return;
}
}
continue;
}
@@ -536,6 +540,9 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
// and we've never seen this position be correct
// therefore mark as incorrect
incorrectPositions.add(new BetterBlockPos(blockX, blockY, blockZ));
if (incorrectPositions.size() > Baritone.settings().incorrectSize.value) {
return;
}
}
}
}
@@ -634,7 +641,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
boolean allowSameLevel = !(ctx.world().getBlockState(pos.up()).getBlock() instanceof AirBlock);
for (Direction facing : Movement.HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP) {
if (MovementHelper.canPlaceAgainst(ctx, pos.offset(facing)) && placementPlausible(pos, bcc.getSchematic(pos.getX(), pos.getY(), pos.getZ()))) {
return new GoalAdjacent(pos, allowSameLevel);
return new GoalAdjacent(pos, pos.offset(facing), allowSameLevel);
}
}
return new GoalPlace(pos);
@@ -657,9 +664,11 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
public static class GoalAdjacent extends GoalGetToBlock {
private boolean allowSameLevel;
private BlockPos no;
public GoalAdjacent(BlockPos pos, boolean allowSameLevel) {
public GoalAdjacent(BlockPos pos, BlockPos no, boolean allowSameLevel) {
super(pos);
this.no = no;
this.allowSameLevel = allowSameLevel;
}
@@ -667,6 +676,9 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (x == this.x && y == this.y && z == this.z) {
return false;
}
if (x == no.getX() && y == no.getY() && z == no.getZ()) {
return false;
}
if (!allowSameLevel && y == this.y - 1) {
return false;
}
@@ -731,6 +743,9 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (current.getBlock() instanceof AirBlock && desired.getBlock() instanceof AirBlock) {
return true;
}
if ((current.getBlock() == Blocks.WATER || current.getBlock() == Blocks.LAVA) && Baritone.settings().okIfWater.value) {
return true;
}
// TODO more complicated comparison logic I guess
return current.equals(desired);
}
@@ -811,7 +826,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
// it should be a real block
// is it already that block?
if (valid(bsi.get0(x, y, z), sch)) {
return 3;
return Baritone.settings().breakCorrectBlockPenaltyMultiplier.value;
} else {
// can break if it's wrong
// would be great to return less than 1 here, but that would actually make the cost calculation messed up