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