baritone icon indicating copy to clipboard operation
baritone copied to clipboard

Tunnel command doesnt respect blocks to avoid

Open dukedagmor opened this issue 9 months ago • 4 comments

How to reproduce

#blocksToAvoid cave_air then #tunnel

the tunnel will not avoid cave_air

Image

Modified settings

Image

dukedagmor avatar Mar 14 '25 13:03 dukedagmor

That's because for performance reasons air is special cased and shortcuts the passability check before checking the setting (see here). Reordering the check might be acceptable for performance (that method is now cached), but returning "NO" for air would rarely be what you want.

ZacSharp avatar Mar 14 '25 21:03 ZacSharp

Would it be worth adding an override setting for this specific case? (Even more settings 😅)

dukedagmor avatar Mar 15 '25 12:03 dukedagmor

Just counted (with Ctrl-f) and we have 240 settings already...

I'm thinking about reducing the shortcut to just normal air and void air, moving the _ instanceof AirBlock to happen after the setting check. That way you can "turn caves into obstacles" while still not being able to do so for normal air, which I think would be a bad idea. Air being passable is a pretty fundamental assumption. But then again, users rarely care (or even know) which kind of air they are dealing with, so I do have a preference for treating them all the same, or even as one block.

Basically, here's the diff I'm considering
-        if (block instanceof AirBlock) {
+        if (block == Blocks.AIR) {
            return YES;
        }
         if (block instanceof BaseFireBlock || block == Blocks.TRIPWIRE || block == Blocks.COBWEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof AbstractSkullBlock || block == Blocks.BUBBLE_COLUMN || block instanceof ShulkerBoxBlock || block instanceof SlabBlock || block instanceof TrapDoorBlock || block == Blocks.HONEY_BLOCK || block == Blocks.END_ROD || block == Blocks.SWEET_BERRY_BUSH || block == Blocks.POINTED_DRIPSTONE || block instanceof AmethystClusterBlock || block instanceof AzaleaBlock) {
             return NO;
         }
         if (block == Blocks.BIG_DRIPLEAF) {
             return NO;
         }
         if (block == Blocks.POWDER_SNOW) {
             return NO;
         }
         if (Baritone.settings().blocksToAvoid.value.contains(block)) {
             return NO;
         }
+        if (block instanceof AirBlock) {
+            return YES;
+        }

ZacSharp avatar Mar 15 '25 15:03 ZacSharp

Looks like that's not quite enough...

Image

ZacSharp avatar Mar 23 '25 17:03 ZacSharp