Modding 1.4.7: Dimension Customization: No sunlight

In this tutorial I will show you how to remove sunlight from your world. It doesn’t remove the sun and moon, but it does make all the ground in the lowest light level, because there ins’t a light source. Placing torches does fix this. You might want this for a cave world or something like that. The code is done in the WorldProvider. This is the file 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”;
    }

public double getMovementFactor()
    {
return 25.0;
    }

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


To remove sun as a light source from your world you will have to add a constructor to your file. The constructor is a method with the same name as the file, but without a return type. This means that there isn’t a double, String, boolean, IChunkProvider or void before the method name.
It should look something like this.


public WorldProviderTutorial()
{

}


In here you can add certain bits of code that can’t be added elsewhere. To remove all the light you have to add this line of code to the constructor.


this.hasNoSky = true;


That one line of code simply removes all the sunlight from your world. It doesn’t remove the bright skies and the sun though. That is something for a later tutorial.
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 WorldProviderTutorial()
{
this.hasNoSky = true;
}

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);
}
}


I will remove that line of code though. All of this code is optional and I don’t want it in my dimension. It’s a little too dangerous for me.

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