Affects Version/s: 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 1.16.4, 20w49a, 20w51a, 1.16.5
Fix Version/s: 21w03a
In 1.16 a change was made that allows the client to run the code to dismount their current vehicle. This change should be reverted as allowing the client to dismount vehicles makes the server unable to keep a player in a vehicle. If the player keeps the shift key pressed the server is completely unable to put them in any vehicle because the player will immediately dismount.
This used to work in 1.15.2 and before.
This change also likely lead to related issues such as
MC-191714 as the client can now decide to stop riding a vehicle without informing the server properly. Related issues likely occur because the information that the player is sneaking is not immediately send so the server may never know the player is sneaking and as such never dismount them whilst the client did dismount them. As @Bytzo pointed out the change causing this issue did not cause the other mentioned issue.
As @Bytzo later discovered a different change did lead to related issues.
The ability to keep players in a vehicle is used by various servers for features like custom camera's, rollercoasters or for various minigames based around vehicles like jousting or Hypixel's Turbo Kart Racers. We use it for our camera paths as well as unrevealed content in MC Championship.
- Add code to the server to prevent a player from exiting their vehicle. For example by removing the contents of the removePassenger(Entity) method in the Entity class on the server. This is equivalent to cancelling the VehicleExitEvent on Bukkit.
- Join the server with a 1.16 client
- Hop in a boat
- Press shift, you'l be able to exit the boat on the client, the server and any other players will see you as still sitting in the boat but the client is no longer in the boat on their screen.
If a player is prevented from dismounting their vehicle by the server they are still in the vehicle for other players, however on the client the player has successfully dismounted and they can walk around and interact with the world but in a glitched state as the server still sees them as being in the vehicle.
If the server stops the client from dismounting an entity they should remain a passenger of the entity.
Specifically, in 1.16 a change was made to the rideTick() method in net.minecraft.world.entity.player.Player where the if statement on the first line no longer starts with the clause !this.level.isClientSide.
If this change is reverted the behaviour is identical to how it used to work in 1.15.2. This change is part of the issue but if reverted will not fully address the issue.
Please view the comment by @Bytzo for further detailed code analysis.