Modding: Dimension Custom sun/moon texture

In this tutorial I will show you how to give a custom texture to your sun/moon. This is done in the WorldProvider. This is the file I will start with.


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


This are the vanilla sun and moon textures.

And these are the methods used to change them.


public String getSunTexture()
    {
        return “/customsun.png”;
    }

    public String getMoonTexture()
    {
        return “/custommoon_phases.png”;
    }


Make sure that both of the returned strings are exactly the same location and name as your textures or it will not work.
The whole file should now look like 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 getSunTexture()
    {
        return “/customsun.png”;
    }

    public String getMoonTexture()
    {
        return “/custommoon_phases.png”;
    }

public String func_80007_l() 
{
return null;
}
}


 

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