Package noppes.npcs.api.handler.data
Interface INaturalSpawn
-
public interface INaturalSpawnConfigures a natural spawn entry for custom NPCs, including entity templates, biome restrictions, spawn conditions, and cooldowns.
-
-
Field Summary
Fields Modifier and Type Field Description static intDESPAWN_FORCE_NATURALDespawn mode: force natural despawn behavior.static intDESPAWN_FORCE_PERSISTENTDespawn mode: force persistent (never despawn).static intDESPAWN_PRESERVE_TEMPLATEDespawn mode: preserve the entity template's despawn setting.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetAttemptsPerCycle()String[]getBiomes()intgetCooldownTicks()intgetDespawnMode()IEntitygetEntity(IWorld world, int slot)Returns the entity for a specific spawn slot.intgetMaxAlive()intgetMaxHeight()intgetMinHeight()StringgetName()intgetPlayerMinDistance()Integer[]getSlots()intgetWeight()voidsetAttemptsPerCycle(int attempts)voidsetBiomes(String[] biomes)voidsetCooldownTicks(int ticks)voidsetDespawnMode(int mode)Sets the despawn mode.voidsetEntity(IEntity entity, int slot)Sets the entity template for a specific spawn slot.voidsetMaxAlive(int maxAlive)voidsetMaxHeight(int height)voidsetMinHeight(int height)voidsetName(String name)voidsetPlayerMinDistance(int distance)voidsetWeight(int weight)booleanspawnsInAir()voidspawnsInAir(boolean spawns)booleanspawnsInLiquid()voidspawnsInLiquid(boolean spawns)booleanspawnsLikeAnimal()voidspawnsLikeAnimal(boolean spawns)booleanspawnsLikeMonster()voidspawnsLikeMonster(boolean spawns)
-
-
-
Field Detail
-
DESPAWN_FORCE_NATURAL
static final int DESPAWN_FORCE_NATURAL
Despawn mode: force natural despawn behavior.- See Also:
- Constant Field Values
-
DESPAWN_PRESERVE_TEMPLATE
static final int DESPAWN_PRESERVE_TEMPLATE
Despawn mode: preserve the entity template's despawn setting.- See Also:
- Constant Field Values
-
DESPAWN_FORCE_PERSISTENT
static final int DESPAWN_FORCE_PERSISTENT
Despawn mode: force persistent (never despawn).- See Also:
- Constant Field Values
-
-
Method Detail
-
setName
void setName(String name)
- Parameters:
name- the display name for this spawn entry.
-
getName
String getName()
- Returns:
- the display name of this spawn entry.
-
setEntity
void setEntity(IEntity entity, int slot)
Sets the entity template for a specific spawn slot.- Parameters:
entity- the entity template.slot- the slot index.
-
getEntity
IEntity getEntity(IWorld world, int slot)
Returns the entity for a specific spawn slot.- Parameters:
world- the world context for entity creation.slot- the slot index.- Returns:
- the entity, or null if the slot is empty.
-
getSlots
Integer[] getSlots()
- Returns:
- the populated slot indices.
-
setWeight
void setWeight(int weight)
- Parameters:
weight- the spawn weight (higher = more frequent).
-
getWeight
int getWeight()
- Returns:
- the spawn weight.
-
setMinHeight
void setMinHeight(int height)
- Parameters:
height- the minimum Y-level for spawning.
-
getMinHeight
int getMinHeight()
- Returns:
- the minimum Y-level.
-
setMaxHeight
void setMaxHeight(int height)
- Parameters:
height- the maximum Y-level for spawning.
-
getMaxHeight
int getMaxHeight()
- Returns:
- the maximum Y-level.
-
spawnsLikeAnimal
void spawnsLikeAnimal(boolean spawns)
- Parameters:
spawns- whether entities can spawn using animal spawn rules.
-
spawnsLikeAnimal
boolean spawnsLikeAnimal()
- Returns:
- true if animal spawn rules apply.
-
spawnsLikeMonster
void spawnsLikeMonster(boolean spawns)
- Parameters:
spawns- whether entities can spawn using monster spawn rules.
-
spawnsLikeMonster
boolean spawnsLikeMonster()
- Returns:
- true if monster spawn rules apply.
-
spawnsInLiquid
void spawnsInLiquid(boolean spawns)
- Parameters:
spawns- whether entities can spawn in liquid.
-
spawnsInLiquid
boolean spawnsInLiquid()
- Returns:
- true if spawning in liquid is allowed.
-
spawnsInAir
void spawnsInAir(boolean spawns)
- Parameters:
spawns- whether entities can spawn in the air.
-
spawnsInAir
boolean spawnsInAir()
- Returns:
- true if spawning in air is allowed.
-
getBiomes
String[] getBiomes()
- Returns:
- the biome names this spawn is restricted to.
-
setBiomes
void setBiomes(String[] biomes)
- Parameters:
biomes- the biome names to restrict spawning to.
-
setMaxAlive
void setMaxAlive(int maxAlive)
- Parameters:
maxAlive- the maximum number of alive entities from this spawn at once.
-
getMaxAlive
int getMaxAlive()
- Returns:
- the maximum alive entity count.
-
setCooldownTicks
void setCooldownTicks(int ticks)
- Parameters:
ticks- the cooldown in ticks between spawn attempts.
-
getCooldownTicks
int getCooldownTicks()
- Returns:
- the cooldown in ticks.
-
setAttemptsPerCycle
void setAttemptsPerCycle(int attempts)
- Parameters:
attempts- the number of spawn attempts per cycle.
-
getAttemptsPerCycle
int getAttemptsPerCycle()
- Returns:
- the number of spawn attempts per cycle.
-
setPlayerMinDistance
void setPlayerMinDistance(int distance)
- Parameters:
distance- the minimum distance from a player for spawning.
-
getPlayerMinDistance
int getPlayerMinDistance()
- Returns:
- the minimum distance from a player.
-
setDespawnMode
void setDespawnMode(int mode)
Sets the despawn mode.- Parameters:
mode- 0: DESPAWN_FORCE_NATURAL, 1: DESPAWN_PRESERVE_TEMPLATE, 2: DESPAWN_FORCE_PERSISTENT.
-
getDespawnMode
int getDespawnMode()
- Returns:
- the despawn mode (0: force natural, 1: preserve template, 2: force persistent).
-
-