Class PlayerPlaceConstructionEvent
java.lang.Object
net.risingworld.api.events.Event
net.risingworld.api.events.player.PlayerEvent
net.risingworld.api.events.player.world.PlayerConstructionEvent
net.risingworld.api.events.player.world.PlayerPlaceConstructionEvent
- All Implemented Interfaces:
Cancellable
Called when a player places a construction element.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionlong[]
If the player places multiple construction elements in a row, this method gets the unique, global IDs of all construction elements which are about to be placed.float
If multiple elements are about to be placed in a row (multi-placement), this determines the gap between the elements.int
Gets the amount of additional elements the player wants to place in a row (multi-placement) along the x axis.int
Gets the amount of additional elements the player wants to place in a row (multi-placement) along the y axis.int
Gets the amount of additional elements the player wants to place in a row (multi-placement) along the z axis.int
Gets the total amount of elements the player is about to place.void
setColor
(int color) void
setMultiPlaceGap
(float gap) Sets the gap between elements if multiple elements are about to be placed in a row (multi-placement).void
setPosition
(float x, float y, float z) Changes the world position of the construction element.void
setPosition
(Vector3f position) Changes the world position of the construction element.void
setRotation
(float pitch, float yaw, float roll) Changes the rotation of the construction element.void
setRotation
(Quaternion rotation) Changes the rotation of the construction element.void
setSize
(float x, float y, float z) Changes the size of the construction element.void
Changes the size of the construction element.void
setTextureID
(int texture) Sets the texture of the construction element.void
setTypeID
(byte id) Sets the type ID of the construction element.Methods inherited from class net.risingworld.api.events.player.world.PlayerConstructionEvent
getChunkPositionX, getChunkPositionY, getChunkPositionZ, getConstructionDefinition, getConstructionElement, getGlobalID, getTexture, getTypeID, isCancelled, setCancelled
Methods inherited from class net.risingworld.api.events.player.PlayerEvent
getPlayer
-
Method Details
-
getGlobalIDs
public long[] getGlobalIDs()If the player places multiple construction elements in a row, this method gets the unique, global IDs of all construction elements which are about to be placed. If only a single element is placed, usePlayerConstructionEvent.getGlobalID()
instead. To find out if the player only places a single element, check ifgetTotalCount()
returns 1- Returns:
- a new array containing all global IDs of the construction elements. If just a single element was
placed, the array just contains the global ID of that element.
- Example:
-
setTypeID
public void setTypeID(byte id) Sets the type ID of the construction element.- Parameters:
id
- the new type ID.
-
setTextureID
public void setTextureID(int texture) Sets the texture of the construction element.- Parameters:
texture
- the new texture ID. If this is a "poster" construction element, the texture ID is the custom image ID.
-
setPosition
Changes the world position of the construction element.- Parameters:
position
- the new world position of the construction element.
-
setPosition
public void setPosition(float x, float y, float z) Changes the world position of the construction element.- Parameters:
x
- the new world x position of the construction element.y
- the new world y position of the construction element.z
- the new world z position of the construction element.
-
setRotation
Changes the rotation of the construction element.- Parameters:
rotation
- the new construction element rotation. Set to null to reset the rotation (Quaternion.IDENTITY).
-
setRotation
public void setRotation(float pitch, float yaw, float roll) Changes the rotation of the construction element.- Parameters:
pitch
- the new x angle, as euler rotation (pitch).yaw
- the new y angle, as euler rotation (yaw).roll
- the new z angle, as euler rotation (roll).
-
setSize
Changes the size of the construction element.- Parameters:
size
- the new size (x, y, z, as a Vector3f) of the construction element.
-
setSize
public void setSize(float x, float y, float z) Changes the size of the construction element.- Parameters:
x
- the new size of the construction element along the x axis.y
- the new size of the construction element along the y axis.z
- the new size of the construction element along the z axis.
-
setColor
public void setColor(int color) -
getMultiPlaceRowX
public int getMultiPlaceRowX()Gets the amount of additional elements the player wants to place in a row (multi-placement) along the x axis. By default this is 0 (which means that no additional elements are about to placed along x). The value is negative if the direction is along -x- Returns:
- amount of extra elements the player wants to place along x. A positive value means that this amount of elements is placed additionally along +x, a negative value means that this amount of elements (abs) if placed additionally along -x
-
getMultiPlaceRowY
public int getMultiPlaceRowY()Gets the amount of additional elements the player wants to place in a row (multi-placement) along the y axis. By default this is 0 (which means that no additional elements are about to placed along y). The value is negative if the direction is along -y- Returns:
- amount of extra elements the player wants to place along y. A positive value means that this amount of elements is placed additionally along +y, a negative value means that this amount of elements (abs) if placed additionally along -y
-
getMultiPlaceRowZ
public int getMultiPlaceRowZ()Gets the amount of additional elements the player wants to place in a row (multi-placement) along the z axis. By default this is 0 (which means that no additional elements are about to placed along z). The value is negative if the direction is along -z- Returns:
- amount of extra elements the player wants to place along z. A positive value means that this amount of elements is placed additionally along +z, a negative value means that this amount of elements (abs) if placed additionally along -z
-
getMultiPlaceGap
public float getMultiPlaceGap()If multiple elements are about to be placed in a row (multi-placement), this determines the gap between the elements.- Returns:
- the gap between elements when placing multiple elements in a row.
-
setMultiPlaceGap
public void setMultiPlaceGap(float gap) Sets the gap between elements if multiple elements are about to be placed in a row (multi-placement).- Parameters:
gap
- the gap between multiple elements.
-
getTotalCount
public int getTotalCount()Gets the total amount of elements the player is about to place.- Returns:
- the number of elements the player wants to place. Returns 1 if the player wants to place a single element only, or a higher value when placing multiple elements in a row.
-