Package net.risingworld.api.objects
Class MetaObject
java.lang.Object
net.risingworld.api.objects.MetaObject
Represents a meta object, which is typically any kind of processing station, e.g a furnace,
grinders, cooking station etc.
-
Method Summary
Modifier and TypeMethodDescriptionGets the chunk position of the meta object.int
Gets the x offset of the chunk (which contains the object).int
Gets the y offset of the chunk (which contains the object).int
Gets the z offset of the chunk (which contains the object).int
getFuel()
Gets the current fuel value of the meta object (only if it requires fuel).long
getID()
Gets the global, unique ID of the object.getItems()
Gets an array containing all items which are currently associated with this meta object (usually these are the items which are placed in this object, e.g ores in a furnace etc).Gets the object element which represents this meta object in the world.int
Gets the current status of the meta object.Gets the world position of the object.boolean
isValid()
Checks if this instance is still valid.boolean
Gets whether or not this meta object requires fuel for processing (e.g a furnace).void
setFuel
(int fuel) Sets a new fuel value for the meta object.void
Assigns new items to this meta object.void
setStatus
(int status, boolean updateObject) Sets the status of the meta object.void
Forces an update of the meta object.
-
Method Details
-
getID
public long getID()Gets the global, unique ID of the object.- Returns:
- the unique ID.
-
isValid
public boolean isValid()Checks if this instance is still valid.- Returns:
- true if the instance is valid, false if not.
-
getWorldPosition
Gets the world position of the object.- Returns:
- the object world position.
-
getChunkPositionX
public int getChunkPositionX()Gets the x offset of the chunk (which contains the object).- Returns:
- the x chunk offset.
-
getChunkPositionY
public int getChunkPositionY()Gets the y offset of the chunk (which contains the object).- Returns:
- the y chunk offset.
-
getChunkPositionZ
public int getChunkPositionZ()Gets the z offset of the chunk (which contains the object).- Returns:
- the z chunk offset.
-
getChunkPosition
Gets the chunk position of the meta object.- Returns:
- the meta object chunk coordinates.
-
getStatus
public int getStatus()Gets the current status of the meta object.- Returns:
- the meta object status.
-
setStatus
public void setStatus(int status, boolean updateObject) Sets the status of the meta object. Optionally updates the actual object representation as well (recommended).- Parameters:
status
- the new status.updateObject
- true if you want to change the actual object representation as well, false if you only want to change the value of the meta object. For example, if you want to turn on a furnace and you set this value to false, the furnace wouldn't turn on, but it would still start smelting items.
-
requiresFuel
public boolean requiresFuel()Gets whether or not this meta object requires fuel for processing (e.g a furnace).- Returns:
- true if this object requires fuel, false if not.
-
getFuel
public int getFuel()Gets the current fuel value of the meta object (only if it requires fuel).- Returns:
- the current fuel value of the meta object.
- See Also:
-
setFuel
public void setFuel(int fuel) Sets a new fuel value for the meta object. Only relevant if it requires fuel.- Parameters:
fuel
- the new fuel value.- See Also:
-
getRelatedObject
Gets the object element which represents this meta object in the world.- Returns:
- the actual object representation in the world.
-
getObjectInfoDefinition
-
getItems
Gets an array containing all items which are currently associated with this meta object (usually these are the items which are placed in this object, e.g ores in a furnace etc).- Returns:
- a new array containing all items associated with this meta object. Returns null if
there are no items in this meta object (or if the meta object cannot store items).
- Example: Destroy all items in furnace
-
setItems
Assigns new items to this meta object. Also use this method if you have changed the array that was retrieved viagetItems()
. This method automatically removes the old items from the meta object.- Parameters:
items
- the new items array you want to assign. Set null to remove all items from the meta object.
-
triggerUpdate
public void triggerUpdate()Forces an update of the meta object. Usually it's not necessary to call this method. Only call this method if you have changed theprogress
value of an item (associated with this meta object) and want the change to become active immediately (without waiting until the game performs the regular update).
-