Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swimming #3988

Open
wants to merge 1 commit into
base: 1.19.4
Choose a base branch
from
Open

swimming #3988

wants to merge 1 commit into from

Conversation

leijurv
Copy link
Member

@leijurv leijurv commented Jun 14, 2023

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)

@@ -730,6 +731,11 @@ public final class Settings {
*/
public final Setting<Boolean> sprintInWater = new Setting<>(true);

/**
* Attempt to enter the underwater swimming state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aka California after the big earthquake hits

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so true

@ZacSharp
Copy link
Collaborator

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.

@leijurv
Copy link
Member Author

leijurv commented Jun 15, 2023

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.

@ZeroMemes
Copy link
Member

Perhaps the RotationMoveEvent change from elytra-freelook is needed?? bde0c62

@ZacSharp
Copy link
Collaborator

Actually, I didn't mean the code.

I meant this
2023-06-16.01-51-04.mp4

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants