    001    package net.minecraft.src;
    002
    003    import cpw.mods.fml.common.Side;
    004    import cpw.mods.fml.common.asm.SideOnly;
    005    import java.nio.FloatBuffer;
    006    import java.util.Random;
    007    import net.minecraft.client.Minecraft;
    008    import org.lwjgl.opengl.GL11;
    009
    010    @SideOnly(Side.CLIENT)
    011    public class RenderEndPortal extends TileEntitySpecialRenderer
    012    {
    013        FloatBuffer field_76908_a = GLAllocation.createDirectFloatBuffer(16);
    014
    015        /**
    016         * Renders the End Portal.
    017         */
    018        public void renderEndPortalTileEntity(TileEntityEndPortal par1TileEntityEndPortal, double par2, double par4, double par6, float par8)
    019        {
    020            float var9 = (float)this.tileEntityRenderer.playerX;
    021            float var10 = (float)this.tileEntityRenderer.playerY;
    022            float var11 = (float)this.tileEntityRenderer.playerZ;
    023            GL11.glDisable(GL11.GL_LIGHTING);
    024            Random var12 = new Random(31100L);
    025            float var13 = 0.75F;
    026
    027            for (int var14 = 0; var14 < 16; ++var14)
    028            {
    029                GL11.glPushMatrix();
    030                float var15 = (float)(16 - var14);
    031                float var16 = 0.0625F;
    032                float var17 = 1.0F / (var15 + 1.0F);
    033
    034                if (var14 == 0)
    035                {
    036                    this.bindTextureByName("/misc/tunnel.png");
    037                    var17 = 0.1F;
    038                    var15 = 65.0F;
    039                    var16 = 0.125F;
    040                    GL11.glEnable(GL11.GL_BLEND);
    041                    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    042                }
    043
    044                if (var14 == 1)
    045                {
    046                    this.bindTextureByName("/misc/particlefield.png");
    047                    GL11.glEnable(GL11.GL_BLEND);
    048                    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
    049                    var16 = 0.5F;
    050                }
    051
    052                float var18 = (float)(-(par4 + (double)var13));
    053                float var19 = var18 + ActiveRenderInfo.objectY;
    054                float var20 = var18 + var15 + ActiveRenderInfo.objectY;
    055                float var21 = var19 / var20;
    056                var21 += (float)(par4 + (double)var13);
    057                GL11.glTranslatef(var9, var21, var11);
    058                GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
    059                GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
    060                GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
    061                GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
    062                GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.func_76907_a(1.0F, 0.0F, 0.0F, 0.0F));
    063                GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 1.0F, 0.0F));
    064                GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 0.0F, 1.0F));
    065                GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.func_76907_a(0.0F, 1.0F, 0.0F, 0.0F));
    066                GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
    067                GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
    068                GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
    069                GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
    070                GL11.glPopMatrix();
    071                GL11.glMatrixMode(GL11.GL_TEXTURE);
    072                GL11.glPushMatrix();
    073                GL11.glLoadIdentity();
    074                GL11.glTranslatef(0.0F, (float)(Minecraft.getSystemTime() % 700000L) / 700000.0F, 0.0F);
    075                GL11.glScalef(var16, var16, var16);
    076                GL11.glTranslatef(0.5F, 0.5F, 0.0F);
    077                GL11.glRotatef((float)(var14 * var14 * 4321 + var14 * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
    078                GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
    079                GL11.glTranslatef(-var9, -var11, -var10);
    080                var19 = var18 + ActiveRenderInfo.objectY;
    081                GL11.glTranslatef(ActiveRenderInfo.objectX * var15 / var19, ActiveRenderInfo.objectZ * var15 / var19, -var10);
    082                Tessellator var24 = Tessellator.instance;
    083                var24.startDrawingQuads();
    084                var21 = var12.nextFloat() * 0.5F + 0.1F;
    085                float var22 = var12.nextFloat() * 0.5F + 0.4F;
    086                float var23 = var12.nextFloat() * 0.5F + 0.5F;
    087
    088                if (var14 == 0)
    089                {
    090                    var23 = 1.0F;
    091                    var22 = 1.0F;
    092                    var21 = 1.0F;
    093                }
    094
    095                var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F);
    096                var24.addVertex(par2, par4 + (double)var13, par6);
    097                var24.addVertex(par2, par4 + (double)var13, par6 + 1.0D);
    098                var24.addVertex(par2 + 1.0D, par4 + (double)var13, par6 + 1.0D);
    099                var24.addVertex(par2 + 1.0D, par4 + (double)var13, par6);
    100                var24.draw();
    101                GL11.glPopMatrix();
    102                GL11.glMatrixMode(GL11.GL_MODELVIEW);
    103            }
    104
    105            GL11.glDisable(GL11.GL_BLEND);
    106            GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    107            GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
    108            GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
    109            GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
    110            GL11.glEnable(GL11.GL_LIGHTING);
    111        }
    112
    113        private FloatBuffer func_76907_a(float par1, float par2, float par3, float par4)
    114        {
    115            this.field_76908_a.clear();
    116            this.field_76908_a.put(par1).put(par2).put(par3).put(par4);
    117            this.field_76908_a.flip();
    118            return this.field_76908_a;
    119        }
    120
    121        public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
    122        {
    123            this.renderEndPortalTileEntity((TileEntityEndPortal)par1TileEntity, par2, par4, par6, par8);
    124        }
    125    }