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

Fixed entity rotations #2596

Merged
merged 7 commits into from
Oct 11, 2023
Merged

Fixed entity rotations #2596

merged 7 commits into from
Oct 11, 2023

Conversation

Domracz
Copy link
Contributor

@Domracz Domracz commented Oct 7, 2023

Fixed entity yaw and pitch not changing when an entity/player moves their head.

Fixed entity yaw and pitch not changing when entity moves head.
Comment on lines 3166 to 3167
entities[EntityID].Yaw = _yaw * (1F / 256) * 360;
entities[EntityID].Pitch = _pitch * (1F / 256) * 360;
Copy link
Member

Choose a reason for hiding this comment

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

The yaw and pitch calculation should be done in Protocol18 before passing to handler so that:

  • Client handler don't need to care about protocol (e.g. how to convert the byte back to yaw and pitch)
  • If there's some update to the protocol (data type or calculation change), client handler can remain untouched

Copy link
Member

@ReinforceZwei ReinforceZwei left a comment

Choose a reason for hiding this comment

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

Hi, thanks for your contribution. Just add back the method document comment and we can merge your PR.

MinecraftClient/McClient.cs Outdated Show resolved Hide resolved
@@ -3168,6 +3184,16 @@ public void OnEntityPosition(int EntityID, Double Dx, Double Dy, Double Dz, bool

}

public void OnEntityRotation(int EntityID, byte _yaw, byte _pitch, bool onGround)
Copy link
Member

Choose a reason for hiding this comment

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

Add method document comment.

@@ -195,6 +195,8 @@ public void UpdateInternal()
/// <param name="entity">Entity with updated location</param>
public virtual void OnEntityMove(Entity entity) { }

public virtual void OnEntityRotate(Entity entity) { }
Copy link
Member

Choose a reason for hiding this comment

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

Method document comment.

void OnEntityPosition(int entityID, Double dx, Double dy, Double dz, bool onGround);
void OnEntityRotation(int entityID, byte yaw, byte pitch, bool onGround);
Copy link
Member

Choose a reason for hiding this comment

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

Method document comment.

@ReinforceZwei
Copy link
Member

Good job. Thanks for your work. Merging your PR.

@ReinforceZwei ReinforceZwei merged commit 1aea8d3 into MCCTeam:master Oct 11, 2023
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.

2 participants