Class PlayerGravitySnapObjectEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.player.PlayerEvent
net.risingworld.api.events.player.world.PlayerObjectEvent
net.risingworld.api.events.player.world.PlayerGravitySnapObjectEvent
- All Implemented Interfaces:
Cancellable
Called when a floating object "snaps down" to the ground instead of breaking
after losing contact to the ground (gravity). If the event is cancelled,
the object 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 object, otherwise the change is ignored.
The new position and rotation can be changed. The new position has to stay within the chunk of the object, otherwise the change is ignored.
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the object element.Gets the world position of the object before the snap.Gets the rotation of the object before the snap.Gets the new world position of the object (i.e. the position after the snap).Gets the new rotation of the object (i.e. the rotation after the snap).voidsetPosition(float x, float y, float z) Changes the new world position of the object.voidsetPosition(Vector3f position) Changes the new world position of the object.voidsetRotation(Quaternion rotation) Changes the new rotation of the object.Methods inherited from class PlayerObjectEvent
getChunkPositionX, getChunkPositionY, getChunkPositionZ, getGlobalID, getObjectDefinition, getTypeID, isCancelled, setCancelledMethods inherited from class PlayerEvent
getPlayer
-
Method Details
-
getObject
Description copied from class:PlayerObjectEventGets the object element.- Overrides:
getObjectin classPlayerObjectEvent- Returns:
- the object element.
-
getOldPosition
Gets the world position of the object before the snap.- Returns:
- the old global object position as a Vector3f.
-
getOldRotation
Gets the rotation of the object before the snap.- Returns:
- the old object rotation as a Quaternion.
-
getPosition
Gets the new world position of the object (i.e. the position after the snap).- Returns:
- the new global object position as a Vector3f.
-
getRotation
Gets the new rotation of the object (i.e. the rotation after the snap). The rotation may differ from the old rotation if the object adapts to the slope of the ground.- Returns:
- the new object rotation as a Quaternion.
-
setPosition
Changes the new world position of the object. The position has to stay within the chunk of the object, otherwise it is ignored.- Parameters:
position- the new object world position.
-
setPosition
public void setPosition(float x, float y, float z) Changes the new world position of the object. The position has to stay within the chunk of the object, otherwise it is ignored.- Parameters:
x- the new object world x position.y- the new object world y position.z- the new object world z position.
-
setRotation
Changes the new rotation of the object.- Parameters:
rotation- the new object rotation. Set to null to reset the rotation (Quaternion.IDENTITY).
-