-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
None
-
CraftBukkit version 4372-Spigot-e65d67a-7b44d46 (MC: 1.21.3) (Implementing API version 1.21.3-R0.1-SNAPSHOT)
-
Yes
This was reported for an older version at https://hub.spigotmc.org/jira/browse/SPIGOT-7048, but the bug has resurfaced again in 1.21.3. It's not possible to make e.g. a cow ride a player with addPassenger at the moment.
The plugin attached in the old report can be used to test this. Do note that the first addPassenger call in the onInteract method should be removed, otherwise the second call will always print false regardless of whether the issue is fixed.
The cause of the issue is this line:
// Entity#startRiding(Entity entity, boolean flag) } else if (!this.level().isClientSide() && !entity.type.canSerialize()) { return false; }
If "entity" (the vehicle) is a player, the canSerialize call returns false (because the construction of the PLAYER entity type in EntityTypes involves a noSave call).
A simple fix is changing that line to this
} else if (!flag && !this.level().isClientSide() && !entity.type.canSerialize()) { return false; }
Though I'm not sure if this breaks anything. At least it works as expected when you relog: if you log out with a cow on your head and log back in, the cow will still be there (but no longer on your head).
By the way, I was wondering whether I should comment on the old report or make a new report, but opted for the latter in the end. Not sure what y'all prefer.