Package org.bukkit.event.entity

# Enum Class CreatureSpawnEvent.SpawnReason

java.lang.Object
java.lang.Enum<CreatureSpawnEvent.SpawnReason>
org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason

All Implemented Interfaces:
  `Serializable`, `Comparable<CreatureSpawnEvent.SpawnReason>`, `Constable`

Enclosing class:
  CreatureSpawnEvent

public static enum CreatureSpawnEvent.SpawnReason extends Enum<CreatureSpawnEvent.SpawnReason>
An enum to specify the type of spawning

## Nested Class Summary

## Nested classes/interfaces inherited from class java.lang.Enum

`Enum.EnumDesc<E extends Enum<E>>`

## Enum Constant Summary

Enum Constants
Enum Constant
Description
`BEEHIVE`
When a bee is released from a beehive/bee nest
`BREEDING`
When an animal breeds to create a child
`BUILD_IRONGOLEM`
When an iron golem is spawned by being built
`BUILD_SNOWMAN`
When a snowman is spawned by being built
`BUILD_WITHER`
When a wither boss is spawned by being built
`CHUNK_GEN`
Deprecated.
no longer called, chunks are generated with entities already existing.
`COMMAND`
When a creature is spawned by the "/summon" command
`CURED`
When a villager is cured from infection
`CUSTOM`
When a creature is spawned by plugins
`DEFAULT`
When an entity is missing a SpawnReason
`DISPENSE_EGG`
When a creature is spawned by a dispenser dispensing an egg
`DROWNED`
When a creature is spawned by another entity drowning
`EGG`
When a creature spawns from an egg
`ENDER_PEARL`
When an entity is spawned as a result of ender pearl usage
`EXPLOSION`
When eg an effect cloud is spawned as a result of a creeper exploding
`FROZEN`
When an entity is shaking in Powder Snow and a new entity spawns.
`INFECTION`
When a zombie infects a villager
`JOCKEY`
When an entity spawns as a jockey of another entity (mostly spider jockeys)
`LIGHTNING`
When a creature spawns because of a lightning strike
`MOUNT`
When an entity spawns as a mount of another entity (mostly chicken jockeys)
`NATURAL`
When something spawns from natural means
`NETHER_PORTAL`
When a creature is spawned by nether portal
`OCELOT_BABY`
When an ocelot has a baby spawned along with them
`PATROL`
When an entity is spawned as part of a patrol
`PIGLIN_ZOMBIFIED`
When a piglin is converted to a zombified piglin.
`RAID`
When an entity is spawned as part of a raid
`REINFORCEMENTS`
When an entity calls for reinforcements
`SHEARED`
When an cow is spawned by shearing a mushroom cow
`SHOULDER_ENTITY`
When an entity is spawned as a result of the entity it is being perched on jumping or being damaged
`SILVERFISH_BLOCK`
When a silverfish spawns from a block
`SLIME_SPLIT`
When a slime splits
`SPAWNER`
When a creature spawns from a spawner
`SPAWNER_EGG`
When a creature spawns from a Spawner Egg
`SPELL`
When an entity is created by a cast spell.
`TRAP`
When an entity spawns as a trap for players approaching
`VILLAGE_DEFENSE`
When an iron golem is spawned to defend a village
`VILLAGE_INVASION`
When a zombie is spawned to invade a village

## Method Summary

Modifier and Type
Method
Description
`static CreatureSpawnEvent.SpawnReason`
`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static CreatureSpawnEvent.SpawnReason[]`
`values()`
Returns an array containing the constants of this enum class, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

## Enum Constant Details

### NATURAL

public static final CreatureSpawnEvent.SpawnReason NATURAL
When something spawns from natural means

### JOCKEY

public static final CreatureSpawnEvent.SpawnReason JOCKEY
When an entity spawns as a jockey of another entity (mostly spider jockeys)

### CHUNK_GEN

@Deprecated public static final CreatureSpawnEvent.SpawnReason CHUNK_GEN
Deprecated.
no longer called, chunks are generated with entities already existing. Consider using `ChunkLoadEvent`, `ChunkLoadEvent.isNewChunk()` and `Chunk.getEntities()` for similar effect.
When a creature spawns due to chunk generation

### SPAWNER

public static final CreatureSpawnEvent.SpawnReason SPAWNER
When a creature spawns from a spawner

### EGG

public static final CreatureSpawnEvent.SpawnReason EGG
When a creature spawns from an egg

### SPAWNER_EGG

public static final CreatureSpawnEvent.SpawnReason SPAWNER_EGG
When a creature spawns from a Spawner Egg

### LIGHTNING

public static final CreatureSpawnEvent.SpawnReason LIGHTNING
When a creature spawns because of a lightning strike

