Interface ISpawnable

All Known Subinterfaces:
ISpawnableWithModel
All Known Implementing Classes:
BuilderBaseWithType, BuilderMotionControllerBase, BuilderMotionControllerDive, BuilderMotionControllerFly, BuilderMotionControllerMap, BuilderMotionControllerWalk, BuilderRole, BuilderRoleAbstract, BuilderRoleVariant

public interface ISpawnable
Represents a class type that can be tested and processed for spawning

Created on 27/08/2019

  • Method Details

    • getIdentifier

      @Nonnull String getIdentifier()
      Returns:
      the unique identifier of the spawnable class type
    • canSpawn

      @Nonnull SpawnTestResult canSpawn(@Nonnull SpawningContext context)
      Called to test whether this spawnable class type is spawnable regarding the given context
      Parameters:
      context - The SpawningContext to test against
      Returns:
      true if this spawnable can spawn, false if otherwise
    • requiresSpawnDropHeightCheck

      boolean requiresSpawnDropHeightCheck(@Nonnull SpawningContext context)
      Called to test whether a spawn drop height check applies to this spawnable for the given context.

      The motion controller that supports the movement mode in the context resolves the answer. An implementation that cannot resolve it returns true, so the caller keeps the check.

      Parameters:
      context - The SpawningContext to test against
      Returns:
      true if the caller must check the spawn drop height, false if otherwise
    • getSpawnPlacement

      @Nonnull default SpawnPositionPlacement getSpawnPlacement(@Nonnull SpawningContext context)
      Query where a spawn position for this spawnable must sit for the movement mode in the context.

      The motion controller that supports the movement mode in the context resolves the answer. An implementation that cannot resolve it returns SpawnPositionPlacement.ON_GROUND.

      A position search uses the answer to place its candidates. The spawnable still judges the finished candidate in canSpawn(SpawningContext).

      Parameters:
      context - The SpawningContext to test against
      Returns:
      the placement a spawn position must have
    • getMovementModes

      void getMovementModes(@Nonnull SpawningContext context, @Nonnull Set<MovementMode> outSupportedMovementModes, @Nonnull Set<MovementMode> outDefaultMovementModes, @Nonnull Set<MovementMode> outSafeMovementModes)
      Query all movement mode sets for this spawnable.
      Parameters:
      context - The SpawningContext to test against
      outSupportedMovementModes - Populated with every movement mode the NPC's motion controller is capable of. Must be cleared before population.
      outDefaultMovementModes - Populated with the movement modes used when no user configuration is present. Must be cleared before population.
      outSafeMovementModes - Populated with movement modes the NPC can use safely given its breathing configuration (e.g. air-breathing walkers exclude UNDERWATER_WALK). Must be cleared before population.