baritone icon indicating copy to clipboard operation
baritone copied to clipboard

swimming

Open leijurv opened this issue 2 years ago • 5 comments

someone else test this i am TOO TIRED and i hate swimming mechanics (this is why i have put this off even though swimming was added to minecraft before baritone even started)

leijurv avatar Jun 14 '23 05:06 leijurv

The fact that this works is kinda stupid. Why doesn't looking up make you bob out of the water like pressing space does?

Anyway, MovementDiagonal doesn't actually sprint swim and this (explicitly) ignores freeLook. I wonder whether moving the autoswim before the movement update would break anything. That way movements could explicitly unpress space instead of being a special case when pressing space.

ZacSharp avatar Jun 15 '23 02:06 ZacSharp

Yeah I agree that this is stupid and badly written I just wanted to see if it would work.

I picked pitch -30 because in my testing, that pitch always gets the player's head out of the water so that they don't drown, but never ends swimming by going too high.

Once brady's (@ZeroMemes 's) recent PRs are merged up, this could use the movement freelook from there. But for now, I found that the pitch was not freelookable. Meaning, if I just set the pitch as a movement target with force=false, it actually did not affect swimming direction sadly. IDK if this is a 1.13+ thing or what.

Yes, the same logic should be added to MovementDiagonal to begin swimming.

leijurv avatar Jun 15 '23 03:06 leijurv

Perhaps the RotationMoveEvent change from elytra-freelook is needed?? https://github.com/cabaletta/baritone/commit/bde0c620ad6270cbd363140ab6be8aa49370644d

ZeroMemes avatar Jun 15 '23 04:06 ZeroMemes

Actually, I didn't mean the code.

I meant this

https://github.com/cabaletta/baritone/assets/68165024/9a5f75a8-193f-4f4d-98f1-f0c1714a6d34

Even looking straight up won't stop it. The only thing that happens if you look too far up is that momentum can carry you out of the water so starting can take a second or third attempt.

Once brady's recent PRs are merged up, this could use the movement freelook from there

Ok. In progress.

ZacSharp avatar Jun 16 '23 00:06 ZacSharp

I tried this on out 1.16 with all of current master merged in and some changes to accommodate for changes in swimming mechanics (you need to press space to get high enough). The player pitch is read in PlayerEntity.travel, which is above the elytra injection pair in the call hierarchy. To make swimming freelookable we'd either have to cover the entirety of that method with an injection pair or add one more targeted injection (pair) for just that span (didn't yet test the latter). That RotationMoveEvent change will/did certainly come in handy.

ZacSharp avatar Jun 24 '23 00:06 ZacSharp