Modding 1.4.7: Dimension Customization: Custom movement factor

In this tutorial I will show you how to give your dimension a custom movement factor. This is used in the Nether. When you move 1 block in the Nether it is 8 blocks in the overworld. This is done in the WorldProvider class and this is the one I will start with.


package tutorial;

import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.IChunkProvider;

public class WorldProviderTutorial extends WorldProvider
{
public void registerWorldChunkManager()
{
this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.beach, 0.8F, 0.1F);
this.dimensionId = Tutorial.dimension;
}

public String getDimensionName() 
{
return “Tutorial”;
}

public boolean canRespawnHere()
{
return true;
}

public String getSaveFolder()
    {
        return “Custom Dimension Tutorial Folder”;
    }

@Override
public IChunkProvider createChunkGenerator()
{
return new ChunkProviderTutorial(worldObj, worldObj.getSeed(), true);
}
}


To change the movement factor you only have to add one single easy method. It looks like this.


public double getMovementFactor()
    {
return 25.0;
    }


The returned number is simply the movement factor. Right now you will move 25 blocks in the overworld when you move one in the custom dimension. This can be pretty useful for fast travels.
The whole file should now look something like this.


package tutorial;

import net.minecraft.world.WorldProvider;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.WorldChunkManagerHell;
import net.minecraft.world.chunk.IChunkProvider;

public class WorldProviderTutorial extends WorldProvider
{
public void registerWorldChunkManager()
{
this.worldChunkMgr = new WorldChunkManagerHell(BiomeGenBase.beach, 0.8F, 0.1F);
this.dimensionId = Tutorial.dimension;
}

public String getDimensionName() 
{
return “Tutorial”;
}

public boolean canRespawnHere()
{
return true;
}

public String getSaveFolder()
    {
        return “Custom Dimension Tutorial Folder”;
    }

public double getMovementFactor()
    {
return 25.0;
    }

@Override
public IChunkProvider createChunkGenerator()
{
return new ChunkProviderTutorial(worldObj, worldObj.getSeed(), true);
}
}


 

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