-
Notifications
You must be signed in to change notification settings - Fork 420
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
Fixed entity rotations #2596
Conversation
Fixed entity yaw and pitch not changing when entity moves head.
MinecraftClient/McClient.cs
Outdated
entities[EntityID].Yaw = _yaw * (1F / 256) * 360; | ||
entities[EntityID].Pitch = _pitch * (1F / 256) * 360; |
There was a problem hiding this comment.
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
There was a problem hiding this 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
@@ -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) |
There was a problem hiding this comment.
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) { } |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method document comment.
Good job. Thanks for your work. Merging your PR. |
Fixed entity yaw and pitch not changing when an entity/player moves their head.