|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectspawnlist
public final class spawnlist
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:
addremovesetLimitgetLimitspawnlist.MONSTERspawnlist.CREATUREspawnlist.WATERCREATUREAccepts standard minecraft biome names as the biome arguments:
RainforestSwamplandSeasonal ForestForestSavannaShrublandTaigaDesertPlainsIce DesertTundraHellbiomes are allowed, which are shortcuts for collections of the above biomes:
Surface biomes: Base & Desert & SwampHell biomes: HellDesert biomes: Desert, Plains, Ice Desert, SavannaBase biomes: Rainforest, Seasonal Forest, Forest, Shrubland, Taiga, TundraSwamp biomes: Swampland
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();
}
| 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 |
|---|
public static final int MONSTER
public static final int CREATURE
public static final int WATERCREATURE
| Method Detail |
|---|
public static void setLimit(int mobType,
int limit)
public static int getLimit(int mobType)
public static void add(java.lang.String biomeName,
int mobType,
java.lang.Object... mobs)
public static void add(java.lang.String[] biomeNames,
int type,
java.lang.Object... mobs)
public static void remove(java.lang.String biomeName,
int type,
java.lang.Object... mobs)
public static void remove(java.lang.String[] biomeNames,
int type,
java.lang.Object... mobs)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||