Class ResourceBundle

All Implemented Interfaces:
Serializable

public class ResourceBundle extends Object implements Serializable
Represents a resource bundle that can be serialized. This class is used to manage various game resources such as maps, sprite sheets, tilesets, emitters, blueprints, and sounds.
See Also:
  • Field Details

  • Constructor Details

    • ResourceBundle

      public ResourceBundle()
      Constructs a new ResourceBundle instance. Initializes the lists for sprite sheets, maps, tilesets, emitters, blueprints, and sounds.
  • Method Details

    • load

      public static ResourceBundle load(Path filePath)
      Loads a ResourceBundle from a Path.
      Parameters:
      filePath - The Path to load the ResourceBundle from.
      Returns:
      The loaded ResourceBundle, or null if loading fails.
    • load

      public static ResourceBundle load(String filePath)
      Loads a ResourceBundle from a string file path (convenience overload).
      Parameters:
      filePath - The file path as a string to load the ResourceBundle from.
      Returns:
      The loaded ResourceBundle, or null if loading fails.
    • load

      public static ResourceBundle load(URL fileUrl)
      Loads a ResourceBundle from a URL (convenience overload). This method uses the Resources utility to resolve the URL and then delegates to the Path-based method.
      Parameters:
      fileUrl - The URL to load the ResourceBundle from.
      Returns:
      The loaded ResourceBundle, or null if loading fails.
    • getMaps

      public List<TmxMap> getMaps()
      Gets the list of maps in this resource bundle.
      Returns:
      The list of maps.
    • getSpriteSheets

      public List<SpritesheetResource> getSpriteSheets()
      Gets the list of sprite sheets in this resource bundle.
      Returns:
      The list of sprite sheets.
    • getTilesets

      public List<Tileset> getTilesets()
      Gets the list of tilesets in this resource bundle.
      Returns:
      The list of tilesets.
    • getEmitters

      public List<EmitterAttributes> getEmitters()
      Gets the list of emitters in this resource bundle.
      Returns:
      The list of emitters.
    • getBluePrints

      public List<Blueprint> getBluePrints()
      Gets the list of blueprints in this resource bundle.
      Returns:
      The list of blueprints.
    • getScripts

      public List<ScriptDefinition> getScripts()
      Gets reusable Java and runtime script definitions.
    • getGameScripts

      public List<ScriptBinding> getGameScripts()
      Gets scripts attached to the game lifecycle.
    • getEntityScripts

      public List<EntityScriptBinding> getEntityScripts()
      Gets reusable script bindings that apply to entity project types.
    • getSounds

      public List<SoundResource> getSounds()
      Gets the list of sounds in this resource bundle.
      Returns:
      The list of sounds.
    • save

      public String save(String fileName, boolean compress)
      Saves the ResourceBundle to a file.
      Parameters:
      fileName - The name of the file to save the ResourceBundle to.
      compress - Whether to compress the file or not.
      Returns:
      The path of the saved file as a string.