Class SpawnRegistry

java.lang.Object
com.csse3200.game.entities.spawn.SpawnRegistry

public final class SpawnRegistry extends Object
A global registry for EntitySpawner instances.

The SpawnRegistry maps string identifiers to spawner functions, allowing entities to be created dynamically by ID. This is used for loading entities from configuration files.

  • Method Details

    • register

      public static void register(String type, EntitySpawner spawner)
      Registers a spawner under a given type identifier.
      Parameters:
      type - the types identifier string
      spawner - the spawner function for creating entities
    • build

      public static Entity build(String type, LevelConfig.E a)
    • unregister

      public static void unregister(String type)
      Removes a spawner from the registry.
      Parameters:
      type - the type identifier of the spawner to remove
    • clear

      public static void clear()
      Clears all registered spawners.