@SideOnly(Side.CLIENT)
public class CSRegistryHelper
{
    private String                   modid;

    private static List<LoadElement> loadModelList = new ArrayList();
    private static List<LoadElement> loadAnimList  = new ArrayList();

    /**
     * Constructor for the registry
     *
     * @param modid
     *            Define the ID of your mod
     */
    public CSRegistryHelper(String modid) {
        this.modid = modid;
    }

    /**
     * Pre-register your resource.
     *
     * @param resourceTypeIn
     *            Set your resource type, <br>
     *            {@link EnumResourceType#ANIM} for animation,<br>
     *            {@link EnumResourceType#MODELS} for models <br>
     *            <br>
     * @param renderTypeIn
     *            Set your render type, <br>
     *            {@link EnumRenderType#BLOCK} for a block<br>
     *            {@link EnumRenderType#ENTITY} for an entity<br>
     *            <br>
     *
     * @param resourceNameIn
     *            The name of your resource in assets without extension
     */
    public void register(EnumResourceType resourceTypeIn, EnumRenderType renderTypeIn, String resourceNameIn) {
        capitalCheck(resourceNameIn);
        CSRegistryHelper.register(resourceTypeIn,
                new ResourceLocation(modid, resourceTypeIn.getPath() + renderTypeIn.getFolderName() + resourceNameIn + resourceTypeIn.getExtension()),
                resourceNameIn);
    }

    /**
     * Pre-register your resource.
     *
     * @param resourceTypeIn
     *            Set your resource type, <br>
     *            {@link EnumResourceType#ANIM} for animation,<br>
     *            {@link EnumResourceType#MODELS} for models <br>
     *            <br>
     * @param resourceLocationIn
     *            Custom location of your resource
     *
     * @param resourceNameIn
     *            The name of your resource in assets without extension
     */
    public static void register(EnumResourceType resourceTypeIn, ResourceLocation resourceLocationIn, String resourceNameIn) {
        switch (resourceTypeIn) {
            case MODEL:
                if (CSRegistryHelper.loadModelList != null)
                    CSRegistryHelper.loadModelList.add(new LoadElement(resourceLocationIn, resourceNameIn));
                else
                    CraftStudioApi.getLogger()
                            .error("Unable to load model outside of the RegistryEvent.Register<CSReadedModel> event, use forceRegister instead");
                break;
            case ANIM:
                if (CSRegistryHelper.loadAnimList != null)
                    CSRegistryHelper.loadAnimList.add(new LoadElement(resourceLocationIn, resourceNameIn));
                else
                    CraftStudioApi.getLogger()
                            .error("Unable to load animations outside of the RegistryEvent.Register<CSReadedAnim> event, use forceRegister instead");
                break;
        }
    }

    /**
     * Load all the pre-registered models. Used internally.
     */
    public static void loadModels() {
        if (loadModelList == null)
            return;
        ProgressManager.ProgressBar progressBarModels;
        progressBarModels = ProgressManager.push("Registry Models", CSRegistryHelper.loadModelList.size());

        for (LoadElement el : CSRegistryHelper.loadModelList) {
            progressBarModels.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]");
            registry(EnumResourceType.MODEL, el.resourceLoc, el.ressourceName);
        }
        ProgressManager.pop(progressBarModels);

