Interface TrialSpawner

All Superinterfaces:
BlockState, Metadatable, PersistentDataHolder, PersistentDataViewHolder, TileState

@NullMarked public interface TrialSpawner extends TileState
Represents a captured state of a trial spawner.
  • Method Details

    • getCooldownEnd

      long getCooldownEnd()
      Gets the game time in ticks when the cooldown ends. 0 if not currently in cooldown.
      Returns:
      the game time in ticks
      See Also:
    • setCooldownEnd

      void setCooldownEnd(long ticks)
      Sets the game time in ticks when the cooldown ends.
      Parameters:
      ticks - the game time in ticks for the new cooldown
    • getNextSpawnAttempt

      long getNextSpawnAttempt()
      Gets the game time in ticks when the next spawn attempt happens. 0 if not currently active.
      Returns:
      the game time in ticks
      See Also:
    • setNextSpawnAttempt

      void setNextSpawnAttempt(long ticks)
      Sets the game time in ticks when the next spawn attempt happens.
      Parameters:
      ticks - the game time in ticks for the next mob spawn
    • getCooldownLength

      int getCooldownLength()
      Gets the length in ticks the spawner will stay in cooldown for.
      Returns:
      the number of ticks
    • setCooldownLength

      void setCooldownLength(int ticks)
      Sets the length in ticks the spawner will stay in cooldown for.
      Parameters:
      ticks - the number of ticks
    • getRequiredPlayerRange

      int getRequiredPlayerRange()
      Get the maximum distance(squared) a player can be in order for this spawner to be active.
      If this value is less than or equal to 0, this spawner is always active (given that there are players online).
      Default value is 16.
      Returns:
      the maximum distance(squared) a player can be in order for this spawner to be active.
    • setRequiredPlayerRange

      void setRequiredPlayerRange(int requiredPlayerRange)
      Set the maximum distance (squared) a player can be in order for this spawner to be active.
      Setting this value to less than or equal to 0 will make this spawner always active (given that there are players online).
      Parameters:
      requiredPlayerRange - the maximum distance (squared) a player can be in order for this spawner to be active.
    • getTrackedPlayers

      Collection<Player> getTrackedPlayers()
      Gets the players this spawner is currently tracking.

      Note: the returned collection is immutable, use startTrackingPlayer(Player) or stopTrackingPlayer(Player) instead.

      Returns:
      a collection of players this spawner is tracking or an empty collection if there aren't any
    • isTrackingPlayer

      boolean isTrackingPlayer(Player player)
      Checks if this spawner is currently tracking the provided player.
      Parameters:
      player - the player
      Returns:
      true if this spawner is tracking the provided player
    • startTrackingPlayer

      void startTrackingPlayer(Player player)
      Force this spawner to start tracking the provided player.

      Note: the spawner may decide to stop tracking this player at any given time.

      Parameters:
      player - the player
    • stopTrackingPlayer

      void stopTrackingPlayer(Player player)
      Force this spawner to stop tracking the provided player.

      Note: the spawner may decide to start tracking this player again at any given time.

      Parameters:
      player - the player
    • getTrackedEntities

      Collection<Entity> getTrackedEntities()
      Gets a list of entities this spawner is currently tracking.

      Note: the returned collection is immutable, use startTrackingEntity(Entity) or stopTrackingEntity(Entity) instead.

      Returns:
      a collection of entities this spawner is tracking or an empty collection if there aren't any
    • isTrackingEntity

      boolean isTrackingEntity(Entity entity)
      Checks if this spawner is currently tracking the provided entity.
      Parameters:
      entity - the entity
      Returns:
      true if this spawner is tracking the provided entity
    • startTrackingEntity

      void startTrackingEntity(Entity entity)
      Force this spawner to start tracking the provided entity.

      Note: the spawner may decide to stop tracking this entity at any given time.

      Parameters:
      entity - the entity
    • stopTrackingEntity

      void stopTrackingEntity(Entity entity)
      Force this spawner to stop tracking the provided entity.

      Note: the spawner may decide to start tracking this entity again at any given time.

      Parameters:
      entity - the entity
    • isOminous

      boolean isOminous()
      Checks if this spawner is using the ominous TrialSpawnerConfiguration.
      Returns:
      true is using the ominous configuration
    • setOminous

      void setOminous(boolean ominous)
      Changes this spawner between the normal and ominous TrialSpawnerConfiguration.
      Parameters:
      ominous - true to use the ominous TrialSpawnerConfiguration, false to use the normal one.
    • getNormalConfiguration

      TrialSpawnerConfiguration getNormalConfiguration()
      Gets the TrialSpawnerConfiguration used when isOminous() is false.
      Returns:
      the TrialSpawnerConfiguration
    • getOminousConfiguration

      TrialSpawnerConfiguration getOminousConfiguration()
      Gets the TrialSpawnerConfiguration used when isOminous() is true.
      Returns:
      the TrialSpawnerConfiguration