Modding: Dimension Basic WorldProvider

In this tutorial I will teach you how to create your own WorldProvider that you need for your dimension. In the last tutorial you should have made a Block like this.


package Tutorial.common;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import net.minecraft.src.AxisAlignedBB;
import net.minecraft.src.BlockPortalBase;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.Teleporter;
import net.minecraft.src.World;
import net.minecraft.src.WorldProviderBase;

public class BlockTutorialPortal extends BlockPortalBase
{
    public BlockTutorialPortal(int i, int j)
    {
        super(i, j, Material.portal);
        this.setCreativeTab(CreativeTabs.tabBlock);
    }
    
    public String getTextureFile()
    {
            return “/TutTextures.png”;
    }
    
    public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4)
    {
        return null;
    }
    
    public WorldProviderBase getDimension()
{
return new WorldProviderTutorial();
}
    
    public Teleporter getTeleporter()
{
return new TeleporterTutorial();
}
    
    public List canTeleportFromDimension()
{
ArrayList list = new ArrayList();
list.add(0);
list.add(-1);
return list;
}
    
public boolean displayPortalOverlay()
    {
        return true;
    }

public int getOverlayTexture()
{
return blockIndexInTexture;
}

public String getEnteringMessage() 
{
return “Entering The Dimension.”;
}

public String getLeavingMessage() 
{
return “Leaving The Dimension.”;
}

    public int quantityDropped(Random par1Random)
    {
        return 1;
    }
}


The name of your world provider file should be exactly the same as you named it in getDimension(); I suggest hovering your mouse over it and selecting create a class.
When you do that it should look like this.


package Tutorial.common;

import net.minecraft.src.WorldProviderBase;

public class WorldProviderTutorial extends WorldProviderBase {

@Override
public int getDimensionID() {
// TODO Auto-generated method stub
return 0;
}

@Override
public String func_80007_l() {
// TODO Auto-generated method stub
return null;
}

}


Now to make the file good you should change it into this.


package Tutorial.common;

import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.IChunkProvider;
import net.minecraft.src.WorldChunkManagerHell;
import net.minecraft.src.WorldProviderBase;

public class WorldProviderTutorial extends WorldProviderBase 
{
public int getDimensionID() 
{
return 37;
}

public void registerWorldChunkManager()
    {
        worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.extremeHills, 0.8F, 0.1F);
    }

    public IChunkProvider getChunkProvider()
    {
        return new ChunkProviderTutorial(worldObj, worldObj.getSeed(), true);
    }

public boolean canRespawnHere()
    {
        return true;
    }

public String func_80007_l() 
{
return null;
}
}


getDimensionID() is a method that should return the number of the dimension. I suggest having this above 10, but under 65. Under 65 is because of compatibility with Mystcraft and compatibility is always good.
registerWorldChunkManager() is used to get the WorldChunkManager for the dimension. WorldChunkManagerHell is a file that requires a biome, the temperature (has to do with snow) and rain possibility. This file will make sure that there is just 1 biome in the whole world. In this case it will be extremeHills.
getChunkProvider() is used to tell Minecraft which chunk provider to use. Chunk Providers are really important, because they take care of most of the generation in Minecraft. From the bedrock and stone to the dungeons.
canRespawnHere() should be pretty obvious. It requires the return of true or false. If it gets false you will not be able to respawn in that dimension and you will get back to the overworld. True will make the respawn work normal.
func_80007_l is a strange one. Nobody really knows what it does, because it is never used (I think).
This is all you will need for the basic WorldProvider class for your dimension.

In the next couple of tutorials I will teach you how to create all the basic files needed to get your dimension to work. After that I will show some cool things you can do and change in there.

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