        CraftStudioApi.getLogger().info(String.format("CraftStudioAPI loaded %s models", CSRegistryHelper.loadModelList.size()));
        CSRegistryHelper.loadModelList = null;
    }

    /**
     * Load all the pre-registered animations. Used internally.
     */
    public static void loadAnims() {
        if (loadAnimList == null)
            return;
        ProgressManager.ProgressBar progressBarAnim;
        progressBarAnim = ProgressManager.push("Registry Animations", CSRegistryHelper.loadAnimList.size());
        for (LoadElement el : CSRegistryHelper.loadAnimList) {
            progressBarAnim.step("[" + el.resourceLoc.getResourceDomain() + ":" + el.ressourceName + "]");
            registry(EnumResourceType.ANIM, el.resourceLoc, el.ressourceName);
        }
        ProgressManager.pop(progressBarAnim);

        CraftStudioApi.getLogger().info(String.format("CraftStudioAPI loaded %s animations", CSRegistryHelper.loadAnimList.size()));
        CSRegistryHelper.loadAnimList = null;
    }

    /**
     * Register an assets.
     * 
     * @param resourceTypeIn
     *            The resource type.
     * @param resourceLocationIn
     *            Location of the resource.
     * @param resourceNameIn
     *            The name of your resource.
     */
    private static void registry(EnumResourceType resourceTypeIn, ResourceLocation resourceLocationIn, String resourceNameIn) {
        CSJsonReader jsonReader;
        try {
            jsonReader = new CSJsonReader(resourceLocationIn);
            if (resourceLocationIn.getResourceDomain() != CraftStudioApi.API_ID)
                switch (resourceTypeIn) {
                    case MODEL:
                        RegistryHandler.register(new ResourceLocation(resourceLocationIn.getResourceDomain(), resourceNameIn),
                                jsonReader.readModel());
                        break;
                    case ANIM:
                        RegistryHandler.register(new ResourceLocation(resourceLocationIn.getResourceDomain(), resourceNameIn), jsonReader.readAnim());
                        break;
                }
            else
                CraftStudioApi.getLogger().fatal("You're not allowed to use the \"craftstudioapi\" to register CraftStudio resources.");
        } catch (CSResourceNotFoundException | CSMalformedJsonException e) {
            e.printStackTrace();
        }
    }

    /**
     * Check if there is capital letter in a String, and send a warning message.
     * 
     * @param str
     *            The String to test.
     */
    private static void capitalCheck(String str) {
        if (!str.toLowerCase().equals(str)) {
            CraftStudioApi.getLogger().warn("The resource name \"" + str + "\" contains capitals letters, which is not supported.");
            CraftStudioApi.getLogger().warn("A CSResourceNotFoundException could be raised !");
        }
    }

    /**
     * An object containing informations about a pre-registered object to load
     * later.
     * 
     * @author Timmypote
     */
    private static class LoadElement
    {
        ResourceLocation resourceLoc;
        String           ressourceName;

        LoadElement(ResourceLocation resourceLoc, String ressourceName) {
            this.resourceLoc = resourceLoc;
            this.ressourceName = ressourceName;
        }
    }
} @SideOnly(Side.CLIENT)
public enum EnumRenderType {

    BLOCK("blocks/"), ENTITY("entity/");

    String folderName;

    private EnumRenderType(String folderNameIn) {
        this.folderName = folderNameIn;
    }

    /**
     * Get the folder associated with this render type.
     *
     * @return The folder as a string.
     */
    public String getFolderName() {
        return this.folderName;
    }
} @SideOnly(Side.CLIENT)
public enum EnumResourceType {

    MODEL("craftstudio/models/", ".csjsmodel"), ANIM("craftstudio/animations/", ".csjsmodelanim");

    String path, extension;

    private EnumResourceType(String pathIn, String extensionIn) {
        this.path = pathIn;
        this.extension = extensionIn;
    }

    public String getPath() {
        return this.path;
    }

    public String getExtension() {
        return this.extension;
    }
} public class CSTileEntitySpecialRenderer<T extends TileEntity> extends TileEntitySpecialRenderer<T>
{
    /** Efficient rotation corrector, you can use it in your renderer. */
    public static final FloatBuffer ROTATION_CORRECTOR;
    static {
        Matrix4f mat = new Matrix4f();
        mat.set(MathHelper.quatFromEuler(180, 0, 0));
        ROTATION_CORRECTOR = MathHelper.makeFloatBuffer(mat);
    }

    /** The model of the block. */
    protected ModelCraftStudio model;
    /** The texture of the block */
    protected ResourceLocation texture;

    /** The constructor that initialize the model and save texture. */
    public CSTileEntitySpecialRenderer(String modid, String modelNameIn, int textureWidth, int textureHeigth, ResourceLocation texture) {
        this.model = new ModelCraftStudio(modid, modelNameIn, textureWidth, textureHeigth);
        this.texture = texture;
    }

    @Override
    public void render(T te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
        GlStateManager.pushMatrix();
        // Correction of the position.
        GlStateManager.translate(x + 0.5D, y + 1.5D, z + 0.5D);
        // Correction of the rotation.
        GlStateManager.multMatrix(CSTileEntitySpecialRenderer.ROTATION_CORRECTOR);
        this.bindTexture(this.texture); // Binding the texture.
        this.model.render(te); // Rendering the model.
        GlStateManager.popMatrix();
    }
} public class RenderTest<T extends EntityTest> extends RenderLiving<T>
{
    public static final Factory FACTORY = new Factory();

    public RenderTest(RenderManager manager) {
        super(manager, new ModelCraftStudio(Mod_Test.MODID, "craftstudio_api_test", 64, 32), 0.5F);
    }

    @Override
    protected ResourceLocation getEntityTexture(T entity) {
        return new ResourceLocation(Mod_Test.MODID, "textures/entity/craftstudio_api_test.png");
    }

    public static class Factory<T extends EntityTest> implements IRenderFactory<T>
    {
        @Override
        public Render<? super T> createRenderFor(RenderManager manager) {
            return new RenderTest(manager);
        }
    }
} public class RenderTest2<T extends EntityTest2> extends RenderLiving<T>
{
    public static final Factory FACTORY = new Factory();

    public RenderTest2(RenderManager manager) {
        super(manager, new ModelCraftStudio(Mod_Test.MODID, "peacock", 128, 64), 0.5F);
    }

    @Override
    protected ResourceLocation getEntityTexture(T entity) {
        return new ResourceLocation(Mod_Test.MODID, "textures/entity/peacock.png");
    }

    public static class Factory<T extends EntityTest2> implements IRenderFactory<T>
    {
        @Override
        public Render<? super T> createRenderFor(RenderManager manager) {
            return new RenderTest2(manager);
        }
    }
} public class RenderTest3<T extends EntityTest3> extends RenderLiving<T>
{
    public static final Factory FACTORY = new Factory();

    public RenderTest3(RenderManager manager) {
        super(manager, new ModelCraftStudio(Mod_Test.MODID, "dragon_brun", 256), 0.5F);
    }

    @Override
    protected ResourceLocation getEntityTexture(T entity) {
        return new ResourceLocation(Mod_Test.MODID, "textures/entity/dragon_brun.png");
    }

    public static class Factory<T extends EntityTest3> implements IRenderFactory<T>
    {
        @Override
        public Render<? super T> createRenderFor(RenderManager manager) {
            return new RenderTest3(manager);
        }
    }
} public class RenderTest4<T extends EntityTest4> extends RenderLiving<T>
{

    public static final Factory FACTORY = new Factory();

    public RenderTest4(RenderManager manager) {
        super(manager, new ModelCraftStudio(Mod_Test.MODID, "craftstudio_api_test2", 64, 32), 0.5F);
    }

    @Override
    protected ResourceLocation getEntityTexture(T entity) {
        return new ResourceLocation(Mod_Test.MODID, "textures/entity/craftstudio_api_test.png");
    }

    public static class Factory<T extends EntityTest4> implements IRenderFactory<T>
    {
        @Override
        public Render<? super T> createRenderFor(RenderManager manager) {
            return new RenderTest4(manager);
        }

    }
} @Mod(name = "TestMod", modid = Mod_Test.MODID)
public class Mod_Test
{
    public static final String MODID = "testmod";

