Modding 1.4.7: Basic Biome

In this tutorial I will show you how to create your own custom Biome. We will start coding in the mod file for this. This is the file I start with.


package tutorial;

importnet.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.SidedProxy;
importcpw.mods.fml.common.event.FMLInitializationEvent;
importcpw.mods.fml.common.network.NetworkMod;
@Mod(modid = “Tutorial_Tutorialmod”, name = “Tutorial”, version = “1.0”)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
publicclass Tutorial
{
       @SidedProxy(clientSide = “tutorial.ClientProxyTutorial”, serverSide = “tutorial.CommonProxyTutorial”)
       publicstatic CommonProxyTutorial proxy;
      
       publicstaticintdimension = 20;
      
       @Init
       publicvoid load(FMLInitializationEvent event)
       {
             proxy.registerRenderThings();
            
             DimensionManager.registerProviderType(dimension, WorldProviderTutorial.class, false);
             DimensionManager.registerDimension(dimension, dimension);
       }
}

To create your first biome you will have to add this line of code above the @Init and below the proxy line.


publicstatic BiomeGenBase tutorialBiome;


This line will make a BiomeGenBase object called tutorialBiome.
Now use this object in the load method by adding this line of code.


tutorialBiome = newBiomeGenTutorial(53);


This line will set the tutorialBiome variable to the BiomeGenTutorial file. Right now you will get an error under the BiomeGenTutorial, but we will fix that in just a second by creating that file. The paramter you see inside of the BiomeGenTutorial is the id of the Biome. I suggest taking a pretty high number to make sure it doesn’t conflict with Minecraft soon. Don’t make it too high though. Somewhere between 50-70 should work fine.
Now hover your mouse over the BiomeGenTutorial and create the class. You will get something like this.


package tutorial;

importnet.minecraft.world.biome.BiomeGenBase;
publicclass BiomeGenTutorial extends BiomeGenBase
{
}

You will get an error under the file name. To fix that hover over it and click create constructor. Now you will have no more errors in any of these files and the biome will be made out of grass and dirt without anything special. It will also spawn all the mobs like any other biome.
The biome file should now look like this.


package tutorial;

importnet.minecraft.world.biome.BiomeGenBase;
publicclass BiomeGenTutorial extends BiomeGenBase
{
       public BiomeGenTutorial(int par1)
       {
             super(par1);
       }
}

Now to make your biome generate in the normal world you will have to add this line of code to the load method in your mod file, but make sure it is after the tutorialBiome = File line or it will give you errors.


GameRegistry.addBiome(tutorialBiome);


This is a really simple line of code. It will simply add the biome in the parameters to the overworld generation. If you don’t want your biome to generate in the overworld, but in a custom dimension you should not add this line of code.

The whole mod file should now look like this.


package tutorial;

importnet.minecraft.world.biome.BiomeGenBase;
importnet.minecraftforge.common.DimensionManager;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.SidedProxy;
importcpw.mods.fml.common.event.FMLInitializationEvent;
importcpw.mods.fml.common.network.NetworkMod;
importcpw.mods.fml.common.registry.GameRegistry;
@Mod(modid = “Tutorial_Tutorialmod”, name = “Tutorial”, version = “1.0”)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
publicclass Tutorial
{
       @SidedProxy(clientSide = “tutorial.ClientProxyTutorial”, serverSide = “tutorial.CommonProxyTutorial”)
       publicstatic CommonProxyTutorial proxy;
      
       publicstaticintdimension = 20;
      
       publicstatic BiomeGenBase tutorialBiome;
      
       @Init
       publicvoid load(FMLInitializationEvent event)
       {
             proxy.registerRenderThings();
            
             tutorialBiome = new BiomeGenTutorial(53);
            
             GameRegistry.addBiome(tutorialBiome);
            
             DimensionManager.registerProviderType(dimension, WorldProviderTutorial.class, false);
             DimensionManager.registerDimension(dimension, dimension);
       }
}

In the next tutorial I will show you how to add some custom settings to your biome.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">