Skip to content

Add a render to an entity

Timmypote edited this page May 29, 2017 · 1 revision

We are going to see how to add a simple render of your CraftStudio model to an entity.


Requirements

You'll need to create a simple entity, we aren't going to see the complete process here, to gain time, but you can find good tuturial online.


Render class

Go to the render class of your entity:

public class RenderTest<T extends EntityTest> extends RenderLiving<T>
{
    public RenderTest(RenderManager manager) {
        super(manager, new ModelCraftStudio(ModTutorial.MODID, "my_model", 64, 32), 0.5F);
    }
}

As you can see, we just need to replace ModelBase by ModelCraftStudio.

The API load your registered resources before the game pre-init to create the 3D render in Minecraft.

We must give some parameters to the constructor of ModelCraftStudio.

new ModelCraftStudio(modidIn, resourceIn, textureWidth, textureHeight);

modidIn is the id of your mod, resourceIn is the name of your 3D model previously registered, textureWidth and textureHeight are the width and heigth of your texture.

Tip: If the texture is a square, width is the same as height, you can use the function:

new ModelCraftStudio(modidIn, resourceIn, textureWidthAndHeigth);

Exemple:

new ModelCraftStudio(ModTutorial.MODID, "my_model", 64);

And Voilà ! You now have added your CraftStudio model to your entity !

If you want to animate it, it's here!

Clone this wiki locally