    @SidedProxy(clientSide = "com.leviathanstudio.test.proxy.ClientProxy", serverSide = "com.leviathanstudio.test.proxy.CommonProxy")
    private static CommonProxy proxy;

    @Instance(Mod_Test.MODID)
    private static Mod_Test    instance;

    public static Mod_Test getInstance() {
        return instance;
    }

    public static CommonProxy getProxy() {
        return proxy;
    }
} public class EntityTest extends AnimatedEntity
{
    protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest.class);

    static {
        EntityTest.animHandler.addAnim(Mod_Test.MODID, "position", "craftstudio_api_test", true);
        EntityTest.animHandler.addAnim(Mod_Test.MODID, "offset", "craftstudio_api_test", true);
        EntityTest.animHandler.addAnim(Mod_Test.MODID, "streching", "craftstudio_api_test", true);
    }

    public EntityTest(World par1World) {
        super(par1World);
    }

    @Override
    public AnimationHandler getAnimationHandler() {
        return EntityTest.animHandler;
    }

    @Override
    public void onLivingUpdate() {
        super.onLivingUpdate();

        if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "streching", this))
            this.getAnimationHandler().startAnimation(Mod_Test.MODID, "streching", this);
    }
} public class EntityTest2 extends EntityAnimal implements IAnimated
{
    protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest2.class);
    protected boolean                 fanOpen     = true;

    static {
        EntityTest2.animHandler.addAnim(Mod_Test.MODID, "close_fan", "peacock", false);
        EntityTest2.animHandler.addAnim(Mod_Test.MODID, "open_fan", "close_fan");
        EntityTest2.animHandler.addAnim(Mod_Test.MODID, "lookat", new AnimationLootAt("Head"));
    }

    public EntityTest2(World par1World) {
        super(par1World);
        this.setSize(1.0F, 1.5F);
        this.tasks.addTask(1, new EntityAILookIdle(this));
        this.tasks.addTask(2, new EntityAIWatchClosest(this, EntityPlayer.class, 10));
        this.initEntityAI();
    }

    @Override
    protected void applyEntityAttributes() {
        super.applyEntityAttributes();
        this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(4.0D);
        this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.25D);
    }

    @Override
    public AnimationHandler getAnimationHandler() {
        return EntityTest2.animHandler;
    }

    @Override
    public boolean processInteract(EntityPlayer player, EnumHand hand) {
        if (!this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "close_fan", this)
                && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "open_fan", this))
            if (this.fanOpen) {
                this.getAnimationHandler().networkStopStartAnimation(Mod_Test.MODID, "open_fan", "close_fan", this);
                this.fanOpen = false;
            }
            else {
                this.getAnimationHandler().networkStopStartAnimation(Mod_Test.MODID, "close_fan", "open_fan", this);
                this.fanOpen = true;
            }
        return true;
    }

    @Override
    public void onLivingUpdate() {
        super.onLivingUpdate();
        this.getAnimationHandler().animationsUpdate(this);

        if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "lookat", this))
            this.getAnimationHandler().startAnimation(Mod_Test.MODID, "lookat", this);
    }

    @Override
    public EntityAgeable createChild(EntityAgeable ageable) {
        return null;
    }

    @Override
    public int getDimension() {
        return this.dimension;
    }

    @Override
    public double getX() {
        return this.posX;
    }

    @Override
    public double getY() {
        return this.posY;
    }

    @Override
    public double getZ() {
        return this.posZ;
    }

    @Override
    public boolean isWorldRemote() {
        return this.world.isRemote;
    }
} public class EntityTest3 extends AnimatedEntity
{
    protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest3.class);
    boolean                           fly         = false;

    static {
        EntityTest3.animHandler.addAnim(Mod_Test.MODID, "fly", "dragon_brun", true);
        EntityTest3.animHandler.addAnim(Mod_Test.MODID, "idle", "dragon_brun", true);
    }

    public EntityTest3(World par1World) {
        super(par1World);
    }

    @Override
    public AnimationHandler getAnimationHandler() {
        return EntityTest3.animHandler;
    }

    @Override
    public boolean processInteract(EntityPlayer player, EnumHand hand) {
        if (!this.fly)
            this.fly = true;
        return true;
    }

    @Override
    public void onLivingUpdate() {
        super.onLivingUpdate();

        if (!this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "fly", this) && this.fly)
            this.getAnimationHandler().networkStartAnimation(Mod_Test.MODID, "fly", this);

    }
} public class EntityTest4 extends AnimatedEntity
{
    protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(EntityTest4.class);

    static {
        EntityTest4.animHandler.addAnim(Mod_Test.MODID, "rotation", "craftstudio_api_test2", true);
    }

    public EntityTest4(World par1World) {
        super(par1World);
    }

    @Override
    public AnimationHandler getAnimationHandler() {
        return EntityTest4.animHandler;
    }

    @Override
    public void onLivingUpdate() {
        super.onLivingUpdate();

        if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "rotation", this))
            this.getAnimationHandler().startAnimation(Mod_Test.MODID, "rotation", this);
    }
} public class TileEntityTest extends AnimatedTileEntity
{
    protected static AnimationHandler animHandler = CraftStudioApi.getNewAnimationHandler(TileEntityTest.class);

    static {
        TileEntityTest.animHandler.addAnim(Mod_Test.MODID, "position", "craftstudio_api_test", true);
    }

    public TileEntityTest() {
        super();
    }

    public TileEntityTest(World worldIn) {
        this();
        this.world = worldIn;
    }

    @Override
    public AnimationHandler getAnimationHandler() {
        return TileEntityTest.animHandler;
    }

    @Override
    public void update() {
        super.update();

        if (this.isWorldRemote() && !this.getAnimationHandler().isAnimationActive(Mod_Test.MODID, "position", this))
            this.getAnimationHandler().startAnimation(Mod_Test.MODID, "position", this);

    }
}
import com.leviathanstudio.craftstudio.client.registry.CSRegistryHelper;
import com.leviathanstudio.craftstudio.client.registry.CraftStudioLoader;
import com.leviathanstudio.craftstudio.client.util.EnumRenderType;
import com.leviathanstudio.craftstudio.client.util.EnumResourceType;
import com.leviathanstudio.craftstudio.common.animation.simpleImpl.CSTileEntitySpecialRenderer;
import com.leviathanstudio.test.client.entityRender.RenderTest;
import com.leviathanstudio.test.client.entityRender.RenderTest2;
import com.leviathanstudio.test.client.entityRender.RenderTest3;
import com.leviathanstudio.test.client.entityRender.RenderTest4;
import com.leviathanstudio.test.common.Mod_Test;
import com.leviathanstudio.test.common.entity.EntityTest;
import com.leviathanstudio.test.common.entity.EntityTest2;
import com.leviathanstudio.test.common.entity.EntityTest3;
import com.leviathanstudio.test.common.entity.EntityTest4;
import com.leviathanstudio.test.common.tileEntity.TileEntityTest;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
package com.leviathanstudio.test.proxy;



public class ClientProxy extends CommonProxy
{
    @CraftStudioLoader
    public static void registerCraftStudioAssets() {
        CSRegistryHelper registry = new CSRegistryHelper(Mod_Test.MODID);