-
-
Notifications
You must be signed in to change notification settings - Fork 217
Fix spectating of other entities not working #4251
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
base: api-14
Are you sure you want to change the base?
Conversation
| } | ||
|
|
||
| thisPlayer.setCamera(thisPlayer); | ||
| thisPlayer.setCamera(thisPlayer.getCamera()); |
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.
This is equivalent to not calling setCamera at all. The line is here on purpose to stop spectating when changing dimension. The real problem is why is this line executed when the player is teleporting without changing dimension. I'm gonna investigate a bit.
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.
Turns out the method names impl$fireDimensionTransitionEvents and bridge$changeDimension are misleading. They are called for all teleports but have special treatment for actual dimension changes.
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.
Your fix causes positioning issues when spectating an entity and then teleporting. Whereas in pure vanilla it just stops spectating.
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.
Something worth to mention is that recent versions have changed the behavior of how passengers and spectators are teleported, and make sure we follow vanilla.
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.
Your fix causes positioning issues when spectating an entity and then teleporting. Whereas in pure vanilla it just stops spectating.
Nice catch! After digging into this, it seems the issue is caused because TeleportCommandMixin’s overwrite didn’t follow vanilla logic. In vanilla, the player’s camera would be set back to the player in teleportTo. I’ve opened #4252, another PR that restores the logic to match vanilla behavior.
Requires #4252