Class Asset

java.lang.Object
net.risingworld.api.assets.Asset
Direct Known Subclasses:
AssetBundle, MaterialAsset, MeshAsset, ModelAsset, ModelImportSettings, PrefabAsset, SoundAsset, StyleSheetAsset, TextureAsset

public abstract class Asset extends Object
Abstract base class representing a reference to an asset.
  • Field Details

  • Method Details

    • getHandle

      public int getHandle()
      Gets the internal handle of this asset.
      Returns:
      the internal handle (ID).
    • getSource

      public Asset.Source getSource()
    • getType

      public Asset.Type getType()
    • getDependency

      public int getDependency()
    • getPath

      public String getPath()
      Gets the path to the asset.
      Returns:
      the path to the asset.
    • getExtension

      public String getExtension()
      Gets the asset extension. Usually this is only relevant for files loaded from the hard drive.
      Returns:
      the asset extension.
    • getChecksum

      public String getChecksum()
      Gets the checksum of this asset.
      Returns:
      the MD5 checksum, as a String.
    • isDisposed

      public boolean isDisposed()
      Gets whether or not the asset is already disposed (i.e the resources are released). Never use disposed assets!
      Returns:
      true if the asset is already disposed, false if not.
    • dispose

      public boolean dispose()
      Disposes the asset, i.e frees all resources. Call this method if you no longer need this asset. Note that it isn't necessary to call this when shutting down the game/server, because in this case, all resources are cleaned up automatically.
      Returns:
      true if the asset was valid and found on native side, false if not.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object