Class TickingSpawner
java.lang.Object
com.pixelmonmod.pixelmon.api.spawning.AbstractSpawner
com.pixelmonmod.pixelmon.api.spawning.archetypes.spawners.TickingSpawner
- Direct Known Subclasses:
LegendarySpawner
,PlayerTrackingSpawner
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.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Nested classes/interfaces inherited from class com.pixelmonmod.pixelmon.api.spawning.AbstractSpawner
AbstractSpawner.SpawnerBuilder<T extends AbstractSpawner>
-
Field Summary
Modifier and TypeFieldDescriptionint
The maximum number of entities that may exist in the world as a result of this spawner at any one time.long
The last (epoch) time a cycle occurred for this spawner.float
The minimum distance that must exist between spawned entities.long
The last (epoch) time an entity was successfully spawned.float
The number of seconds between each pass.int
The maximum number of entities that can spawn during a single pass.Fields inherited from class com.pixelmonmod.pixelmon.api.spawning.AbstractSpawner
cacheSets, checkSpawns, conditions, isBusy, lastSpawnTime, name, rarityMultipliers, rarityTweaks, selectionAlgorithm, spawnedTracker, spawnSets, tweaks
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canSpawn
(SpawnAction<?> action) void
doPass
(SpawnerCoordinator coordinator) Performs a pass.abstract int
Gets the number of passes.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 ofSpawnAction
s that should execute.boolean
hasCapacity
(int numSpawns) Gets if the spawner has enough space for the given number of entities.void
boolean
Whether or not this spawner should do spawning when it is triggeredMethods inherited from class com.pixelmonmod.pixelmon.api.spawning.AbstractSpawner
calculateSpatialData, fits, getCondition, getSuitableSpawns, getTrackedBlockCollection, getTweak, getWeightedSpawnInfo, hasCondition, hasTweak
-
Field Details
-
lastCycleTime
public long lastCycleTimeThe last (epoch) time a cycle occurred for this spawner. -
nextSpawnTime
public long nextSpawnTimeThe last (epoch) time an entity was successfully spawned. -
spawnLocationCalculator
-
capacity
public int capacityThe 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 overridinghasCapacity(int)
. -
spawnsPerPass
public int spawnsPerPassThe maximum number of entities that can spawn during a single pass. -
spawnFrequency
public float spawnFrequencyThe number of seconds between each pass. -
minDistBetweenSpawns
public float minDistBetweenSpawnsThe minimum distance that must exist between spawned entities. The lower this is, the more clustered entities may spawn.
-
-
Constructor Details
-
TickingSpawner
-
-
Method Details
-
getSpawns
Performs a specific pass, where pass index starts at zero, returning a list ofSpawnAction
s 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 thecapacity
and the maximumSpawnedPokemon. -
canSpawn
-
shouldDoSpawning
public boolean shouldDoSpawning()Description copied from class:AbstractSpawner
Whether or not this spawner should do spawning when it is triggered- Overrides:
shouldDoSpawning
in classAbstractSpawner
-
onSpawnEnded
public void onSpawnEnded() -
doPass
Performs a pass. This checks for capacity, callsgetSpawns(int)
, and executes anySpawnAction
s.
-