Baritone AI pathfinder

Baritone AI pathfinder

72.7k Downloads

Pathfinding can fail with `IllegalStateException` when sneaking off a block

Closed this issue ยท 7 comments

commented

Some information

Operating system: Linux
Java version: 21
Minecraft version: 1.20.6
Baritone version: fd8af9b
Other mods (if used): Litematica 1.18.1 + Malilib 1.19.0

(i.e. the workspace I used to test #4527)

Exception, error or logs

[16:31:28] [Render thread/INFO]: [CHAT] [Baritone] > path
[16:31:28] [Render thread/INFO]: [CHAT] [Baritone] Now pathing
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]: java.lang.IllegalStateException: Path doubles back on itself, making a loop
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]:    at baritone.api.pathing.calc.IPath.sanityCheck(IPath.java:174)
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]:    at baritone.pathing.calc.Path.postProcess(Path.java:156)
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]:    at java.base/java.util.Optional.map(Optional.java:260)
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]:    at baritone.pathing.calc.AbstractNodeCostSearch.calculate(AbstractNodeCostSearch.java:106)
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]:    at baritone.behavior.PathingBehavior.lambda$findPathInNewThread$2(PathingBehavior.java:506)
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]:    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]:    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[16:31:28] [pool-6-thread-3/INFO]: [STDERR]:    at java.base/java.lang.Thread.run(Thread.java:1583)

How to reproduce

Sneak off of an edge and set a goal such that the shortest path from the supporting block to the goal leads through your current position, then start the pathfinder.
E.g. like this:
2024-10-20_16 31 28

Modified settings

None

Final checklist

  • I know how to properly use check boxes
  • I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
  • I have included logs, exceptions and / or steps to reproduce the issue.
  • I have not inserted any OwO's or UwU's into this issue.
commented

Couldn't reproduce. Do you have baritone somehow configured so that it walks over the hole? I don't get an error if it parkours over the hole or falls into it.

commented

Yes, I used default settings (i.e. no parkour) and had a dirt block in my hand so it would scaffold back over the hole.

commented

This is indeed a tricky case because the "correct" path here does indeed double back on itself!

commented

I think we can either fix the sanity check so it runs before we add the new node or only add the node if A* returned nothing (should be equal to checking if pathStart = goal like in the original solution)

commented

only add the node if A* returned nothing

not sure if that works, wouldn't that make it fall into the hole in this example without placing the block? or no?

commented

The pathfinder would still start above the supporting block so no, unless it also did so for the last couple years.

commented

It would just make it walk onto the supporting block(pathStart()) which should be the goal if A* returned nothing