Skip to content

fix: dodge compatibility with BetterThirdPerson#386

Open
Farenheith wants to merge 3 commits intoalRex-U:mainfrom
Farenheith:compatibility-better-third-person
Open

fix: dodge compatibility with BetterThirdPerson#386
Farenheith wants to merge 3 commits intoalRex-U:mainfrom
Farenheith:compatibility-better-third-person

Conversation

@Farenheith
Copy link
Contributor

@Farenheith Farenheith commented May 14, 2025

Solves #383

MovementInputMixin captures keyboard movement input at its most raw moment, and serves the purpose of accessing its values before any transformation Minecraft or BetterThirdPerson do. It'll always provide a movement vector not even aligned with world coordinates.

The InputUpdateEvent is the second entry point for movement events, which will serve the purpose of capturing movements done by gamepads. An if is made to ignore the event if a keyboard movement input has not been consumed yet. Why? Because BetterThirdPerson captures both moments and manipulates the vector in both of them, we need to do the same in order not to access already transformed inputs.

When the captured vector is consumed, an alignment to the current camera is done so it'll correspond to the direction the player wants. The camera can be defined by BetterThirdPerson, ShoulderSurfing, or the vanilla one, depending on which option the player is using. The alignment is only done during the getLastMoveVector call as it'll be called by the Dodge action once it confirms a dodge must be done, so we avoid doing unneeded calculations at each input, and we give a chance to the camera mods to do their thing with the perspective.

This way, we solve keyboard and gamepad users, and they have a working dodge with BetterThirdPerson.

This approach has also been tested with ShoulderSurfing and Vanilla Camera, and it works equally with every one of them.

I haven't tested it with Controlify, though, as it doesn't support Minecraft 1.16.5 or Forge. I'll revisit the topic once this PR is accepted and the modification is ported to a compatible version. I tested it only with controllable. Also tested with controlify (see #390)

@Farenheith Farenheith force-pushed the compatibility-better-third-person branch 2 times, most recently from a763f4d to 746c506 Compare May 14, 2025 11:52
@Farenheith Farenheith force-pushed the compatibility-better-third-person branch 3 times, most recently from ea4e6e2 to 2ab93cb Compare May 15, 2025 03:17
@Farenheith Farenheith marked this pull request as ready for review May 15, 2025 03:24
@Farenheith
Copy link
Contributor Author

@alRex-U this is ready for review! Thank you for the discussion in the issue! It really helped me to find a way to solve the problem.

@Farenheith Farenheith force-pushed the compatibility-better-third-person branch from 2ab93cb to a3218be Compare May 15, 2025 04:03
@Farenheith Farenheith force-pushed the compatibility-better-third-person branch from a3218be to 5df7957 Compare May 15, 2025 04:03
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.

1 participant