DrZhark's Custom Mob Spawner
Minecraft 1.8 changed drastically the way the vanilla mobs are spawned. The animals no longer despawn and their spawn is based on the biome seed. In other words, the randomness of spawning was removed. There are several mods that relied on the prior mob spawning method to add custom mobs to the game, like Mo'Creatures, More Creeps and Weirdos, Humans+ and many more.
I have developed a Tool called 'CustomSpawner' that offers modders the ability to have their custom mobs spawned in a similar way than Minecraft prior to 1.8. Every mod will have its individual spawning list, so other mods won't interfere with the spawning settings.
Download the Mod:
-CustomMobSpawner v2.2.2 Mirror (For Minecraft 1.5.2)
Previous versions:
Spoiler:
-CustomMobSpawner v1.12.5 Mirror (For Minecraft 1.5.1)
-CustomMobSpawner v1.12.2 Mirror (For Minecraft 1.5.1)
-CustomMobSpawner v1.11 Mirror (For Minecraft 1.4.7)
-CustomMobSpawner v1.10.0 Mirror (For Minecraft 1.4.6)
-CustomMobSpawner v1.9.0 Mirror (For Minecraft 1.4.5)
-CustomMobSpawner v1.7.1 (For Minecraft 1.4.2) *this version increases spawn frequencies
-CustomMobSpawner v1.7 (For Minecraft 1.4.2)
-CustomMobSpawner v1.6 (For Minecraft 1.3.2)
-CustomMobSpawner v1.5.1 (For Minecraft 1.2.5)
-CustomMobSpawner v1.5 (For Minecraft 1.2.5)
-CustomMobSpawner v1.4.3 mirror (For Minecraft 1.2.5)
-CustomMobSpawner v1.4.2 mirror (For Minecraft 1.2.4)
-CustomMobSpawner v1.4.1 mirror (For Minecraft 1.2.3)
-CustomMobSpawner v1.4 (For Minecraft 1.1)
-CustomMobSpawner v1.3 (For Minecraft 1.0)
-CustomMobSpawner v1.1 (For Minecraft Beta 1.8.1)
-CustomMobSpawner v1.12.5 Mirror (For Minecraft 1.5.1)
-CustomMobSpawner v1.12.2 Mirror (For Minecraft 1.5.1)
-CustomMobSpawner v1.11 Mirror (For Minecraft 1.4.7)
-CustomMobSpawner v1.10.0 Mirror (For Minecraft 1.4.6)
-CustomMobSpawner v1.9.0 Mirror (For Minecraft 1.4.5)
-CustomMobSpawner v1.7.1 (For Minecraft 1.4.2) *this version increases spawn frequencies
-CustomMobSpawner v1.7 (For Minecraft 1.4.2)
-CustomMobSpawner v1.6 (For Minecraft 1.3.2)
-CustomMobSpawner v1.5.1 (For Minecraft 1.2.5)
-CustomMobSpawner v1.5 (For Minecraft 1.2.5)
-CustomMobSpawner v1.4.3 mirror (For Minecraft 1.2.5)
-CustomMobSpawner v1.4.2 mirror (For Minecraft 1.2.4)
-CustomMobSpawner v1.4.1 mirror (For Minecraft 1.2.3)
-CustomMobSpawner v1.4 (For Minecraft 1.1)
-CustomMobSpawner v1.3 (For Minecraft 1.0)
-CustomMobSpawner v1.1 (For Minecraft Beta 1.8.1)
For users:
Just download the .zip file and put it into the /.minecraf/mods/ folder
For Modders:
Spoiler:
Please don't modify or supply the CustomSpawner file with your mod, redirect users to this thread or put the
http://adf.ly/Duxfb link in your own thread. Thanks!
You have to create an instance of the CustomSpawner class, and specify the limits for Mobs, Animals and Aquatic mobs. Then you add the custom spawns in a similar way as Risugami's ModLoader. However you only need to specify the weighted random frequency 'freq'.
You can see how is done by looking at this example: I will post an updated version for CustomSpawner 1.6 shortly, the current one is outdated
If you have any questions, post in this thread.
Also, don't forget to add this override to your EntityAnimals, so they despawn.
Please don't modify or supply the CustomSpawner file with your mod, redirect users to this thread or put the
http://adf.ly/Duxfb link in your own thread. Thanks!
You have to create an instance of the CustomSpawner class, and specify the limits for Mobs, Animals and Aquatic mobs. Then you add the custom spawns in a similar way as Risugami's ModLoader. However you only need to specify the weighted random frequency 'freq'.
You can see how is done by looking at this example: I will post an updated version for CustomSpawner 1.6 shortly, the current one is outdated
If you have any questions, post in this thread.
package net.minecraft.src;
import java.util.Map;
import net.minecraft.client.Minecraft;
public class mod_example extends BaseMod
{
public mod_example()
{
ModLoader.SetInGameHook(this, true, false); //sets the hook to use OnTickInGame
ModLoader.RegisterEntityID(MyMob.class, "MyMob", ModLoader.getUniqueEntityId());
ModLoader.RegisterEntityID(MyAnimalMob.class, "MyAnimalMob", ModLoader.getUniqueEntityId());
ModLoader.RegisterEntityID(MyAquaticMob.class, "MyAquaticMob", ModLoader.getUniqueEntityId());
myCustomSpawner = new CustomSpawner(); //initializes the instance of the spawner
myCustomSpawner.setMaxMobs(50); //sets the maximum number of custom mobs
myCustomSpawner.setMaxAnimals(40); //sets the maximum number of custom peaceful mobs
myCustomSpawner.setMaxAquatic(30); //sets the maximum number of custom aquatic mobs
int freq = 10;
//freq is a weighted random choice. It depends on the other freqs of the list.
//The higher this number, the higher the chance of that particular mob to spawn
//adds MyAnimalMob to the three specified biomes
myCustomSpawner.AddCustomSpawn(MyAnimalMob.class, freq, EnumCreatureType.creature, new BiomeGenBase[] {
BiomeGenBase.forest, BiomeGenBase.plains, BiomeGenBase.taiga });
//adds 'MyAnimalMob' to all the biomes except Hell and Sky
myCustomSpawner.AddCustomSpawn(MyAnimalMob.class, freq, EnumCreatureType.creature);
//adds 'MyMob' to Hell
myCustomSpawner.AddCustomSpawn(MyMob.class, freq, EnumCreatureType.monster, new BiomeGenBase[] { BiomeGenBase.hell });
//adds 'MyMob' to all biomes except Hell and Sky
myCustomSpawner.AddCustomSpawn(MyMob.class, freq, EnumCreatureType.monster);
//adds 'MyAquaticMob' to the Ocean and River biomes
myCustomSpawner.AddCustomSpawn(MyAquaticMob.class, freq, EnumCreatureType.waterCreature, new BiomeGenBase[] {
BiomeGenBase.ocean, BiomeGenBase.river });
//this overwrites the frequency of the MyAquaticMob in the river biome only:
myCustomSpawner.AddCustomSpawn(MyAquaticMob.class, 5, EnumCreatureType.waterCreature, new BiomeGenBase[] {
BiomeGenBase.river });
//this removes MyAnimalMob from the biome plains
myCustomSpawner.RemoveCustomSpawn(MyAnimalMob.class, EnumCreatureType.creature, new BiomeGenBase[] {
BiomeGenBase.plains });
//and this removes MyAnimalMob from all the biomes
myCustomSpawner.RemoveCustomSpawn(MyAnimalMob.class, EnumCreatureType.creature);
}
public boolean OnTickInGame(float f, Minecraft minecraft)
{
if (mc.theWorld.worldInfo.getWorldTime() % 100L == 0L)
//how often to perform this code? change 100L. the higher the number, the less frequent
{
//this code randomly spawns custom mobs based on the lists and maxNumbers populated above
//this is what you would normally need to make your mod behave like it did on Minecraft 1.7
myCustomSpawner.doCustomSpawning(mc.theWorld, mc.gameSettings.difficulty > 0, true);
//the settings here are: the current world, spawns mobs, spawns peaceful creatures
//this code will randomly spawn MyAnimalMob up to 15 times
myCustomSpawner.doSpecificSpawning(mc.theWorld, MyAnimalMob.class, 15, EnumCreatureType.creature);
//There are also methods to despawn vanilla creatures:
//this code reactivates the despawning of vanilla creatures as in Minecraft 1.7
int despawned = myCustomSpawner.despawnMob(mc.theWorld);
System.out.println("despawned " + despawned + " vanilla mobs");
//the despawnMob method, checks the distance of the mob to the player or the 'age' of the mob
//and will despawn vanilla animals that are far away from the player or old enough
//this one despawns wolves, it will ignore tamed wolves, the ones who are near the player and the ones who are not 'old' enough
myCustomSpawner.despawnMob(mc.theWorld, EntityWolf.class);
//or you can provide a list:
myCustomSpawner.despawnMob(mc.theWorld, EntityChicken.class, EntitySheep.class);
//you can also count the number of a particular entity, and despawn but keeping a minimum number of creatures:
if(mc.theWorld.countEntities(EntitySheep.class) >10)
{
int y = myCustomSpawner.despawnMobWithMinimum(mc.theWorld, EntitySheep.class, 10);
System.out.println("despawning " + y + " sheep");
}
//the above code counts the number of sheep, if the number is greater than 10, it will
//despawn sheep while leaving 10 alive.
}
return true;
}
public void AddRenderer(Map map)
{
map.put(MyMob.class, new RenderMyMob(new ModelMyMob(), 0.5F));
map.put(MyAnimalMob.class, new RenderMyAnimalMob(new ModelMyAnimalMob(), 0.5F));
map.put(MyAquaticMob.class, new RenderMyAquaticMob(new ModelMyAquaticMob(), 0.5F));
}
public String Version()
{
return "1.0";
}
private static CustomSpawner myCustomSpawner;
public static Minecraft mc = ModLoader.getMinecraftInstance();
}
Also, don't forget to add this override to your EntityAnimals, so they despawn.
@Override
protected boolean canDespawn()
{
return true;
}
















