java.lang.Object
com.pixelmonmod.pixelmon.api.spawning.AbstractSpawner
com.pixelmonmod.pixelmon.api.spawning.archetypes.spawners.TickingSpawner
Direct Known Subclasses:
LegendarySpawner, PlayerTrackingSpawner

public abstract class TickingSpawner extends AbstractSpawner
An AbstractSpawner which ticks. This implementation provides a way of establishing different passes so that on each cycle a different process is taken. This by default uses config ptions for its operational parameters including capacity, maximum spawns per pass, frequency, and distance between spawns.
  • Field Details

    • lastCycleTime

      public long lastCycleTime
      The last (epoch) time a cycle occurred for this spawner.
    • nextSpawnTime

      public long nextSpawnTime
      The last (epoch) time an entity was successfully spawned.
    • spawnLocationCalculator

      public CalculateSpawnLocations spawnLocationCalculator
      The CalculateSpawnLocations that will be used to take BlockCollections and compose SpawnLocations.
    • capacity

      public int capacity
      The maximum number of entities that may exist in the world as a result of this spawner at any one time. This can be bypassed by overriding hasCapacity(int).
    • spawnsPerPass

      public int spawnsPerPass
      The maximum number of entities that can spawn during a single pass.
    • spawnFrequency

      public float spawnFrequency
      The number of seconds between each pass.
    • minDistBetweenSpawns

      public float minDistBetweenSpawns
      The minimum distance that must exist between spawned entities. The lower this is, the more clustered entities may spawn.
  • Constructor Details

    • TickingSpawner

      public TickingSpawner(String name)
  • Method Details

    • getSpawns

      public abstract List<SpawnAction<? extends net.minecraft.world.entity.Entity>> getSpawns(int pass)
      Performs a specific pass, where pass index starts at zero, returning a list of SpawnActions that should execute. Null or empty lists are acceptable. An implementation that doesn't use passes will ignore this parameter.
    • getNumPasses

      public abstract int getNumPasses()
      Gets the number of passes. An implementation that doesn't use passes will return 1.
    • hasCapacity

      public boolean hasCapacity(int numSpawns)
      Gets if the spawner has enough space for the given number of entities. By default this considers the capacity and the maximumSpawnedPokemon.
    • canSpawn

      public boolean canSpawn(SpawnAction<?> action)
    • shouldDoSpawning

      public boolean shouldDoSpawning()
      Description copied from class: AbstractSpawner
      Whether or not this spawner should do spawning when it is triggered
      Overrides:
      shouldDoSpawning in class AbstractSpawner
    • onSpawnEnded

      public void onSpawnEnded()
    • doPass

      public void doPass(SpawnerCoordinator coordinator)
      Performs a pass. This checks for capacity, calls getSpawns(int), and executes any SpawnActions.