Package net.risingworld.api.objects
Klasse 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.
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungGets 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.
-
Methodendetails
-
getID
public long getID()Gets the global, unique ID of the object.- Gibt zurück:
- the unique ID.
-
isValid
public boolean isValid()Checks if this instance is still valid.- Gibt zurück:
- true if the instance is valid, false if not.
-
getWorldPosition
Gets the world position of the object.- Gibt zurück:
- the object world position.
-
getChunkPositionX
public int getChunkPositionX()Gets the x offset of the chunk (which contains the object).- Gibt zurück:
- the x chunk offset.
-
getChunkPositionY
public int getChunkPositionY()Gets the y offset of the chunk (which contains the object).- Gibt zurück:
- the y chunk offset.
-
getChunkPositionZ
public int getChunkPositionZ()Gets the z offset of the chunk (which contains the object).- Gibt zurück:
- the z chunk offset.
-
getChunkPosition
Gets the chunk position of the meta object.- Gibt zurück:
- the meta object chunk coordinates.
-
getStatus
public int getStatus()Gets the current status of the meta object.- Gibt zurück:
- 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).- Parameter:
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).- Gibt zurück:
- 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).- Gibt zurück:
- the current fuel value of the meta object.
- Siehe auch:
-
setFuel
public void setFuel(int fuel) Sets a new fuel value for the meta object. Only relevant if it requires fuel.- Parameter:
fuel
- the new fuel value.- Siehe auch:
-
getRelatedObject
Gets the object element which represents this meta object in the world.- Gibt zurück:
- 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).- Gibt zurück:
- 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.- Parameter:
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).
-