/** * {@inheritDoc} */ @Override public Location getNextBlock(Vehicle v) { Vector vector = v.getVelocity(); Location location = v.getLocation(); int x = vector.getX() < 0 ? vector.getX() == 0 ? 0 : -1 : 1; int z = vector.getZ() < 0 ? vector.getZ() == 0 ? 0 : -1 : 1; return location.add(x, 0, z); } }
/** * Returns the next Location that a {@link Vehicle} is traveling at. * * @param v The {@link Vehicle} * @return The {@link Location} */ public static Location getNextBlock(Vehicle v) { Vector vector = v.getVelocity(); Location location = v.getLocation(); int x = vector.getX() < 0 ? vector.getX() == 0 ? 0 : -1 : 1; int z = vector.getZ() < 0 ? vector.getZ() == 0 ? 0 : -1 : 1; return location.add(x, 0, z); } }
if(vehicle.getVelocity().lengthSquared() != 0)
double speed = minecart.getVelocity().length();
if (this.getVehicle().getVelocity().equals(new Vector(0,0,0))) { if (((Minecart) this.getVehicle()).getMaxSpeed() == 0) ((Minecart) this.getVehicle()).setMaxSpeed(0.4d);