Merge pull request #3735 from ZacSharp/pr/breakNextToLava

Allow breaking next to some liquids
This commit is contained in:
leijurv 2023-01-12 10:08:09 -08:00 committed by GitHub
commit fba3828479
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -107,6 +107,13 @@ public final class Settings {
*/ */
public final Setting<Double> walkOnWaterOnePenalty = new Setting<>(3D); public final Setting<Double> walkOnWaterOnePenalty = new Setting<>(3D);
/**
* Don't allow breaking blocks next to liquids.
* <p>
* Enable if you have mods adding custom fluid physics.
*/
public final Setting<Boolean> strictLiquidCheck = new Setting<>(false);
/** /**
* Allow Baritone to fall arbitrary distances and place a water bucket beneath it. * Allow Baritone to fall arbitrary distances and place a water bucket beneath it.
* Reliability: questionable. * Reliability: questionable.

View File

@ -79,7 +79,18 @@ public interface MovementHelper extends ActionCosts, Helper {
&& BlockFalling.canFallThrough(bsi.get0(x, y - 1, z))) { // and if it would fall (i.e. it's unsupported) && BlockFalling.canFallThrough(bsi.get0(x, y - 1, z))) { // and if it would fall (i.e. it's unsupported)
return true; // dont break a block that is adjacent to unsupported gravel because it can cause really weird stuff return true; // dont break a block that is adjacent to unsupported gravel because it can cause really weird stuff
} }
return block instanceof BlockLiquid; if (block instanceof BlockLiquid) {
if (directlyAbove || Baritone.settings().strictLiquidCheck.value) {
return true;
}
int level = state.getValue(BlockLiquid.LEVEL);
if (level == 0) {
return true; // source blocks like to flow horizontally
}
// everything else will prefer flowing down
return !(bsi.get0(x, y - 1, z).getBlock() instanceof BlockLiquid); // assume everything is in a static state
}
return false;
} }
static boolean canWalkThrough(IPlayerContext ctx, BetterBlockPos pos) { static boolean canWalkThrough(IPlayerContext ctx, BetterBlockPos pos) {