-
Bug
-
Resolution: Fixed
-
1.21.2 Pre-Release 5
-
None
-
Plausible
-
Networking
-
Important
-
Platform
Since 1.21.2 snapshots, it is possible for the vanilla client to reject a set passengers packet for vehicles that the client thinks don't support having a passenger.
For example, when sending a ClientboundSetPassengersPacket to the client with a player as vehicle, the client won't add the passengers to the player entity. This is because the client thinks the player is unable to support a passenger.
When handling this packet, the startRiding method is called with the "force" parameter set to true, so it is expected that the client applies the passengers it received from the server, without checking whether that would actually be possible if it were the server.
Related code in the startRiding method:
public boolean startRiding(Entity vehicle, boolean force) { if (vehicle == this.vehicle) { return false; } else if (vehicle.couldAcceptPassenger() && vehicle.type.canSerialize()) { ... } else { return false; } }
For the example mentioned before, the player entity type has `canSerialize` set to false, which causes the client to think it is unable to support a passenger.
A solution is to ignore the
vehicle.couldAcceptPassenger() && vehicle.type.canSerialize()
check on the client side when "force" is set to true.
This bug breaks server-side only plugins like GSit which allow players to "sit" on other players by clicking them.