[SPIGOT-3510] Velocity broken for Boats, Pigs with saddles and Horses when riding them. Created: 14/Aug/17  Updated: 14/Aug/17  Resolved: 14/Aug/17

Status: Closed
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Alvin Larsson Bringholm Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: vehicle, velocity
Environment:

Server: CraftBukkit version git-Bukkit-b587878 (MC: 1.12.1) (Implementing API version 1.12.1-R0.1-SNAPSHOT). This is the one I've used for testing today, but I know for a fact that other versions had at least parts of the problems I'm describing

OS: Windows 10 64 bit

JRE: 1.8.0_111_b14 64 bit



 Description   

Velocities using Entity#getVelocity() and Entity#setVelocity() are broken when you are riding entities of the following types:

  • Boats
  • Horses
  • Saddled pigs, but only if you are controlling them using a Carrot on a Stick.

I tried both getting and setting velocities on the player and vehicle, and neither seemed to work entirely correctly. Entity#getVelocity() on the vehicle just returned an empty vector no matter what I tried, and Entity#setVelocity() did not have an effect either.

When trying Entity#getVelocity() on the riding player, I got the correct results, but only when the movement was caused by the player. Natural movement did not seem to have an effect. (IE, the only movement I could read was if I was using the WASD keys to control the horse, pushing the horse using water streams or anything of the like did not seem to produce an effect as long as I was riding). Entity#setVelocity() on the player while riding appears to do nothing at all.

Do note that this behaviour isĀ only when players are riding the vehicles. As soon as I jump off (or in the case of the pig, remove the Carrot on a Stick), everything works as expected, at least as far as I can see.



 Comments   
Comment by Alvin Larsson Bringholm [ 14/Aug/17 ]

Well, I wouldn't say it is entirely a duplicate, but thank you for the additional information.

The problem with getVelocity() isn't unfixable, there clearly exists data on the velocity since I can get it using the player instance, just not the vehicle.

The other issues are most likely possible to create workarounds for since the server is aware of the clients movement, but I understand if that is not feasible. But might I suggest to at least make these throw an exception or something when it's not possible to get the velocities, because right now it is outright misleading to have a method say that the vehicle has a velocity of 0 when that is clearly not the case.

Comment by Black Hole [ 14/Aug/17 ]

SPIGOT-3330

Generated at Sat Dec 13 13:43:49 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.