Class ScriptedSpawner


public final class ScriptedSpawner
Fluent builder for spawning typed entities directly into an environment from scripts.
  • Constructor Details

    • ScriptedSpawner

      public ScriptedSpawner(Environment environment)
  • Method Details

    • creature

      public ScriptedSpawner.CreatureBuilder creature(String spritePrefix)
      Starts building a Creature to spawn.
      Parameters:
      spritePrefix - The animation sprite prefix.
      Returns:
      A creature builder.
    • prop

      public ScriptedSpawner.PropBuilder prop(String spriteSheet)
      Starts building a Prop to spawn.
      Parameters:
      spriteSheet - The spritesheet name.
      Returns:
      A prop builder.
    • entity

      public <T extends IEntity> ScriptedSpawner.EntityBuilder<T> entity(Class<T> type)
      Starts building an entity of arbitrary type via reflection.
      Type Parameters:
      T - The entity type.
      Parameters:
      type - The concrete type, which must declare a no-argument constructor that reflection is permitted to open.
      Returns:
      A builder using reflective construction.
    • entity

      public <T extends IEntity> ScriptedSpawner.EntityBuilder<T> entity(Supplier<T> factory)
      Starts building an entity supplied by a factory.
      Type Parameters:
      T - The entity type.
      Parameters:
      factory - The factory invoked for each ScriptedSpawner.EntityBuilder.spawn() call.
      Returns:
      A builder using the factory.
    • entity

      public <T extends IEntity> ScriptedSpawner.EntityBuilder<T> entity(T entity)
      Starts configuring an existing entity instance to spawn.
      Type Parameters:
      T - The entity type.
      Parameters:
      entity - The entity to configure and add.
      Returns:
      A builder that returns the supplied instance.