Sponge moving entity

What’s the best way to move entities without teleporting them? Is there something like Motion? if yes how does it works? Is there a way for example to throw a snowball where the player is looking? I’m quite noob…


Yes. So its called Velocity. There are two ways to do it.

Entity.setVelocity(Vector3d direction);


Entity.offer(Keys.VELOCITY, vector3d):

So how does the Vector3d work?

A vector3d is a vector with 3 points using doubles (hence the 3d). Essentially the vector has points XYZ. When it comes to velocity you set the speed of which you want want the entity to travel in each direction. When applied it will move the entity.

So if i wanted to move the Entity south?

Entity.setVelocity(new Vector3d(1, 0, 0));

Perfect, thanks