Modding 1.4.7: Basic Mob Tutorial Part 7: Render File

In this tutorial I will show you how to create a Render file for your mob.
To get started with this tutorial right click on the package from your mod and click new Class. The name should be something like RenderMobName.
When you first create the class you will get something like this.


package tutorial;

public class RenderTutorial {

}


There are quite a lot of things that you will have to add to this file, but they are pretty much the same for every mob. The first thing you need to do is make it extend RenderLiving

You will get an error under the file name. To fix this you will have to add these lines of code.


protected ModelTutorial model;

public RenderTutorial (ModelTutorial modelTutorial, float f)
{
super(modelTutorial, f);
model = ((ModelTutorial)mainModel);
}


The first line of code in here is a variable for your mob’s model. The next tutorial will be about how to create that model.
All the other lines of code make sure that the mob looks like it should. The only thing you should change is ModelTutorial into ModelMobName.

There are 3 more methods that you have to add. All of them look like this.


public void renderTutorial(EntityTutorial entity, double par2, double par4, double par6, float par8, float par9)
    {
        super.doRenderLiving(entity, par2, par4, par6, par8, par9);
    }

public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    {
        renderTutorial((EntityTutorial)par1EntityLiving, par2, par4, par6, par8, par9);
    }

public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    {
        renderTutorial((EntityTutorial)par1Entity, par2, par4, par6, par8, par9);
    }


All of these methods simply make sure that the mob gets displayed correctly. Everything you need to do is change Tutorial into your MobName and it should work great.
The whole file should now look like this.


package tutorial;

import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;

public class RenderTutorial extends RenderLiving
{
protected ModelTutorial model;

public RenderTutorial (ModelTutorial modelTutorial, float f)
{
super(modelTutorial, f);
model = ((ModelTutorial)mainModel);
}

public void renderTutorial(EntityTutorial entity, double par2, double par4, double par6, float par8, float par9)
    {
        super.doRenderLiving(entity, par2, par4, par6, par8, par9);
    }

public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
    {
        renderTutorial((EntityTutorial)par1EntityLiving, par2, par4, par6, par8, par9);
    }

public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    {
        renderTutorial((EntityTutorial)par1Entity, par2, par4, par6, par8, par9);
    }
}


In the next tutorial I will show you how to create the Model file.
The source code will be available at the end of the last tutorial.

Leave a Reply to YoshiGenius Cancel 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="">