package com.zivilon.cinder_loe.client.render.block;

import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import com.zivilon.cinder_loe.tileentity.TileEntityMistBlock;
import lotr.client.render.tileentity.LOTRRenderUtumnoPortal;

public class RenderMistBlock extends TileEntitySpecialRenderer {
    public void renderTileEntityAt(TileEntity tileentity, double d, double d1, double d2, float f) {
        TileEntityMistBlock mist = (TileEntityMistBlock)tileentity;
        GL11.glPushMatrix();
        GL11.glDisable(2884);
        GL11.glDisable(3553);
        GL11.glDisable(2896);
        GL11.glEnable(3042);
        GL11.glBlendFunc(770, 771);
        GL11.glDepthMask(false);
        int passes = 60;
        for (int i = 0; i < passes; i++) {
            GL11.glPushMatrix();
            GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.0F + i * 0.5F, (float)d2 + 0.5F);
            Tessellator tessellator = Tessellator.instance;
            tessellator.startDrawingQuads();
            tessellator.setColorRGBA_F(mist.color_red, mist.color_green, mist.color_blue, (passes - i) / passes);
            double width = 0.5D;
            tessellator.addVertexWithUV(width, 0.0D, width, 0.0D, 0.0D);
            tessellator.addVertexWithUV(width, 0.0D, -width, 0.0D, 0.0D);
            tessellator.addVertexWithUV(-width, 0.0D, -width, 0.0D, 0.0D);
            tessellator.addVertexWithUV(-width, 0.0D, width, 0.0D, 0.0D);
            tessellator.draw();
            GL11.glPopMatrix();
        }
        GL11.glDepthMask(true);
        GL11.glEnable(3553);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDisable(3042);
        GL11.glEnable(2896);
        GL11.glEnable(2884);
        GL11.glPopMatrix();
    }
}
