baritone icon indicating copy to clipboard operation
baritone copied to clipboard

Fix for infinite loop in water

Open scorbett123 opened this issue 3 years ago • 3 comments

This is a slightly dodgy solution, however it is the simplest one I could think of.

Description of issue

When a fall into more than 2 block deep water occurs baritone enters an infinite loop as we swim up, to the surface, and end the movement when we "jump" above the water, this means that our position isn't in the valid positions of a traverse movement. And thus some of the lag protection jumps in and resets us to the fall (as this is a valid position for during the fall), entering an infinite loop.

Closes #3200.

If anyone can think of a better solution to this please let me know

scorbett123 avatar Aug 30 '22 17:08 scorbett123

would some kind of isWater check make this less dodgy?

wagyourtail avatar Aug 30 '22 18:08 wagyourtail

would some kind of isWater check make this less dodgy?

It would but that would complicate things and I can't really think of a situation in which this will really do any harm, if someone can think of one then then I'll add a check, but otherwise I think it is just unnecessary complication.

scorbett123 avatar Aug 30 '22 20:08 scorbett123

If Baritone mines straight down and then traverses (tunneling under a lava lake?) but the server lags right after the the last MovementDownward ended, setting Baritone back to the beginning of the last MovementDownward before the block was mined, this will cause the path to fail after 5-10s instead of fixing it instantly. Treating a position A as valid because the position B below it is valid should only be allowed if B is canWalkThrough and not canWalkOn (or even better, only if the player is actually unsupported).

ZacSharp avatar Aug 31 '22 15:08 ZacSharp

This now should instead make baritone only swim up to 0.6 of a way through a block, so instead of jumping out above the water we just swim along through it.

scorbett123 avatar Oct 03 '22 20:10 scorbett123

shouldn't this have targeted 1.16.5?

wagyourtail avatar Oct 04 '22 22:10 wagyourtail

If this is because of post-aquatic swimming mechanics then yes. Though I don't think master would be that wrong either.

ZacSharp avatar Oct 04 '22 22:10 ZacSharp

shouldn't this have targeted 1.16.5?

Do we still support 1.16.5? If so then probably, but thought we'd decided to deprecate it.

scorbett123 avatar Oct 05 '22 07:10 scorbett123

Iirc it got un deprecated

wagyourtail avatar Oct 05 '22 07:10 wagyourtail

Oh, ok, I missed that, this could probably just go on master so I'll make a pr for that later.

scorbett123 avatar Oct 05 '22 07:10 scorbett123