Klasse Plant
java.lang.Object
net.risingworld.api.objects.world.Plant
Represents a plant which was planted in the world (or spawned naturally).
This covers all kind of vegetation objects, e.g trees, scrubs, flowers etc.
-
Verschachtelte Klassen - Übersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
deleteAttribute
(String key) Removes a player attribute.void
destroy
(boolean silent) Destroys the plant.boolean
getAttribute
(String key) Gets the value to which the specified key is mapped, or null if no attribute is stored for that key.Gets a set containing all keys and attributes of this object.int
Gets the x offset of the chunk (which contains the plant).int
Gets the y offset of the chunk (which contains the plant).int
Gets the z offset of the chunk (which contains the plant).int
getColor()
Gets the plant color.long
Gets a unix timestamp (seconds) when this plant was first spawned / planted.long
Gets the unique global ID of the plant.int
Gets the database ID of the player who planted this plant.Gets the rotation of this plant.getScale()
Gets the scale (along x, y and z) of this plant.short
Gets the remaining strength of the plant (if strength goes to 0, e.g after hitting the plant, the plant breaks - or in case of trees, it falls).short
Gets the world position of this plant.boolean
hasAttribute
(String key) Gets whether or not the provided attribute exists.boolean
hasAttribute
(String key, Class type) Gets whether or not the provided attribute exists (also checks if it has a specific type).int
hashCode()
boolean
isCut()
Gets whether or not this plant is "cut".boolean
isValid()
void
setAttribute
(String key, Object value) Stores an attribute for this construction element.void
setColor
(int color) Sets a new color for this plant.void
Sets a new color for this plant.void
setPlayerDbID
(int dbID) Changes the owner database ID (i.e the database ID of the player who should be considered the plant owner).void
setRotation
(Quaternion rotation) Sets the rotation of this plant.void
setScale
(float x, float y, float z) Sets a new scale for this plant.void
Sets a new scale for this plant.void
setStrength
(short strength) Sets a new strength for the plant.
-
Methodendetails
-
isValid
public boolean isValid() -
getGlobalID
public long getGlobalID()Gets the unique global ID of the plant.- Gibt zurück:
- the object global ID.
-
getChunkPositionX
public int getChunkPositionX()Gets the x offset of the chunk (which contains the plant).- Gibt zurück:
- the x chunk offset.
-
getChunkPositionY
public int getChunkPositionY()Gets the y offset of the chunk (which contains the plant).- Gibt zurück:
- the y chunk offset.
-
getChunkPositionZ
public int getChunkPositionZ()Gets the z offset of the chunk (which contains the plant).- Gibt zurück:
- the z chunk offset.
-
getTypeID
public short getTypeID() -
getDefinition
-
getPlayerDbID
public int getPlayerDbID()Gets the database ID of the player who planted this plant. -1 for naturally spawned vegetation.- Gibt zurück:
- the owner database ID, or -1 if this plant spawned naturally.
-
setPlayerDbID
public void setPlayerDbID(int dbID) Changes the owner database ID (i.e the database ID of the player who should be considered the plant owner). Set to -1 to remove ownership.- Parameter:
dbID
- the unique database ID of the new owner, or -1 to remove ownership.
-
getCreationDate
public long getCreationDate()Gets a unix timestamp (seconds) when this plant was first spawned / planted.- Gibt zurück:
- a unix timestamp representing the creation date of the plant.
-
getWorldPosition
Gets the world position of this plant.- Gibt zurück:
- the global position.
-
getRotation
Gets the rotation of this plant.- Gibt zurück:
- the plant rotation.
-
setRotation
Sets the rotation of this plant.- Parameter:
rotation
- the new rotation you want to set.
-
getScale
Gets the scale (along x, y and z) of this plant. By default, the scale is 1 1 1- Gibt zurück:
- a new Vector3f containing the plant scale factors.
-
setScale
public void setScale(float x, float y, float z) Sets a new scale for this plant.- Parameter:
x
- the new scale along x (width).y
- the new scale along y (height).z
- the new scale along z (depth).
-
setScale
Sets a new scale for this plant.- Parameter:
scale
- the new scale along x (width), y (height) and z (depth).
-
getColor
public int getColor()Gets the plant color. If no color is set, 0 is returned.- Gibt zurück:
- the plant color as int rgba value.
-
setColor
public void setColor(int color) Sets a new color for this plant.- Parameter:
color
- the new color as int rgba value.
-
setColor
Sets a new color for this plant.- Parameter:
color
- the new color you want to set.
-
isCut
public boolean isCut()Gets whether or not this plant is "cut". This is only relevant for trees! If a tree is "cut", this plant object only represents a tree stump.- Gibt zurück:
- true if this tree is cut (i.e it's only a tree stump), false if not.
-
getStrength
public short getStrength()Gets the remaining strength of the plant (if strength goes to 0, e.g after hitting the plant, the plant breaks - or in case of trees, it falls).- Gibt zurück:
- the plant strength.
-
setStrength
public void setStrength(short strength) Sets a new strength for the plant. If you want to break the plant, calldestroy(boolean)
instead.- Parameter:
strength
- the new strength you want to set.
-
destroy
public void destroy(boolean silent) Destroys the plant.- Parameter:
silent
- true if you just want to remove the plant, false if you want it to actually break (spawn debris, play break sound, make a tree fall etc)
-
setAttribute
Stores an attribute for this construction element. You can store any type. Note that all attributes will be reset upon server restart!- Parameter:
key
- the name of the attribute.value
- the value/object you want to store. Set null to remove the attribute.
-
getAttribute
Gets the value to which the specified key is mapped, or null if no attribute is stored for that key.- Parameter:
key
- the name of the attribute.- Gibt zurück:
- the attribute that is stored for that key, or null of the key does not exists.
-
hasAttribute
Gets whether or not the provided attribute exists.- Parameter:
key
- the name of the attribute.- Gibt zurück:
- true if the attribute exists, false if not.
-
hasAttribute
Gets whether or not the provided attribute exists (also checks if it has a specific type).- Parameter:
key
- the name of the attribute.type
- the type of the attribute- Gibt zurück:
- true if the attribute exists and if it has the desired type, false if not.
-
deleteAttribute
Removes a player attribute. Does nothing if the attribute doesn't exist.- Parameter:
key
- the name of the attribute you want to delete.
-
getAttributes
Gets a set containing all keys and attributes of this object.
Be careful when modifying the set, because that affects the attributes.- Gibt zurück:
- a set containing all keys and attributes.
-
equals
-
hashCode
public int hashCode()
-