Package net.risingworld.api.objects
Klasse Vehicle
java.lang.Object
net.risingworld.api.objects.Vehicle
Represents a vehicle
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
destroy()
Destroys the vehicle.void
Ejects all passengers, i.e forces them to get out of the vehicle.int
getColor()
Gets the vehicle color.Gets the definition for this vehicle.long
Gets the unique global ID of the vehicle.getName()
Gets the optional custom name of the vehicle.getPassenger
(int seat) Gets the passenger on a particular seat.Player[]
Gets an array of all passengers, or more precisely, an array containing the occupant of each seat.Gets the world position of the vehicle.Gets the rotation of the vehicle.int
short
Gets the type ID of the vehicle.boolean
Gets whether or not the vehicle is destroyed/wrecked.void
setColor
(float r, float g, float b, float a) Sets the vehicle color.void
setColor
(int color) Sets the vehicle color.void
void
setPosition
(float x, float y, float z) Sets the world position of the vehicle.void
setPosition
(Vector3f position) Sets the world position of the vehicle.void
setRotation
(Quaternion rotation) Sets the rotation of the vehicle.void
setStrength
(int strength)
-
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
Gets the definition for this vehicle.- Gibt zurück:
- the vehicle definition.
- Example: Check if a particular vehicle is a boat
-
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
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.gString name = vehicle.getDefinition().name;
- Gibt zurück:
- the optional custom vehicle name, or null if no custom name was set for this vehicle.
-
setName
-
getPosition
Gets the world position of the vehicle.- Gibt zurück:
- the vehicle position.
-
setPosition
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
Gets the rotation of the vehicle.- Gibt zurück:
- the vehicle rotation.
-
setRotation
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
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
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.
-