This commit is contained in:
Brady 2020-03-07 17:34:27 -06:00
parent 217e0da4a6
commit c8856cfea4
No known key found for this signature in database
GPG Key ID: 73A788379A197567

View File

@ -206,7 +206,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
continue; // irrelevant continue; // irrelevant
} }
IBlockState curr = bcc.bsi.get0(x, y, z); IBlockState curr = bcc.bsi.get0(x, y, z);
if (curr.getBlock() != Blocks.AIR && !(curr.getBlock() instanceof BlockLiquid) && !valid(curr, desired)) { if (curr.getBlock() != Blocks.AIR && !(curr.getBlock() instanceof BlockLiquid) && !valid(curr, desired, false)) {
BetterBlockPos pos = new BetterBlockPos(x, y, z); BetterBlockPos pos = new BetterBlockPos(x, y, z);
Optional<Rotation> rot = RotationUtils.reachable(ctx.player(), pos, ctx.playerController().getBlockReachDistance()); Optional<Rotation> rot = RotationUtils.reachable(ctx.player(), pos, ctx.playerController().getBlockReachDistance());
if (rot.isPresent()) { if (rot.isPresent()) {
@ -247,7 +247,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
continue; // irrelevant continue; // irrelevant
} }
IBlockState curr = bcc.bsi.get0(x, y, z); IBlockState curr = bcc.bsi.get0(x, y, z);
if (MovementHelper.isReplaceable(x, y, z, curr, bcc.bsi) && !valid(curr, desired)) { if (MovementHelper.isReplaceable(x, y, z, curr, bcc.bsi) && !valid(curr, desired, false)) {
if (dy == 1 && bcc.bsi.get0(x, y + 1, z).getBlock() == Blocks.AIR) { if (dy == 1 && bcc.bsi.get0(x, y + 1, z).getBlock() == Blocks.AIR) {
continue; continue;
} }
@ -314,7 +314,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
); );
ctx.player().rotationYaw = originalYaw; ctx.player().rotationYaw = originalYaw;
ctx.player().rotationPitch = originalPitch; ctx.player().rotationPitch = originalPitch;
if (valid(wouldBePlaced, desired)) { if (valid(wouldBePlaced, desired, true)) {
return OptionalInt.of(i); return OptionalInt.of(i);
} }
} }
@ -457,7 +457,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
outer: outer:
for (IBlockState desired : desirableOnHotbar) { for (IBlockState desired : desirableOnHotbar) {
for (int i = 0; i < 9; i++) { for (int i = 0; i < 9; i++) {
if (valid(approxPlaceable.get(i), desired)) { if (valid(approxPlaceable.get(i), desired, true)) {
usefulSlots.add(i); usefulSlots.add(i);
continue outer; continue outer;
} }
@ -468,7 +468,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
outer: outer:
for (int i = 9; i < 36; i++) { for (int i = 9; i < 36; i++) {
for (IBlockState desired : noValidHotbarOption) { for (IBlockState desired : noValidHotbarOption) {
if (valid(approxPlaceable.get(i), desired)) { if (valid(approxPlaceable.get(i), desired, true)) {
baritone.getInventoryBehavior().attemptToPutOnHotbar(i, usefulSlots::contains); baritone.getInventoryBehavior().attemptToPutOnHotbar(i, usefulSlots::contains);
break outer; break outer;
} }
@ -524,7 +524,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (desired != null) { if (desired != null) {
// we care about this position // we care about this position
BetterBlockPos pos = new BetterBlockPos(x, y, z); BetterBlockPos pos = new BetterBlockPos(x, y, z);
if (valid(bcc.bsi.get0(x, y, z), desired)) { if (valid(bcc.bsi.get0(x, y, z), desired, false)) {
incorrectPositions.remove(pos); incorrectPositions.remove(pos);
observedCompleted.add(BetterBlockPos.longHash(pos)); observedCompleted.add(BetterBlockPos.longHash(pos));
} else { } else {
@ -551,7 +551,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
} }
if (bcc.bsi.worldContainsLoadedChunk(blockX, blockZ)) { // check if its in render distance, not if its in cache if (bcc.bsi.worldContainsLoadedChunk(blockX, blockZ)) { // check if its in render distance, not if its in cache
// we can directly observe this block, it is in render distance // we can directly observe this block, it is in render distance
if (valid(bcc.bsi.get0(blockX, blockY, blockZ), schematic.desiredState(x, y, z, current, this.approxPlaceable))) { if (valid(bcc.bsi.get0(blockX, blockY, blockZ), schematic.desiredState(x, y, z, current, this.approxPlaceable), false)) {
observedCompleted.add(BetterBlockPos.longHash(blockX, blockY, blockZ)); observedCompleted.add(BetterBlockPos.longHash(blockX, blockY, blockZ));
} else { } else {
incorrectPositions.add(new BetterBlockPos(blockX, blockY, blockZ)); incorrectPositions.add(new BetterBlockPos(blockX, blockY, blockZ));
@ -769,7 +769,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
return result; return result;
} }
private boolean valid(IBlockState current, IBlockState desired) { private boolean valid(IBlockState current, IBlockState desired, boolean itemVerify) {
if (desired == null) { if (desired == null) {
return true; return true;
} }
@ -780,7 +780,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (desired.getBlock() instanceof BlockAir && Baritone.settings().buildIgnoreBlocks.value.contains(current.getBlock())) { if (desired.getBlock() instanceof BlockAir && Baritone.settings().buildIgnoreBlocks.value.contains(current.getBlock())) {
return true; return true;
} }
if (!(current.getBlock() instanceof BlockAir) && Baritone.settings().buildIgnoreExisting.value) { if (!(current.getBlock() instanceof BlockAir) && Baritone.settings().buildIgnoreExisting.value && !itemVerify) {
return true; return true;
} }
return current.equals(desired); return current.equals(desired);
@ -862,7 +862,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
} }
// it should be a real block // it should be a real block
// is it already that block? // is it already that block?
if (valid(bsi.get0(x, y, z), sch)) { if (valid(bsi.get0(x, y, z), sch, false)) {
return Baritone.settings().breakCorrectBlockPenaltyMultiplier.value; return Baritone.settings().breakCorrectBlockPenaltyMultiplier.value;
} else { } else {
// can break if it's wrong // can break if it's wrong