    001    package net.minecraft.client.renderer.tileentity;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import net.minecraft.client.renderer.Tessellator;
    006    import net.minecraft.tileentity.TileEntity;
    007    import net.minecraft.tileentity.TileEntityBeacon;
    008    import net.minecraft.util.MathHelper;
    009    import org.lwjgl.opengl.GL11;
    010
    011    @SideOnly(Side.CLIENT)
    012    public class TileEntityBeaconRenderer extends TileEntitySpecialRenderer
    013    {
    014        /**
    015         * Render a beacon tile entity.
    016         */
    017        public void renderTileEntityBeaconAt(TileEntityBeacon par1TileEntityBeacon, double par2, double par4, double par6, float par8)
    018        {
    019            float var9 = par1TileEntityBeacon.func_82125_v_();
    020
    021            if (var9 > 0.0F)
    022            {
    023                Tessellator var10 = Tessellator.instance;
    024                this.bindTextureByName("/misc/beam.png");
    025                GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
    026                GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
    027                GL11.glDisable(GL11.GL_LIGHTING);
    028                GL11.glDisable(GL11.GL_CULL_FACE);
    029                GL11.glDisable(GL11.GL_BLEND);
    030                GL11.glDepthMask(true);
    031                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    032                float var11 = (float)par1TileEntityBeacon.getWorldObj().getTotalWorldTime() + par8;
    033                float var12 = -var11 * 0.2F - (float)MathHelper.floor_float(-var11 * 0.1F);
    034                byte var13 = 1;
    035                double var14 = (double)var11 * 0.025D * (1.0D - (double)(var13 & 1) * 2.5D);
    036                var10.startDrawingQuads();
    037                var10.setColorRGBA(255, 255, 255, 32);
    038                double var16 = (double)var13 * 0.2D;
    039                double var18 = 0.5D + Math.cos(var14 + 2.356194490192345D) * var16;
    040                double var20 = 0.5D + Math.sin(var14 + 2.356194490192345D) * var16;
    041                double var22 = 0.5D + Math.cos(var14 + (Math.PI / 4D)) * var16;
    042                double var24 = 0.5D + Math.sin(var14 + (Math.PI / 4D)) * var16;
    043                double var26 = 0.5D + Math.cos(var14 + 3.9269908169872414D) * var16;
    044                double var28 = 0.5D + Math.sin(var14 + 3.9269908169872414D) * var16;
    045                double var30 = 0.5D + Math.cos(var14 + 5.497787143782138D) * var16;
    046                double var32 = 0.5D + Math.sin(var14 + 5.497787143782138D) * var16;
    047                double var34 = (double)(256.0F * var9);
    048                double var36 = 0.0D;
    049                double var38 = 1.0D;
    050                double var40 = (double)(-1.0F + var12);
    051                double var42 = (double)(256.0F * var9) * (0.5D / var16) + var40;
    052                var10.addVertexWithUV(par2 + var18, par4 + var34, par6 + var20, var38, var42);
    053                var10.addVertexWithUV(par2 + var18, par4, par6 + var20, var38, var40);
    054                var10.addVertexWithUV(par2 + var22, par4, par6 + var24, var36, var40);
    055                var10.addVertexWithUV(par2 + var22, par4 + var34, par6 + var24, var36, var42);
    056                var10.addVertexWithUV(par2 + var30, par4 + var34, par6 + var32, var38, var42);
    057                var10.addVertexWithUV(par2 + var30, par4, par6 + var32, var38, var40);
    058                var10.addVertexWithUV(par2 + var26, par4, par6 + var28, var36, var40);
    059                var10.addVertexWithUV(par2 + var26, par4 + var34, par6 + var28, var36, var42);
    060                var10.addVertexWithUV(par2 + var22, par4 + var34, par6 + var24, var38, var42);
    061                var10.addVertexWithUV(par2 + var22, par4, par6 + var24, var38, var40);
    062                var10.addVertexWithUV(par2 + var30, par4, par6 + var32, var36, var40);
    063                var10.addVertexWithUV(par2 + var30, par4 + var34, par6 + var32, var36, var42);
    064                var10.addVertexWithUV(par2 + var26, par4 + var34, par6 + var28, var38, var42);
    065                var10.addVertexWithUV(par2 + var26, par4, par6 + var28, var38, var40);
    066                var10.addVertexWithUV(par2 + var18, par4, par6 + var20, var36, var40);
    067                var10.addVertexWithUV(par2 + var18, par4 + var34, par6 + var20, var36, var42);
    068                var10.draw();
    069                GL11.glEnable(GL11.GL_BLEND);
    070                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    071                GL11.glDepthMask(false);
    072                var10.startDrawingQuads();
    073                var10.setColorRGBA(255, 255, 255, 32);
    074                double var44 = 0.2D;
    075                double var15 = 0.2D;
    076                double var17 = 0.8D;
    077                double var19 = 0.2D;
    078                double var21 = 0.2D;
    079                double var23 = 0.8D;
    080                double var25 = 0.8D;
    081                double var27 = 0.8D;
    082                double var29 = (double)(256.0F * var9);
    083                double var31 = 0.0D;
    084                double var33 = 1.0D;
    085                double var35 = (double)(-1.0F + var12);
    086                double var37 = (double)(256.0F * var9) + var35;
    087                var10.addVertexWithUV(par2 + var44, par4 + var29, par6 + var15, var33, var37);
    088                var10.addVertexWithUV(par2 + var44, par4, par6 + var15, var33, var35);
    089                var10.addVertexWithUV(par2 + var17, par4, par6 + var19, var31, var35);
    090                var10.addVertexWithUV(par2 + var17, par4 + var29, par6 + var19, var31, var37);
    091                var10.addVertexWithUV(par2 + var25, par4 + var29, par6 + var27, var33, var37);
    092                var10.addVertexWithUV(par2 + var25, par4, par6 + var27, var33, var35);
    093                var10.addVertexWithUV(par2 + var21, par4, par6 + var23, var31, var35);
    094                var10.addVertexWithUV(par2 + var21, par4 + var29, par6 + var23, var31, var37);
    095                var10.addVertexWithUV(par2 + var17, par4 + var29, par6 + var19, var33, var37);
    096                var10.addVertexWithUV(par2 + var17, par4, par6 + var19, var33, var35);
    097                var10.addVertexWithUV(par2 + var25, par4, par6 + var27, var31, var35);
    098                var10.addVertexWithUV(par2 + var25, par4 + var29, par6 + var27, var31, var37);
    099                var10.addVertexWithUV(par2 + var21, par4 + var29, par6 + var23, var33, var37);
    100                var10.addVertexWithUV(par2 + var21, par4, par6 + var23, var33, var35);
    101                var10.addVertexWithUV(par2 + var44, par4, par6 + var15, var31, var35);
    102                var10.addVertexWithUV(par2 + var44, par4 + var29, par6 + var15, var31, var37);
    103                var10.draw();
    104                GL11.glEnable(GL11.GL_LIGHTING);
    105                GL11.glEnable(GL11.GL_TEXTURE_2D);
    106                GL11.glDepthMask(true);
    107            }
    108        }
    109
    110        public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
    111        {
    112            this.renderTileEntityBeaconAt((TileEntityBeacon)par1TileEntity, par2, par4, par6, par8);
    113        }
    114    }