So I wanted to know a proper way for teleporting a player and the rest of the passengers to a new location? Every time I tried getting the player to a new location he periodically just doesn't teleport with the rest of the stack.
public void teleport(Entity base,int x, int y, int z)
{
List<Entity> stack = Arrays.asList(base.getRecursivePassengers().toArray());
stack.add(0,base);
for(Entity e : stack)
{
e.dismountRidingEntity();
if(e instanceof EntityPlayerMP)
((EntityPlayerMP)e).connection.setPlayerLocation(x, y, z, e.rotationYaw, e.rotationPitch);
e.setLocationAndAngles(x, y, z, e.rotationYaw, e.rotationPitch);
}
}