Klasse Vehicle

java.lang.Object
net.risingworld.api.objects.Vehicle

public final class Vehicle extends Object
Represents a vehicle
  • Konstruktordetails

    • Vehicle

      protected Vehicle(long handle)
  • Methodendetails

    • getGlobalID

      public long getGlobalID()
      Gets the unique global ID of the vehicle.
      Gibt zurück:
      the unique ID of vehicle.
    • getDefinition

      public Vehicles.VehicleDefinition getDefinition()
      Gets the definition for this vehicle.
      Gibt zurück:
      the vehicle definition.
      Example: Check if a particular vehicle is a boat
      1Vehicle vehicle = World.getVehicle(...);
      2if(vehicle != null) {
      3 Vehicles.VehicleDefinition def = vehicle.getDefinition();
      4 if(def.type == Vehicles.Type.Boat) {
      5 System.out.println("Vehicle is a boat!");
      6 }
      7}
    • getTypeID

      public short getTypeID()
      Gets the type ID of the vehicle.
      Gibt zurück:
      the type ID
    • isDestroyed

      public boolean isDestroyed()
      Gets whether or not the vehicle is destroyed/wrecked. If true, the vehicle still exists, but is usually only represented by a wreck model (and thus no longer usable).
      Gibt zurück:
      true if the vehicle is wrecked/destroyed, false if not.
    • getName

      public String getName()
      Gets the optional custom name of the vehicle. By default vehicles don't have a custom name, unless it was set by a player.

      Note: This is not to be confused this with the internal name of the vehicle type (e.g "rowboat", "rib" etc). If you want to get that name, use the vehicle definition instead, e.g String name = vehicle.getDefinition().name;
      Gibt zurück:
      the optional custom vehicle name, or null if no custom name was set for this vehicle.
    • setName

      public void setName(String name)
    • getPosition

      public Vector3f getPosition()
      Gets the world position of the vehicle.
      Gibt zurück:
      the vehicle position.
    • setPosition

      public void setPosition(Vector3f position)
      Sets the world position of the vehicle.
      Parameter:
      position - the new position.
    • setPosition

      public void setPosition(float x, float y, float z)
      Sets the world position of the vehicle.
      Parameter:
      x - the new x position.
      y - the new y position.
      z - the new z position.
    • getRotation

      public Quaternion getRotation()
      Gets the rotation of the vehicle.
      Gibt zurück:
      the vehicle rotation.
    • setRotation

      public void setRotation(Quaternion rotation)
      Sets the rotation of the vehicle.
      Parameter:
      rotation - the new rotation.
    • getStrength

      public int getStrength()
    • setStrength

      public void setStrength(int strength)
    • getColor

      public int getColor()
      Gets the vehicle color.
      Gibt zurück:
      the vehicle color as rgba int.
    • setColor

      public void setColor(float r, float g, float b, float a)
      Sets the vehicle color.
      Parameter:
      r - the red color component (0-1).
      g - the green color component (0-1).
      b - the blue color component (0-1).
      a - the paint intensity/strength (0-1).
    • setColor

      public void setColor(int color)
      Sets the vehicle color.
      Parameter:
      color - the rgba color value as int.
    • getPassenger

      public Player getPassenger(int seat)
      Gets the passenger on a particular seat.
      Parameter:
      seat - the vehicle seat.
      Gibt zurück:
      the player which is sitting on the specified seat, or null if the seat is not occupied.
    • getPassengers

      public Player[] getPassengers()
      Gets an array of all passengers, or more precisely, an array containing the occupant of each seat. For example, if a vehicle has 5 seats and no passengers, an array with the length 5 containing null entries is returned. If a vehicle has 2 seats and one passenger on the first seat, an array with the length 2 containing the player and a null entry is returned etc.
      Gibt zurück:
      an array containing all passengers.
    • ejectAllPassengers

      public void ejectAllPassengers()
      Ejects all passengers, i.e forces them to get out of the vehicle.
    • destroy

      public void destroy()
      Destroys the vehicle.