Package net.minecraft.entity
Enum SpawnGroup
- All Implemented Interfaces:
Serializable,Comparable<SpawnGroup>,java.lang.constant.Constable,StringIdentifiable
public enum SpawnGroup extends Enum<SpawnGroup> implements StringIdentifiable
A spawn group represents the category of an entity's natural spawning.
Entities that don't support natural spawning belong to the
MISC group.
- See Also:
EntityType.getSpawnGroup(),SpawnHelper
-
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 AMBIENTCREATUREMISCMONSTERWATER_AMBIENTWATER_CREATURE -
Field Summary
Fields Modifier and Type Field Description private static Map<String,SpawnGroup>BY_NAMEprivate intcapacitystatic com.mojang.serialization.Codec<SpawnGroup>CODECA codec that encodes and decodes a spawn group from and to its name string.private intdespawnStartRangeprivate intimmediateDespawnRangeprivate Stringnameprivate booleanpeacefulprivate booleanrare -
Constructor Summary
Constructors Modifier Constructor Description privateSpawnGroup(String name, int spawnCap, boolean peaceful, boolean rare, int immediateDespawnRange) -
Method Summary
Modifier and Type Method Description StringasString()static SpawnGroupbyName(String name)Finds the spawn group with the givenname, ornullif no group has the givenname.intgetCapacity()Returns the maximum number of mobs in this group that can be spawned per chunk.intgetDespawnStartRange()Returns the distance, of a mob of this group from a player, at which that mob can despawn at chance.intgetImmediateDespawnRange()Returns the distance, of a mob of this group from a player, at which that mob will despawn immediately.StringgetName()Returns the name of this spawn group.booleanisPeaceful()Returnstrueif this group is spawned as animals, orfalseif this group is spawned as monsters.booleanisRare()Returns if this spawn group is spawned only rarely.static SpawnGroupvalueOf(String name)Returns the enum constant of this type with the specified name.static SpawnGroup[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
MONSTER
-
CREATURE
-
AMBIENT
-
WATER_CREATURE
-
WATER_AMBIENT
-
MISC
-
-
Field Details
-
CODEC
A codec that encodes and decodes a spawn group from and to its name string. -
BY_NAME
-
capacity
private final int capacity -
peaceful
private final boolean peaceful -
rare
private final boolean rare -
name
-
despawnStartRange
private final int despawnStartRange- See Also:
- Constant Field Values
-
immediateDespawnRange
private final int immediateDespawnRange
-
-
Constructor Details
-
SpawnGroup
private SpawnGroup(String name, int spawnCap, boolean peaceful, boolean rare, int immediateDespawnRange)
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException- if the argument is null
-
getName
Returns the name of this spawn group.The names are unique and are in
lower_snake_case. -
asString
- Specified by:
asStringin interfaceStringIdentifiable
-
byName
Finds the spawn group with the givenname, ornullif no group has the givenname.- Parameters:
name- the name of the group- Returns:
- the found group, or
null - See Also:
getName()
-
getCapacity
public int getCapacity()Returns the maximum number of mobs in this group that can be spawned per chunk. -
isPeaceful
public boolean isPeaceful()Returnstrueif this group is spawned as animals, orfalseif this group is spawned as monsters. -
isRare
public boolean isRare()Returns if this spawn group is spawned only rarely.A rare spawn only happens when the world time is a multiple of
400inServerChunkManager.tickChunks(). -
getImmediateDespawnRange
public int getImmediateDespawnRange()Returns the distance, of a mob of this group from a player, at which that mob will despawn immediately.This is ignored if a mob cannot immediately despawn.
- See Also:
MobEntity.checkDespawn()
-
getDespawnStartRange
public int getDespawnStartRange()Returns the distance, of a mob of this group from a player, at which that mob can despawn at chance.This is ignored if a mob cannot immediately despawn.
- See Also:
MobEntity.checkDespawn()
-