Class ConstructionElement
java.lang.Object
net.risingworld.api.objects.world.ConstructionElement
Represents a "ConstructionElement" which was placed in the world (or spawned naturally). 
 This could be a block (or any other shape like a cylinder, slope etc), or a window, glass pane etc. 
 A ConstructionElement is always bound to a chunk.
- 
Method SummaryModifier and TypeMethodDescriptionvoiddeleteAttribute(String key) Removes a player attribute.voiddestroy(boolean silent) Destroys the construction element.booleangetAttribute(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.intGets the x offset of the chunk (which contains the construction element).intGets the y offset of the chunk (which contains the construction element).intGets the z offset of the chunk (which contains the construction element).intgetColor()longGets a unix timestamp (seconds) when this element was first spawned / placedlongGets the unique global ID of the construction element.intGets the database ID of the player who placed the block.Gets the rotation of this construction element.getScale()Gets the scale (along x, y and z) of this construction element.shortGets the remaining strength of the construction element (if strength goes to 0, e.g after hitting the construction element, it will break).intfloatbyteGets the world position of this element.booleanhasAttribute(String key) Gets whether or not the provided attribute exists.booleanhasAttribute(String key, Class type) Gets whether or not the provided attribute exists (also checks if it has a specific type).inthashCode()booleanisValid()voidsetAttribute(String key, Object value) Stores an attribute for this construction element.voidsetColor(int color) Sets a new color for this construction element.voidSets a new color for this construction element.voidsetPlayerDbID(int dbID) Changes the owner database ID (i.e the database ID of the player who should be considered the element owner).voidsetRotation(Quaternion rotation) Sets the rotation of this construction element.voidsetScale(float x, float y, float z) Sets a new scale for this construction element.voidSets a new scale for this construction element.voidsetStrength(short strength) Sets a new strength for the construction element.voidsetSurfaceOffset(Vector3f offset) voidsetSurfaceOffsetAndScale(Vector3f offset, Vector3f scale) voidsetSurfaceScale(Vector3f scale) voidsetTexture(int texture) voidsetTextureScale(float textureScale) voidsetTypeID(byte typeID) 
- 
Method Details- 
isValidpublic boolean isValid()
- 
getGlobalIDpublic long getGlobalID()Gets the unique global ID of the construction element.- Returns:
- the object global ID.
 
- 
getChunkPositionXpublic int getChunkPositionX()Gets the x offset of the chunk (which contains the construction element).- Returns:
- the x chunk offset.
 
- 
getChunkPositionYpublic int getChunkPositionY()Gets the y offset of the chunk (which contains the construction element).- Returns:
- the y chunk offset.
 
- 
getChunkPositionZpublic int getChunkPositionZ()Gets the z offset of the chunk (which contains the construction element).- Returns:
- the z chunk offset.
 
- 
getTypeIDpublic byte getTypeID()
- 
setTypeIDpublic void setTypeID(byte typeID) 
- 
getTexturepublic int getTexture()
- 
setTexturepublic void setTexture(int texture) 
- 
getTextureScalepublic float getTextureScale()
- 
setTextureScalepublic void setTextureScale(float textureScale) 
- 
getPlayerDbIDpublic int getPlayerDbID()Gets the database ID of the player who placed the block. -1 for naturally spawned elements- Returns:
- the owner database ID, or -1 if this elements was spawned naturally.
 
- 
setPlayerDbIDpublic void setPlayerDbID(int dbID) Changes the owner database ID (i.e the database ID of the player who should be considered the element owner). Set to -1 to remove ownership.- Parameters:
- dbID- the unique database ID of the new owner, or -1 to remove ownership.
 
- 
getCreationDatepublic long getCreationDate()Gets a unix timestamp (seconds) when this element was first spawned / placed- Returns:
- a unix timestamp representing the creation date of the element.
 
- 
getWorldPositionGets the world position of this element.- Returns:
- the global position.
 
- 
getRotationGets the rotation of this construction element.- Returns:
- the element rotation.
 
- 
setRotationSets the rotation of this construction element.- Parameters:
- rotation- the new rotation you want to set.
 
- 
getScaleGets the scale (along x, y and z) of this construction element. By default, the scale is 1 1 1- Returns:
- a new Vector3f containing the element scale factors.
 
- 
setScalepublic void setScale(float x, float y, float z) Sets a new scale for this construction element.- Parameters:
- x- the new scale along x (width).
- y- the new scale along y (height).
- z- the new scale along z (depth).
 
- 
setScaleSets a new scale for this construction element.- Parameters:
- scale- the new scale along x (width), y (height) and z (depth).
 
- 
getSurfaceOffset
- 
setSurfaceOffset
- 
getSurfaceScale
- 
setSurfaceScale
- 
setSurfaceOffsetAndScale
- 
getColorpublic int getColor()
- 
setColorpublic void setColor(int color) Sets a new color for this construction element.- Parameters:
- color- the new color as int rgba value.
 
- 
setColorSets a new color for this construction element.- Parameters:
- color- the new color you want to set.
 
- 
getStrengthpublic short getStrength()Gets the remaining strength of the construction element (if strength goes to 0, e.g after hitting the construction element, it will break).- Returns:
- the construction element strength.
 
- 
setStrengthpublic void setStrength(short strength) Sets a new strength for the construction element. If you want to break the construction element, calldestroy(boolean)instead.- Parameters:
- strength- the new strength you want to set.
 
- 
destroypublic void destroy(boolean silent) Destroys the construction element.- Parameters:
- silent- true if you just want to remove the element, false if you want it to actually break (spawn debris, play break sound etc)
 
- 
setAttributeStores an attribute for this construction element. You can store any type. Note that all attributes will be reset upon server restart!- Parameters:
- key- the name of the attribute.
- value- the value/object you want to store. Set null to remove the attribute.
 
- 
getAttributeGets the value to which the specified key is mapped, or null if no attribute is stored for that key.- Parameters:
- key- the name of the attribute.
- Returns:
- the attribute that is stored for that key, or null of the key does not exists.
 
- 
hasAttributeGets whether or not the provided attribute exists.- Parameters:
- key- the name of the attribute.
- Returns:
- true if the attribute exists, false if not.
 
- 
hasAttributeGets whether or not the provided attribute exists (also checks if it has a specific type).- Parameters:
- key- the name of the attribute.
- type- the type of the attribute
- Returns:
- true if the attribute exists and if it has the desired type, false if not.
 
- 
deleteAttributeRemoves a player attribute. Does nothing if the attribute doesn't exist.- Parameters:
- key- the name of the attribute you want to delete.
 
- 
getAttributesGets a set containing all keys and attributes of this object.
 Be careful when modifying the set, because that affects the attributes.- Returns:
- a set containing all keys and attributes.
 
- 
equals
- 
hashCodepublic int hashCode()
 
-