Hello
you can learn stuff about modding if you click on the spoilers below.
Since there are so many tutorials on how to make blocks, items, tools, armor ect. I am trying to focus my tutorials away from them and onto topics less covered. Right now the tutorials are fairly simple but don't wory I will be getting into more advanced stuff in a bit. Next I will either show you how to generate stuff in chests and mobspawners or how to do generation in modloader. If you have any preference tell me.
How to make a new biome
So first of all biome generation does not use modloader but generating stuff does so you might as well install it now. If you don't know how to set up MCP with modloader go look at one of the many tutorials on it.
Once you have MCP set up go into the src\minecraft\net\minecraft\src folder where all the java code is and open BiomegenBase.java and find the clump of public static final codes. After the code
public static final BiomeGenBase sky = (new BiomeGenSky()).setColor(0x8080ff).setBiomeName("Sky").setDisableRain();
insert this code
public static final BiomeGenBase pumpkinz = (new BiomeGenBase()).setColor(0x8080ff).setBiomeName("pumpkinz");
replace Pumpkinz with whatever you want your biome to be called. This code allows your biome to be generated now we have to generate it. In order to do that find the method called
public static BiomeGenBase getBiome(float f, float f1)
and replace three of the biome names with what you called you biome. That should make it common enough so it doesn't take to long to find. Now lets customize the biome. Look for
make sure you replace pupkinz with the name of your biome. That code places the top and filler block of the biome. The default is of course grass as the top block and dirt as the filler. Deserts have sand as both. Anyway that code makes the top block pumpkinz and the filler block glowstone. You can change the block to what ever you want. Look in Block.java to find the correct block names. Oh just don't use fire as the top block and tnt as the filler. Here is the whole code in case you are confused on where to put stuff. The next tutorial will be on how to customize your biome further.
package net.minecraft.src;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class BiomeGenBase
{
protected BiomeGenBase()
{
topBlock = (byte)Block.grass.blockID;
fillerBlock = (byte)Block.dirt.blockID;
field_6502_q = 0x4ee031;
spawnableMonsterList = new ArrayList();
spawnableCreatureList = new ArrayList();
spawnableWaterCreatureList = new ArrayList();
enableRain = true;
spawnableMonsterList.add(new SpawnListEntry(net.minecraft.src.EntitySpider.class, 10));
spawnableMonsterList.add(new SpawnListEntry(net.minecraft.src.EntityZombie.class, 10));
spawnableMonsterList.add(new SpawnListEntry(net.minecraft.src.EntitySkeleton.class, 10));
spawnableMonsterList.add(new SpawnListEntry(net.minecraft.src.EntityCreeper.class, 10));
spawnableMonsterList.add(new SpawnListEntry(net.minecraft.src.EntitySlime.class, 10));
spawnableCreatureList.add(new SpawnListEntry(net.minecraft.src.EntitySheep.class, 12));
spawnableCreatureList.add(new SpawnListEntry(net.minecraft.src.EntityPig.class, 10));
spawnableCreatureList.add(new SpawnListEntry(net.minecraft.src.EntityChicken.class, 10));
spawnableCreatureList.add(new SpawnListEntry(net.minecraft.src.EntityCow.class, 8));
spawnableWaterCreatureList.add(new SpawnListEntry(net.minecraft.src.EntitySquid.class, 10));
}
private BiomeGenBase setDisableRain()
{
enableRain = false;
return this;
}
public static void generateBiomeLookup()
{
for(int i = 0; i < 64; i++)
{
for(int j = 0; j < 64; j++)
{
biomeLookupTable[i + j * 64] = getBiome((float)i / 63F, (float)j / 63F);
}
}
pumpkinz.topBlock = (byte)Block.pumpkin.blockID;
pumpkinz.fillerBlock = (byte)Block.glowStone.blockID;
desert.topBlock = desert.fillerBlock = (byte)Block.sand.blockID;
iceDesert.topBlock = iceDesert.fillerBlock = (byte)Block.sand.blockID;
}
public WorldGenerator getRandomWorldGenForTrees(Random random)
{
if(random.nextInt(10) == 0)
{
return new WorldGenBigTree();
} else
{
return new WorldGenTrees();
}
}
protected BiomeGenBase setEnableSnow()
{
enableSnow = true;
return this;
}
protected BiomeGenBase setBiomeName(String s)
{
biomeName = s;
return this;
}
protected BiomeGenBase func_4124_a(int i)
{
field_6502_q = i;
return this;
}
protected BiomeGenBase setColor(int i)
{
color = i;
return this;
}
public static BiomeGenBase getBiomeFromLookup(double d, double d1)
{
int i = (int)(d * 63D);
int j = (int)(d1 * 63D);
return biomeLookupTable[i + j * 64];
}
public static BiomeGenBase getBiome(float f, float f1)
{
f1 *= f;
if(f < 0.1F)
{
return tundra;
}
if(f1 < 0.2F)
{
if(f < 0.5F)
{
return tundra;
}
if(f < 0.95F)
{
return savanna;
} else
{
return desert;
}
}
if(f1 > 0.5F && f < 0.7F)
{
return swampland;
}
if(f < 0.5F)
{
return taiga;
}
if(f < 0.97F)
{
if(f1 < 0.35F)
{
return pumpkinz;
} else
{
return pumpkinz;
}
}
if(f1 < 0.45F)
{
return pumpkinz;
}
if(f1 < 0.9F)
{
return pumpkinz;
} else
{
return rainforest;
}
}
public int getSkyColorByTemp(float f)
{
f /= 3F;
if(f < -1F)
{
f = -1F;
}
if(f > 1.0F)
{
f = 1.0F;
}
return java.awt.Color.getHSBColor(0.6222222F - f * 0.05F, 0.5F + f * 0.1F, 1.0F).getRGB();
}
public List getSpawnableList(EnumCreatureType enumcreaturetype)
{
if(enumcreaturetype == EnumCreatureType.monster)
{
return spawnableMonsterList;
}
if(enumcreaturetype == EnumCreatureType.creature)
{
return spawnableCreatureList;
}
if(enumcreaturetype == EnumCreatureType.waterCreature)
{
return spawnableWaterCreatureList;
} else
{
return null;
}
}
public boolean getEnableSnow()
{
return enableSnow;
}
public boolean canSpawnLightningBolt()
{
if(enableSnow)
{
return false;
} else
{
return enableRain;
}
}
public static final BiomeGenBase rainforest = (new BiomeGenRainforest()).setColor(0x8fa36).setBiomeName("Rainforest").func_4124_a(0x1ff458);
public static final BiomeGenBase swampland = (new BiomeGenSwamp()).setColor(0x7f9b2).setBiomeName("Swampland").func_4124_a(0x8baf48);
public static final BiomeGenBase seasonalForest = (new BiomeGenBase()).setColor(0x9be023).setBiomeName("Seasonal Forest");
public static final BiomeGenBase forest = (new BiomeGenForest()).setColor(0x56621).setBiomeName("Forest").func_4124_a(0x4eba31);
public static final BiomeGenBase savanna = (new BiomeGenDesert()).setColor(0xd9e023).setBiomeName("Savanna");
public static final BiomeGenBase shrubland = (new BiomeGenBase()).setColor(0xa1ad20).setBiomeName("Shrubland");
public static final BiomeGenBase taiga = (new BiomeGenTaiga()).setColor(0x2eb153).setBiomeName("Taiga").setEnableSnow().func_4124_a(0x7bb731);
public static final BiomeGenBase desert = (new BiomeGenDesert()).setColor(0xfa9418).setBiomeName("Desert").setDisableRain();
public static final BiomeGenBase plains = (new BiomeGenDesert()).setColor(0xffd910).setBiomeName("Plains");
public static final BiomeGenBase iceDesert = (new BiomeGenDesert()).setColor(0xffed93).setBiomeName("Ice Desert").setEnableSnow().setDisableRain().func_4124_a(0xc4d339);
public static final BiomeGenBase tundra = (new BiomeGenBase()).setColor(0x57ebf9).setBiomeName("Tundra").setEnableSnow().func_4124_a(0xc4d339);
public static final BiomeGenBase hell = (new BiomeGenHell()).setColor(0xff0000).setBiomeName("Hell").setDisableRain();
public static final BiomeGenBase sky = (new BiomeGenSky()).setColor(0x8080ff).setBiomeName("Sky").setDisableRain();
public static final BiomeGenBase pumpkinz = (new BiomeGenBase()).setColor(0x8080ff).setBiomeName("pumpkinz");
public String biomeName;
public int color;
public byte topBlock;
public byte fillerBlock;
public int field_6502_q;
protected List spawnableMonsterList;
protected List spawnableCreatureList;
protected List spawnableWaterCreatureList;
private boolean enableSnow;
private boolean enableRain;
private static BiomeGenBase biomeLookupTable[] = new BiomeGenBase[4096];
static
{
generateBiomeLookup();
}
}
Here is my pumpkiz biome
Biome customization
There are a few ways you can customize your biome further
1.change the spawn rate of mobs inside the biome
2.make certain feature more common inside your biome like reeds or trees
3.change rain and snow settings
In order to customize your biome you will need to make a new java file called BiomeGen(Insert name here). I will call mine BiomeGenWolf. Insert this code into your file.
package net.minecraft.src;
import java.util.Random;
public class BiomeGenWolf extends BiomeGenBase
{
public BiomeGenWolf()
{
}
}
it will make it so wolves are very common. You can change the EntityWolf to what ever mob you want it to spawn. The number after the comma is how rare it is. Normally wolves have a spawn rate of 2 and are very rare.
If you add this method
public WorldGenerator getRandomWorldGenForTrees(Random random)
{
return new WorldGenPumpkin();
}
it will allow to to spawn in various features into your biome. I spawned in pumpkinz but you can also spawn in trees, reeds, tallgrass, ect. or make a custon generation of your own(next tutorial). Make sure your biome has a top block that the generation can spawn on. For example I couldn't generate pumpkinz, reeds or trees in my pumpkinz biome because they all need a top block of grass or dirt to grow.
Now lets go back into the BiomeGenBase file and add in your biome (previous tutorial). In the last tutorial when we made the biome we used the code
(new BiomeGenBase())
Make sure you change this code to the name of the file you made. So I would say
(new BiomeGenWolf())
There are two more codes you can add to your biomes public static final method.
.setDisableRain()//////////disables rain like in a desert
.setEnableSnow()//////////enables snow like in the tundra
Alright here is the whole BiomeGenWolf.java
package net.minecraft.src;
import java.util.Random;
public class BiomeGenWolf extends BiomeGenBase
{
public BiomeGenWolf()
{
spawnableCreatureList.add(new SpawnListEntry(net.minecraft.src.EntityWolf.class, 15));
}
public WorldGenerator getRandomWorldGenForTrees(Random random)
{
return new WorldGenPumpkin();
}
}
and this is all you need to add to the BiomeGenBase.jave
public static final BiomeGenBase wolf = (new BiomeGenWolf()).setColor(0x8080ff).setBiomeName("wolf");
I'm not sure what setColor does exactly but if I find out I will tell you. Oh and here is the wolf biome
ya wolves and pumpkinz!
Setting Up Surface Generation
In the fist tutorial I said that generation needs mod loader but then I realized it doesn't. So now I will teach you the non modloader way. If anyone wants to know how to do it with modloader tell me and I will make a tutorial on it. First things first make a new file called WorldGen(insert name here).
Mine will be WorldGenLava. Now the code you put in is very simple because right now all we are doing is generating one block and here it is
package net.minecraft.src;
import java.util.Random;
public class WorldGenLava extends WorldGenerator
{
public WorldGenLava()
{
}
public boolean generate(World world, Random rand, int i, int j, int k)
{
world.setBlock(i, j, k, 11);
return true;
}
}
So that's basically it, very simple. You use the world.setBlock function to place a block. This block will always be placed on the surface. You might be wondering what the i, j, k, 11 inside the parentheses mean. Well I'll tell ya. The i, j, k correspond to x, y, and z coordinates. So you can add whole numbers to change the position of the block you want to spawn. You can have more than one world.setBlock but if you have too many there will be a lot of lag. The number after k is what block ID is supposed to spawn there. 11 is lava. Check on the minecraft wiki or somewhere to find the complete list of block IDs. I've never tried it with an item data value but I assume minecraft would crash. Now you must add this generation into a biome which I told you how to do in Biome Customization.
Can you please make a modloader tutorial?
because I wrote a Biome with another biome tutorial but it doesn't work
and I've written the rest of my mod with modloader...
No offense but i found it hard to follow. you should have put it so we can see because u said put whatever after whatever but then u said to change 3 biomes to yours is there a way around eliminating biomes or is that just so it is common?
Could i have help? I'm trying to make melons spawn like pumpkins but they're not spawning, just pumpkins. I just copied the pumpkin code and replaced the name of the class and the block from pumpkin to melon. Could someone help?
you can learn stuff about modding if you click on the spoilers below.
Since there are so many tutorials on how to make blocks, items, tools, armor ect. I am trying to focus my tutorials away from them and onto topics less covered. Right now the tutorials are fairly simple but don't wory I will be getting into more advanced stuff in a bit. Next I will either show you how to generate stuff in chests and mobspawners or how to do generation in modloader. If you have any preference tell me.
So first of all biome generation does not use modloader but generating stuff does so you might as well install it now. If you don't know how to set up MCP with modloader go look at one of the many tutorials on it.
Once you have MCP set up go into the src\minecraft\net\minecraft\src folder where all the java code is and open BiomegenBase.java and find the clump of public static final codes. After the code
insert this code
replace Pumpkinz with whatever you want your biome to be called. This code allows your biome to be generated now we have to generate it. In order to do that find the method called
and replace three of the biome names with what you called you biome. That should make it common enough so it doesn't take to long to find. Now lets customize the biome. Look for
and then insert this after it
make sure you replace pupkinz with the name of your biome. That code places the top and filler block of the biome. The default is of course grass as the top block and dirt as the filler. Deserts have sand as both. Anyway that code makes the top block pumpkinz and the filler block glowstone. You can change the block to what ever you want. Look in Block.java to find the correct block names. Oh just don't use fire as the top block and tnt as the filler. Here is the whole code in case you are confused on where to put stuff. The next tutorial will be on how to customize your biome further.
There are a few ways you can customize your biome further
1.change the spawn rate of mobs inside the biome
2.make certain feature more common inside your biome like reeds or trees
3.change rain and snow settings
In order to customize your biome you will need to make a new java file called BiomeGen(Insert name here). I will call mine BiomeGenWolf. Insert this code into your file.
if you add
inside of
it will make it so wolves are very common. You can change the EntityWolf to what ever mob you want it to spawn. The number after the comma is how rare it is. Normally wolves have a spawn rate of 2 and are very rare.
If you add this method
it will allow to to spawn in various features into your biome. I spawned in pumpkinz but you can also spawn in trees, reeds, tallgrass, ect. or make a custon generation of your own(next tutorial). Make sure your biome has a top block that the generation can spawn on. For example I couldn't generate pumpkinz, reeds or trees in my pumpkinz biome because they all need a top block of grass or dirt to grow.
Now lets go back into the BiomeGenBase file and add in your biome (previous tutorial). In the last tutorial when we made the biome we used the code
Make sure you change this code to the name of the file you made. So I would say
There are two more codes you can add to your biomes public static final method.
Alright here is the whole BiomeGenWolf.java
ya wolves and pumpkinz!
In the fist tutorial I said that generation needs mod loader but then I realized it doesn't. So now I will teach you the non modloader way. If anyone wants to know how to do it with modloader tell me and I will make a tutorial on it. First things first make a new file called WorldGen(insert name here).
Mine will be WorldGenLava. Now the code you put in is very simple because right now all we are doing is generating one block and here it is
So that's basically it, very simple. You use the world.setBlock function to place a block. This block will always be placed on the surface. You might be wondering what the i, j, k, 11 inside the parentheses mean. Well I'll tell ya. The i, j, k correspond to x, y, and z coordinates. So you can add whole numbers to change the position of the block you want to spawn. You can have more than one world.setBlock but if you have too many there will be a lot of lag. The number after k is what block ID is supposed to spawn there. 11 is lava. Check on the minecraft wiki or somewhere to find the complete list of block IDs. I've never tried it with an item data value but I assume minecraft would crash. Now you must add this generation into a biome which I told you how to do in Biome Customization.
ive never even moded but i will probably try this
DIAMOND BIOME HERE I COME!
because I wrote a Biome with another biome tutorial but it doesn't work
and I've written the rest of my mod with modloader...
I make Minecraft Videos, So subscribe if you like it and ask me if you want me to do an adventure map!