Class spawnlist

java.lang.Object
  extended by spawnlist

public final class spawnlist
extends java.lang.Object

Provides utility methods for modifying the minecraft mob spawn list. An API for mods to use that want to modify the mob spawn list without interfering with each other or even conflicting. There are four methods:

add
Adds mobs to the given biomes' spawnlist
remove
Remove mobs from the given biomes' spawnlist
setLimit
Set the maximum number of mobs of the given type that can spawn
getLimit
Gets the maximum number of mobs of the given type that can spawn
The following mob types are supported (as given by EnumCreatureType), use these names instead of the integer constants:
spawnlist.MONSTER
Hostile mobs, like ghasts, zombies etc.
spawnlist.CREATURE
Neutral mobs, like cows, pigs, chicken
spawnlist.WATERCREATURE
Water creatures, like squids
I would prefer to use enums, but MCP screws up those when decompiling.

Accepts standard minecraft biome names as the biome arguments:

Also, the following convenience collective biomes are allowed, which are shortcuts for collections of the above biomes: Mob arguments are variadic and can be either the mob's registered name or the actual mob class, or mixtures of the two. For example:
 spawnlist.add("Surface biomes", spawnlist.MONSTER, "Giant", "Ghast", "PigZombie", "Slime");
 spawnlist.add("Surface biomes", spawnlist.MONSTER, ef.class);
 spawnlist.remove("Surface biomes", spawnlist.MONSTER, "Creeper", "Zombie", "Spider", "Skeleton");
 spawnlist.remove(new String[]{"Desert biomes", "Rainforest"}, spawnlist.CREATURE, "Cow");
 spawnlist.add("Hell biomes", spawnlist.CREATURE, "Chicken");
 spawnlist.add("Surface biomes", spawnlist.CREATURE, fc.class);
 spawnlist.add(new String[]{"Tundra", "Seasonal Forest"}, spawnlist.MONSTER, Wolf.class);

 spawnlist.setLimit(spawnlist.CREATURE, 100);
 spawnlist.setLimit(spawnlist.WATERCREATURE, 0);
 spawnlist.setLimit(spawnlist.MONSTER, 10);
 spawnlist.getLimit(spawnlist.MONSTER);
 
NOTE: it is outside the scope of spawnlist to regulate the rarity of individual mobs, you need to do that yourself in your entity classes by adjusting getCanSpawnHere() to add a random check. The following example results in a 1/10 chance of spawning:
 public void getCanSpawnHere() {
     if (rand.nextInt(10) != 0)
         return false;
     return super.getCanSpawnHere();
 }
 

Version:
1.3v1

Field Summary
static int CREATURE
          Neutral mobs like Chickens, Pigs
static int MONSTER
          Hostile mobs like Zombies, Skeletons, Ghasts, PigZombies.
static int WATERCREATURE
          Aquatic mobs like squids
 
Method Summary
static void add(java.lang.String[] biomeNames, int type, java.lang.Object... mobs)
          Add mobs to the spawn list of the given biomes (many biome version)
static void add(java.lang.String biomeName, int mobType, java.lang.Object... mobs)
          Adds mobs to the spawn list of the given biome (one biome version)
static int getLimit(int mobType)
          Get the maximum number of mobs of the given type that can spawn.
static void remove(java.lang.String[] biomeNames, int type, java.lang.Object... mobs)
          Remove mobs from the spawn list of the given biomes (many biomes version)
static void remove(java.lang.String biomeName, int type, java.lang.Object... mobs)
          Remove mobs from the spawn list of the given biome (one biome version)
static void setLimit(int mobType, int limit)
          Set the maximum number of mobs of the given type that can spawn.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MONSTER

public static final int MONSTER
Hostile mobs like Zombies, Skeletons, Ghasts, PigZombies.


CREATURE

public static final int CREATURE
Neutral mobs like Chickens, Pigs


WATERCREATURE

public static final int WATERCREATURE
Aquatic mobs like squids

Method Detail

setLimit

public static void setLimit(int mobType,
                            int limit)
Set the maximum number of mobs of the given type that can spawn.


getLimit

public static int getLimit(int mobType)
Get the maximum number of mobs of the given type that can spawn.


add

public static void add(java.lang.String biomeName,
                       int mobType,
                       java.lang.Object... mobs)
Adds mobs to the spawn list of the given biome (one biome version)


add

public static void add(java.lang.String[] biomeNames,
                       int type,
                       java.lang.Object... mobs)
Add mobs to the spawn list of the given biomes (many biome version)


remove

public static void remove(java.lang.String biomeName,
                          int type,
                          java.lang.Object... mobs)
Remove mobs from the spawn list of the given biome (one biome version)


remove

public static void remove(java.lang.String[] biomeNames,
                          int type,
                          java.lang.Object... mobs)
Remove mobs from the spawn list of the given biomes (many biomes version)