package client.renderer.tileentity;

import client.renderer.texture.TextureManager;
import common.tileentity.TileEntity;
import common.world.World;

public abstract class TileEntitySpecialRenderer<T extends TileEntity>
{
    protected static final String[] DESTROY_STAGES = new String[] {
    		"textures/blocks/destroy_stage_0.png",
    		"textures/blocks/destroy_stage_1.png",
    		"textures/blocks/destroy_stage_2.png",
    		"textures/blocks/destroy_stage_3.png",
    		"textures/blocks/destroy_stage_4.png",
    		"textures/blocks/destroy_stage_5.png",
    		"textures/blocks/destroy_stage_6.png",
    		"textures/blocks/destroy_stage_7.png",
    		"textures/blocks/destroy_stage_8.png",
    		"textures/blocks/destroy_stage_9.png"
    };
    
    protected TileEntityRendererDispatcher rendererDispatcher;

    public abstract void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage);

    protected void bindTexture(String location)
    {
        TextureManager texturemanager = this.rendererDispatcher.renderEngine;

        if (texturemanager != null)
        {
            texturemanager.bindTexture(location);
        }
    }

    protected World getWorld()
    {
        return this.rendererDispatcher.worldObj;
    }

    public void setRendererDispatcher(TileEntityRendererDispatcher rendererDispatcherIn)
    {
        this.rendererDispatcher = rendererDispatcherIn;
    }

//    public FontRenderer getFontRenderer()
//    {
//        return this.rendererDispatcher.getFontRenderer();
//    }

    /**
     * If true the {@link TileEntitySpecialRenderer} will always be rendered while the player is in the render bounding
     * box {@link TileEntity#getRenderBoundingBox()} and his squared distance with the {@link TileEntity} is smaller
     * than {@link TileEntity#getMaxRenderDistanceSquared()}.
     */
    public boolean forceTileEntityRender()
    {
        return false;
    }
}