### BUILD_SNOWMAN

public static final CreatureSpawnEvent.SpawnReason BUILD_SNOWMAN
When a snowman is spawned by being built

### BUILD_IRONGOLEM

public static final CreatureSpawnEvent.SpawnReason BUILD_IRONGOLEM
When an iron golem is spawned by being built

### BUILD_WITHER

public static final CreatureSpawnEvent.SpawnReason BUILD_WITHER
When a wither boss is spawned by being built

### VILLAGE_DEFENSE

public static final CreatureSpawnEvent.SpawnReason VILLAGE_DEFENSE
When an iron golem is spawned to defend a village

### VILLAGE_INVASION

public static final CreatureSpawnEvent.SpawnReason VILLAGE_INVASION
When a zombie is spawned to invade a village

### BREEDING

public static final CreatureSpawnEvent.SpawnReason BREEDING
When an animal breeds to create a child

### SLIME_SPLIT

public static final CreatureSpawnEvent.SpawnReason SLIME_SPLIT
When a slime splits

### REINFORCEMENTS

public static final CreatureSpawnEvent.SpawnReason REINFORCEMENTS
When an entity calls for reinforcements

### NETHER_PORTAL

public static final CreatureSpawnEvent.SpawnReason NETHER_PORTAL
When a creature is spawned by nether portal

### DISPENSE_EGG

public static final CreatureSpawnEvent.SpawnReason DISPENSE_EGG
When a creature is spawned by a dispenser dispensing an egg

### INFECTION

public static final CreatureSpawnEvent.SpawnReason INFECTION
When a zombie infects a villager

### CURED

public static final CreatureSpawnEvent.SpawnReason CURED
When a villager is cured from infection

### OCELOT_BABY

public static final CreatureSpawnEvent.SpawnReason OCELOT_BABY
When an ocelot has a baby spawned along with them

### SILVERFISH_BLOCK

public static final CreatureSpawnEvent.SpawnReason SILVERFISH_BLOCK
When a silverfish spawns from a block

### MOUNT

public static final CreatureSpawnEvent.SpawnReason MOUNT
When an entity spawns as a mount of another entity (mostly chicken jockeys)

### TRAP

public static final CreatureSpawnEvent.SpawnReason TRAP
When an entity spawns as a trap for players approaching

### ENDER_PEARL

public static final CreatureSpawnEvent.SpawnReason ENDER_PEARL
When an entity is spawned as a result of ender pearl usage

### SHOULDER_ENTITY

public static final CreatureSpawnEvent.SpawnReason SHOULDER_ENTITY
When an entity is spawned as a result of the entity it is being perched on jumping or being damaged

### DROWNED

public static final CreatureSpawnEvent.SpawnReason DROWNED
When a creature is spawned by another entity drowning

### SHEARED

public static final CreatureSpawnEvent.SpawnReason SHEARED
When an cow is spawned by shearing a mushroom cow

### EXPLOSION

public static final CreatureSpawnEvent.SpawnReason EXPLOSION
When eg an effect cloud is spawned as a result of a creeper exploding

### RAID

public static final CreatureSpawnEvent.SpawnReason RAID
When an entity is spawned as part of a raid

### PATROL

public static final CreatureSpawnEvent.SpawnReason PATROL
When an entity is spawned as part of a patrol

### BEEHIVE

public static final CreatureSpawnEvent.SpawnReason BEEHIVE
When a bee is released from a beehive/bee nest

### PIGLIN_ZOMBIFIED

public static final CreatureSpawnEvent.SpawnReason PIGLIN_ZOMBIFIED
When a piglin is converted to a zombified piglin.

### SPELL

public static final CreatureSpawnEvent.SpawnReason SPELL
When an entity is created by a cast spell.

### FROZEN

public static final CreatureSpawnEvent.SpawnReason FROZEN
When an entity is shaking in Powder Snow and a new entity spawns.

### COMMAND

public static final CreatureSpawnEvent.SpawnReason COMMAND
When a creature is spawned by the "/summon" command

### CUSTOM

public static final CreatureSpawnEvent.SpawnReason CUSTOM
When a creature is spawned by plugins

### DEFAULT

public static final CreatureSpawnEvent.SpawnReason DEFAULT
When an entity is missing a SpawnReason

## Method Details

### values

public static CreatureSpawnEvent.SpawnReason[] values()
Returns an array containing the constants of this enum class, in the order they are declared.

Returns:
  an array containing the constants of this enum class, in the order they are declared

### valueOf

public static CreatureSpawnEvent.SpawnReason valueOf(String name)
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum class has no constant with the specified name
  `NullPointerException` - if the argument is null