mojira.dev
MC-308667

Whether the local player has movement authority when riding a stack of multiple mobs is unclearly defined

Explanation:
Mobs in Minecraft can either have Players (when wearing a saddle or similar) or other Mobs as controlling passengers. In a stack of Entities with each being a controlling passenger of the one below, most decisions regarding what Entity actually gets to control movement of the stack are met on the server.
If the local player is included in such a stack, the client needs to decide on whether to take over full control over the stack, or leave the movement of the root entity to the server. It does this by iterating over the controlling passengers starting from the root entity and determining if the first player in that chain is local (Entity::isLocalClientAuthorative). However, the local player is only ever actually able to control the movement of the root entity by itself when being a controlling passenger of the root entity directly.
This mismatch of what side is authorative over controlling a stack of entities can cause some untypical behaviour and client/server desyncs.

From now on we’ll be considering a single example of the local player riding a saddled Pig riding a Horse for simplicity. If the local player is not holding a carrot on a stick, the authority of the stack is left to the server and everything works fine. When the local player starts holding the carrot on a stick, some parts of the game believe that the client should be authorative over the horse’s movement. Since it isn’t directly controlled by a player, it runs LivingEntity::travel instead of the designated LivingEntity::travelRidden, which causes it to keep moving in the direction it’s currently going with very low drag.
Additionally, the client only sends Serverbound Move Vehicle packets if the local player is a controlling passenger of the root vehicle/entity, so the server and the client logically desync on the root entity’s position.

I have attached a video (pig_on_horse.mp4) showcasing these bugs.

How to reproduce:

Step 1: Summon a pig riding a horse (e.g. /summon horse ~ ~ ~ {Passengers:[{id:pig}]} )
Step 2: Put a saddle on the pig and a carrot on a stick in your hotbar
Step 3: Mount the pig while not currently holding the carrot on a stick
Step 4: Wait for the entity stack to start moving
Step 5: Equip the carrot on a stick while the entity stack is moving
Step 6: Unequip the carrot on a stick once the entity stack has moved a decent amount

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media]

Z0rty

(Unassigned)

Confirmed

Platform

Low

Mob behaviour

26.2 Pre-Release 4

Retrieved