Merge branch 'cabaletta:master' into master

This commit is contained in:
rycbar0 2022-12-19 10:34:57 +01:00 committed by GitHub
commit d60e1e8a05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 3 deletions

View File

@ -279,6 +279,12 @@ public final class Settings {
*/ */
public final Setting<Boolean> buildIgnoreDirection = new Setting<>(false); public final Setting<Boolean> buildIgnoreDirection = new Setting<>(false);
/**
* A list of names of block properties the builder will ignore.
*/
public final Setting<List<String>> buildIgnoreProperties = new Setting<>(new ArrayList<>(Arrays.asList(
)));
/** /**
* If this setting is true, Baritone will never break a block that is adjacent to an unsupported falling block. * If this setting is true, Baritone will never break a block that is adjacent to an unsupported falling block.
* <p> * <p>

View File

@ -56,6 +56,7 @@ public class ExecutionControlCommands {
@Override @Override
public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) {
baritone.getInputOverrideHandler().clearAllKeys();
return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE); return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE);
} }

View File

@ -874,14 +874,21 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
BlockTrapDoor.OPEN, BlockTrapDoor.HALF BlockTrapDoor.OPEN, BlockTrapDoor.HALF
); );
private boolean sameWithoutOrientation(IBlockState first, IBlockState second) { private boolean sameBlockstate(IBlockState first, IBlockState second) {
if (first.getBlock() != second.getBlock()) { if (first.getBlock() != second.getBlock()) {
return false; return false;
} }
boolean ignoreDirection = Baritone.settings().buildIgnoreDirection.value;
List<String> ignoredProps = Baritone.settings().buildIgnoreProperties.value;
if (!ignoreDirection && ignoredProps.isEmpty()) {
return first.equals(second); // early return if no properties are being ignored
}
ImmutableMap<IProperty<?>, Comparable<?>> map1 = first.getProperties(); ImmutableMap<IProperty<?>, Comparable<?>> map1 = first.getProperties();
ImmutableMap<IProperty<?>, Comparable<?>> map2 = second.getProperties(); ImmutableMap<IProperty<?>, Comparable<?>> map2 = second.getProperties();
for (IProperty<?> prop : map1.keySet()) { for (IProperty<?> prop : map1.keySet()) {
if (map1.get(prop) != map2.get(prop) && !orientationProps.contains(prop)) { if (map1.get(prop) != map2.get(prop)
&& !(ignoreDirection && orientationProps.contains(prop))
&& !ignoredProps.contains(prop.getName())) {
return false; return false;
} }
} }
@ -913,7 +920,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil
if (current.equals(desired)) { if (current.equals(desired)) {
return true; return true;
} }
return Baritone.settings().buildIgnoreDirection.value && sameWithoutOrientation(current, desired); return sameBlockstate(current, desired);
} }
public class BuilderCalculationContext extends CalculationContext { public class BuilderCalculationContext extends CalculationContext {