Class PlayerGravitySnapVegetationEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.player.PlayerEvent
net.risingworld.api.events.player.world.PlayerVegetationEvent
net.risingworld.api.events.player.world.PlayerGravitySnapVegetationEvent
- All Implemented Interfaces:
Cancellable
public final class PlayerGravitySnapVegetationEvent
extends PlayerVegetationEvent
implements Cancellable
Called when a floating plant "snaps down" to the ground instead of breaking
after losing contact to the ground (gravity). If the event is cancelled,
the plant does not move (it may break in a later integrity check instead).
The new position and rotation can be changed. The new position has to stay within the chunk of the plant, otherwise the change is ignored.
The new position and rotation can be changed. The new position has to stay within the chunk of the plant, otherwise the change is ignored.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the world position of the plant before the snap.Gets the rotation of the plant before the snap.getPlant()Gets the plant.Gets the new world position of the plant (i.e. the position after the snap).Gets the new rotation of the plant (i.e. the rotation after the snap).getScale()Gets the scale factor of the plant along the x, y and z axis.voidsetPosition(float x, float y, float z) Changes the new world position of the plant.voidsetPosition(Vector3f position) Changes the new world position of the plant.voidsetRotation(Quaternion rotation) Changes the new rotation of the plant.Methods inherited from class PlayerVegetationEvent
getChunkPositionX, getChunkPositionY, getChunkPositionZ, getGlobalID, getPlantDefinition, getTypeID, isCancelled, setCancelledMethods inherited from class PlayerEvent
getPlayerMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Cancellable
isCancelled, setCancelled
-
Method Details
-
getPlant
Description copied from class:PlayerVegetationEventGets the plant.- Overrides:
getPlantin classPlayerVegetationEvent- Returns:
- the plant element.
-
getOldPosition
Gets the world position of the plant before the snap.- Returns:
- the old global plant position as a Vector3f.
-
getOldRotation
Gets the rotation of the plant before the snap.- Returns:
- the old plant rotation as a Quaternion.
-
getPosition
Gets the new world position of the plant (i.e. the position after the snap).- Returns:
- the new global plant position as a Vector3f.
-
getRotation
Gets the new rotation of the plant (i.e. the rotation after the snap).- Returns:
- the new plant rotation as a Quaternion.
-
getScale
Gets the scale factor of the plant along the x, y and z axis. By default, it's 1 1 1.- Returns:
- the plant scale factor, as a Vector3f.
-
setPosition
Changes the new world position of the plant. The position has to stay within the chunk of the plant, otherwise it is ignored.- Parameters:
position- the new plant world position.
-
setPosition
public void setPosition(float x, float y, float z) Changes the new world position of the plant. The position has to stay within the chunk of the plant, otherwise it is ignored.- Parameters:
x- the new plant world x position.y- the new plant world y position.z- the new plant world z position.
-
setRotation
Changes the new rotation of the plant.- Parameters:
rotation- the new plant rotation. Set to null to reset the rotation (Quaternion.IDENTITY).
-