Modding: Dimension Finishing it

In this tutorial I will show you how to finish the dimension made in the last few tutorials. This is the mod file that I will start with for this tutorial.


package Tutorial.common;

import net.minecraft.src.Block;
import net.minecraft.src.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid = “YourName_ModName”, name = “ModName”, version = “Version number”)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial 
{
// proxy
@SidedProxy(clientSide = “Tutorial.client.ClientProxyTutorial”, serverSide = “Tutorial.common.CommonProxyTutorial”)
public static CommonProxyTutorial proxy;

public static Block teleporter;

@Init
public void load(FMLInitializationEvent event) 
{
// proxy
proxy.registerRenderThings();

//blocks
teleporter = new BlockTutorialPortal(233, 0).setHardness(-1F).setStepSound(Block.soundGlassFootstep).setLightValue(0.75F).setBlockName(“goblinportal”);

GameRegistry.registerBlock(teleporter);

LanguageRegistry.addName(teleporter, “Portal”);

GameRegistry.addShapelessRecipe(new ItemStack(teleporter, 5), new Object[] 

new ItemStack(Block.dirt)
});
}
}


Now to finish up the dimension you just have to add 1 line of code.


DimensionAPI.registerDimension(new WorldProviderTutorial());


registerDimension is a method used to register the dimension. It makes sure that the world gets generated and mobs are despawned and spawned correctly. DimensionAPI is the file where you can find this and the parameter is the WorldProvider of your dimension.
The whole file should now look like this.


package Tutorial.common;

import net.minecraft.src.Block;
import net.minecraft.src.DimensionAPI;
import net.minecraft.src.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid = “YourName_ModName”, name = “ModName”, version = “Version number”)
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Tutorial 
{
// proxy
@SidedProxy(clientSide = “Tutorial.client.ClientProxyTutorial”, serverSide = “Tutorial.common.CommonProxyTutorial”)
public static CommonProxyTutorial proxy;

public static Block teleporter;

@Init
public void load(FMLInitializationEvent event) 
{
// proxy
proxy.registerRenderThings();

//blocks
teleporter = new BlockTutorialPortal(233, 0).setHardness(-1F).setStepSound(Block.soundGlassFootstep).setLightValue(0.75F).setBlockName(“goblinportal”);

GameRegistry.registerBlock(teleporter);

LanguageRegistry.addName(teleporter, “Portal”);

DimensionAPI.registerDimension(new WorldProviderTutorial());

GameRegistry.addShapelessRecipe(new ItemStack(teleporter, 5), new Object[] 

new ItemStack(Block.dirt)
});
}
}


Now your dimension should be fully functional.
Some things to note is that world generation at the start of your world takes a lot longer. This is because it has to generate all the dimensions at the start of the game. Another thing is that when you enter the dimension for the first time you will fall through the void fog for a while. Even on the fastests computers. Nobody really knows why this happens and nobody knows how to fix it.

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="">