Klasse MetaObject

java.lang.Object
net.risingworld.api.objects.MetaObject

public class MetaObject extends Object
Represents a meta object, which is typically any kind of processing station, e.g a furnace, grinders, cooking station etc.
  • 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

      public Vector3f 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

      public Vector3i 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

      public ObjectElement getRelatedObject()
      Gets the object element which represents this meta object in the world.
      Gibt zurück:
      the actual object representation in the world.
    • getObjectInfoDefinition

      public Objects.ObjectInfoDefinition getObjectInfoDefinition()
    • getItems

      public WorldItem[] 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
      1MetaObject furnace = ...;
      2
      3//Get all items in our furnace
      4WorldItem[] items = furnace.getItems();
      5
      6//Check if array is not null (i.e furnace contains items)
      7if (items != null) {
      8 //Go through all items and destroy them
      9 for (WorldItem item : items) {
      10 //If item is not null, destroy it
      11 if (item != null) item.destroy(false);
      12 }
      13}
    • setItems

      public void setItems(WorldItem[] items)
      Assigns new items to this meta object. Also use this method if you have changed the array that was retrieved via getItems(). 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 the progress 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).