Package org.bukkit.block
Interface CreatureSpawner
- All Superinterfaces:
- BlockState,- Metadatable,- PersistentDataHolder,- TileState
Represents a captured state of a creature spawner.
- 
Method SummaryModifier and TypeMethodDescriptionDeprecated.intgetDelay()Get the spawner's delay.intSet the new maximum amount of similar entities that are allowed to be within spawning range of this spawner.intThe maximum spawn delay amount (in ticks).intThe minimum spawn delay amount (in ticks).intGet the maximum distance(squared) a player can be in order for this spawner to be active.intGet how many mobs attempt to spawn.Get the spawner's creature type.intGet the radius around which the spawner will attempt to spawn mobs in.voidsetCreatureTypeByName(String creatureType) Deprecated.magic value, usesetSpawnedType(org.bukkit.entity.EntityType).voidsetDelay(int delay) Set the spawner's delay.voidsetMaxNearbyEntities(int maxNearbyEntities) Set the maximum number of similar entities that are allowed to be within spawning range of this spawner.voidsetMaxSpawnDelay(int delay) Set the maximum spawn delay amount (in ticks).voidsetMinSpawnDelay(int delay) Set the minimum spawn delay amount (in ticks).voidsetRequiredPlayerRange(int requiredPlayerRange) Set the maximum distance (squared) a player can be in order for this spawner to be active.voidsetSpawnCount(int spawnCount) Set how many mobs attempt to spawn.voidsetSpawnedType(EntityType creatureType) Set the spawner's creature type.voidsetSpawnRange(int spawnRange) Set the new spawn range.Methods inherited from interface org.bukkit.block.BlockStategetBlock, getBlockData, getChunk, getData, getLightLevel, getLocation, getLocation, getRawData, getType, getWorld, getX, getY, getZ, isPlaced, setBlockData, setData, setRawData, setType, update, update, updateMethods inherited from interface org.bukkit.metadata.MetadatablegetMetadata, hasMetadata, removeMetadata, setMetadataMethods inherited from interface org.bukkit.block.TileStategetPersistentDataContainer
- 
Method Details- 
getSpawnedTypeGet the spawner's creature type.- Returns:
- The creature type.
 
- 
setSpawnedTypeSet the spawner's creature type.- Parameters:
- creatureType- The creature type.
 
- 
setCreatureTypeByNameDeprecated.magic value, usesetSpawnedType(org.bukkit.entity.EntityType).Set the spawner mob type.- Parameters:
- creatureType- The creature type's name.
 
- 
getCreatureTypeNameDeprecated.magic value, usegetSpawnedType().Get the spawner's creature type.- Returns:
- The creature type's name.
 
- 
getDelayint getDelay()Get the spawner's delay.
 This is the delay, in ticks, until the spawner will spawn its next mob.- Returns:
- The delay.
 
- 
setDelayvoid setDelay(int delay) Set the spawner's delay.
 If set to -1, the spawn delay will be reset to a random value betweengetMinSpawnDelay()andgetMaxSpawnDelay().- Parameters:
- delay- The delay.
 
- 
getMinSpawnDelayint getMinSpawnDelay()The minimum spawn delay amount (in ticks).
 This value is used when the spawner resets its delay (for any reason). It will choose a random number betweengetMinSpawnDelay()andgetMaxSpawnDelay()for its nextgetDelay(). Default value is 200 ticks.- Returns:
- the minimum spawn delay amount
 
- 
setMinSpawnDelayvoid setMinSpawnDelay(int delay) Set the minimum spawn delay amount (in ticks).- Parameters:
- delay- the minimum spawn delay amount
- See Also:
 
- 
getMaxSpawnDelayint getMaxSpawnDelay()The maximum spawn delay amount (in ticks).
 This value is used when the spawner resets its delay (for any reason). It will choose a random number betweengetMinSpawnDelay()andgetMaxSpawnDelay()for its nextgetDelay().
 This value must be greater than 0 and less than or equal togetMaxSpawnDelay(). Default value is 800 ticks.- Returns:
- the maximum spawn delay amount
 
- 
setMaxSpawnDelayvoid setMaxSpawnDelay(int delay) Set the maximum spawn delay amount (in ticks).
 This value must be greater than 0, as well as greater than or equal togetMinSpawnDelay()- Parameters:
- delay- the new maximum spawn delay amount
- See Also:
 
- 
getSpawnCountint getSpawnCount()Get how many mobs attempt to spawn.
 Default value is 4.- Returns:
- the current spawn count
 
- 
setSpawnCountvoid setSpawnCount(int spawnCount) Set how many mobs attempt to spawn.- Parameters:
- spawnCount- the new spawn count
 
- 
getMaxNearbyEntitiesint getMaxNearbyEntities()Set the new maximum amount of similar entities that are allowed to be within spawning range of this spawner.
 If more than the maximum number of entities are within range, the spawner will not spawn and try again with a newgetDelay().
 Default value is 16.- Returns:
- the maximum number of nearby, similar, entities
 
- 
setMaxNearbyEntitiesvoid setMaxNearbyEntities(int maxNearbyEntities) Set the maximum number of similar entities that are allowed to be within spawning range of this spawner.
 Similar entities are entities that are of the sameEntityType- Parameters:
- maxNearbyEntities- the maximum number of nearby, similar, entities
 
- 
getRequiredPlayerRangeint 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.
 
- 
setRequiredPlayerRangevoid 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.
 
- 
getSpawnRangeint getSpawnRange()Get the radius around which the spawner will attempt to spawn mobs in.
 This area is square, includes the block the spawner is in, and is centered on the spawner's x,z coordinates - not the spawner itself.
 It is 2 blocks high, centered on the spawner's y-coordinate (its bottom); thus allowing mobs to spawn as high as its top surface and as low as 1 block below its bottom surface.
 Default value is 4.- Returns:
- the spawn range
 
- 
setSpawnRangevoid setSpawnRange(int spawnRange) Set the new spawn range.- Parameters:
- spawnRange- the new spawn range
- See Also:
 
 
- 
getSpawnedType().