Package net.risingworld.api.events.world
Klasse PlantGrowthEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.world.PlantGrowthEvent
- Alle implementierten Schnittstellen:
Cancellable
Called when a plant grows (i.e transition to next growth stage).
Note: Most growable plants have multiple "growth stages", so a sapling usually never turns into a fully grown plant directly. For example, a tomato sapling (internal name "tomato_sapling") first turns into a tiny tomato plant ("tomato_s0"), then into a bigger plant ("tomtato_s1"), then it turns into a grown plant without fruits ("tomato_s2"), then some unripe tomatoes appear ("tomato_s3"), and finally you get the fully grown tomato plant ("tomato"). In total, the PlantGrowthEvent will be triggered 5 times in this case (for every growth stage).
Note: Most growable plants have multiple "growth stages", so a sapling usually never turns into a fully grown plant directly. For example, a tomato sapling (internal name "tomato_sapling") first turns into a tiny tomato plant ("tomato_s0"), then into a bigger plant ("tomtato_s1"), then it turns into a grown plant without fruits ("tomato_s2"), then some unripe tomatoes appear ("tomato_s3"), and finally you get the fully grown tomato plant ("tomato"). In total, the PlantGrowthEvent will be triggered 5 times in this case (for every growth stage).
-
Feldübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungint
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).long
Gets the global ID of the plant which is about to growint
Gets the growth time for the next plant stage (in seconds).short
Gets the next type ID of the plant, i.e of the next growth stage.Gets the world position of the plant as a Vector3f.Gets the current rotation of the plant as a Quaternion.short
Gets the current type ID of the plant.boolean
Determines if the event is cancelled.boolean
Gets whether or not this new plant stage can grow.void
setCancelled
(boolean cancel) Cancels this event.void
setNextGrowthTime
(int growthTime) Sets the growth time (seconds) for the next plant stage, i.e how long it takes until this plant grows and reaches the next growth stage.void
setNextStageTypeID
(short typeID) Changes the type ID of the next growth stage.
-
Methodendetails
-
getGlobalID
public long getGlobalID()Gets the global ID of the plant which is about to grow- Gibt zurück:
- the unique global ID of the plant.
-
getPlantTypeID
public short getPlantTypeID()Gets the current type ID of the plant.- Gibt zurück:
- the plant type ID.
-
getNextStageTypeID
public short getNextStageTypeID()Gets the next type ID of the plant, i.e of the next growth stage.- Gibt zurück:
- the type ID of the next growth stage.
-
setNextStageTypeID
public void setNextStageTypeID(short typeID) Changes the type ID of the next growth stage.- Parameter:
typeID
- the new type ID.- Example: If a plant grows, it should turn into flowers, no matter which plant it is
-
getNextGrowthTime
public int getNextGrowthTime()Gets the growth time for the next plant stage (in seconds). The growth time determines how long it takes until this plant grows (until it reaches the next growth stage). Returns 0 if this plant cannot grow.- Gibt zurück:
- the growth time, in seconds.
-
setNextGrowthTime
public void setNextGrowthTime(int growthTime) Sets the growth time (seconds) for the next plant stage, i.e how long it takes until this plant grows and reaches the next growth stage. Has no effect if this plant cannot grow (seegetNextGrowthTime()
.- Parameter:
growthTime
- the growth time, in seconds.- Siehe auch:
-
isGrowable
public boolean isGrowable()Gets whether or not this new plant stage can grow. If this method returns false, it means that the final growth stage is already reached (i.e fully grown tree, for example).- Gibt zurück:
- true if the plant can still grow, false if not.
-
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.
-
getPlantPosition
Gets the world position of the plant as a Vector3f.- Gibt zurück:
- the global plant position as a Vector3f.
-
getPlantRotation
Gets the current rotation of the plant as a Quaternion. Keep in mind that the rotation can change for the new growth stage.- Gibt zurück:
- the current plant rotation as a Quaternion.
-
getPlantDefinition
-
getNextStagePlantDefinition
-
isCancelled
public boolean isCancelled()Beschreibung aus Schnittstelle kopiert:Cancellable
Determines if the event is cancelled. If an event is cancelled, it will no longer be executed, but other plugins will still receive the event.
Please note: If the event is threaded, cancellation has no effect, i.e the event will still be executed.- Angegeben von:
isCancelled
in SchnittstelleCancellable
- Gibt zurück:
- true if the event is cancelled, or false if not.
-
setCancelled
public void setCancelled(boolean cancel) Beschreibung aus Schnittstelle kopiert:Cancellable
Cancels this event. This means it will no longer be executed, but other plugins will still receive the event.- Angegeben von:
setCancelled
in SchnittstelleCancellable
- Parameter:
cancel
- set to true if you want to cancel this event.- Example: Cancel "PlayerEnterAreaEvent", i.e prevent player from entering an area
-