/** The actual render method that is used in doRender */
  public void doRenderFallingSand(
      EntityFallingSand par1EntityFallingSand,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) par2, (float) par4, (float) par6);
    this.loadTexture("/terrain.png");
    Block var10 = Block.blocksList[par1EntityFallingSand.blockID];
    World var11 = par1EntityFallingSand.getWorld();
    GL11.glDisable(GL11.GL_LIGHTING);

    if (var10 instanceof BlockAnvil && var10.getRenderType() == 35) {
      this.renderBlocks.blockAccess = var11;
      Tessellator var12 = Tessellator.instance;
      var12.startDrawingQuads();
      var12.setTranslation(
          (double) ((float) (-MathHelper.floor_double(par1EntityFallingSand.posX)) - 0.5F),
          (double) ((float) (-MathHelper.floor_double(par1EntityFallingSand.posY)) - 0.5F),
          (double) ((float) (-MathHelper.floor_double(par1EntityFallingSand.posZ)) - 0.5F));
      this.renderBlocks.renderBlockAnvilMetadata(
          (BlockAnvil) var10,
          MathHelper.floor_double(par1EntityFallingSand.posX),
          MathHelper.floor_double(par1EntityFallingSand.posY),
          MathHelper.floor_double(par1EntityFallingSand.posZ),
          par1EntityFallingSand.metadata);
      var12.setTranslation(0.0D, 0.0D, 0.0D);
      var12.draw();
    } else if (var10 != null) {
      this.renderBlocks.updateCustomBlockBounds(var10);
      this.renderBlocks.renderBlockSandFalling(
          var10,
          var11,
          MathHelper.floor_double(par1EntityFallingSand.posX),
          MathHelper.floor_double(par1EntityFallingSand.posY),
          MathHelper.floor_double(par1EntityFallingSand.posZ),
          par1EntityFallingSand.metadata);
    }

    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
  }
  /** Draws the main menu panorama */
  private void drawPanorama(int par1, int par2, float par3) {
    Tessellator var4 = Tessellator.instance;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    byte var5 = 8;

    for (int var6 = 0; var6 < var5 * var5; ++var6) {
      GL11.glPushMatrix();
      float var7 = ((float) (var6 % var5) / (float) var5 - 0.5F) / 64.0F;
      float var8 = ((float) (var6 / var5) / (float) var5 - 0.5F) / 64.0F;
      float var9 = 0.0F;
      GL11.glTranslatef(var7, var8, var9);
      GL11.glRotatef(
          MathHelper.sin(((float) this.panoramaTimer + par3) / 400.0F) * 25.0F + 20.0F,
          1.0F,
          0.0F,
          0.0F);
      GL11.glRotatef(-((float) this.panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F);

      for (int var10 = 0; var10 < 6; ++var10) {
        GL11.glPushMatrix();

        if (var10 == 1) {
          GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        }

        if (var10 == 2) {
          GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
        }

        if (var10 == 3) {
          GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
        }

        if (var10 == 4) {
          GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
        }

        if (var10 == 5) {
          GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
        }

        this.mc.renderEngine.func_98187_b(titlePanoramaPaths[var10]);
        var4.startDrawingQuads();
        var4.setColorRGBA_I(16777215, 255 / (var6 + 1));
        float var11 = 0.0F;
        var4.addVertexWithUV(-1.0D, -1.0D, 1.0D, (double) (0.0F + var11), (double) (0.0F + var11));
        var4.addVertexWithUV(1.0D, -1.0D, 1.0D, (double) (1.0F - var11), (double) (0.0F + var11));
        var4.addVertexWithUV(1.0D, 1.0D, 1.0D, (double) (1.0F - var11), (double) (1.0F - var11));
        var4.addVertexWithUV(-1.0D, 1.0D, 1.0D, (double) (0.0F + var11), (double) (1.0F - var11));
        var4.draw();
        GL11.glPopMatrix();
      }

      GL11.glPopMatrix();
      GL11.glColorMask(true, true, true, false);
    }

    var4.setTranslation(0.0D, 0.0D, 0.0D);
    GL11.glColorMask(true, true, true, true);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
  }
  /** Draws the main menu panorama */
  private void drawPanorama(int par1, int par2, float par3) {
    Tessellator tessellator = Tessellator.instance;
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    Project.gluPerspective(120F, 1.0F, 0.05F, 10F);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(false);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    int i = 8;

    for (int j = 0; j < i * i; j++) {
      GL11.glPushMatrix();
      float f = ((float) (j % i) / (float) i - 0.5F) / 64F;
      float f1 = ((float) (j / i) / (float) i - 0.5F) / 64F;
      float f2 = 0.0F;
      GL11.glTranslatef(f, f1, f2);
      GL11.glRotatef(
          MathHelper.sin(((float) panoramaTimer + par3) / 400F) * 25F + 20F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(-((float) panoramaTimer + par3) * 0.1F, 0.0F, 1.0F, 0.0F);

      for (int k = 0; k < 6; k++) {
        GL11.glPushMatrix();

        if (k == 1) {
          GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
        }

        if (k == 2) {
          GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
        }

        if (k == 3) {
          GL11.glRotatef(-90F, 0.0F, 1.0F, 0.0F);
        }

        if (k == 4) {
          GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
        }

        if (k == 5) {
          GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
        }

        mc.func_110434_K().func_110577_a(titlePanoramaPaths[k]);
        tessellator.startDrawingQuads();
        tessellator.setColorRGBA_I(0xffffff, 255 / (j + 1));
        float f3 = 0.0F;
        tessellator.addVertexWithUV(-1D, -1D, 1.0D, 0.0F + f3, 0.0F + f3);
        tessellator.addVertexWithUV(1.0D, -1D, 1.0D, 1.0F - f3, 0.0F + f3);
        tessellator.addVertexWithUV(1.0D, 1.0D, 1.0D, 1.0F - f3, 1.0F - f3);
        tessellator.addVertexWithUV(-1D, 1.0D, 1.0D, 0.0F + f3, 1.0F - f3);
        tessellator.draw();
        GL11.glPopMatrix();
      }

      GL11.glPopMatrix();
      GL11.glColorMask(true, true, true, false);
    }

    tessellator.setTranslation(0.0D, 0.0D, 0.0D);
    GL11.glColorMask(true, true, true, true);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
  }
  public boolean updateRenderer(long var1) {
    if (this.worldObj == null) {
      return true;
    } else {
      this.needsUpdate = false;

      if (!this.isUpdating) {
        if (this.needsBoxUpdate) {
          float var3 = 0.0F;
          GL11.glNewList(this.glRenderList + 2, GL11.GL_COMPILE);
          RenderItem.renderAABB(
              AxisAlignedBB.getAABBPool()
                  .getAABB(
                      (double) ((float) this.posXClip - var3),
                      (double) ((float) this.posYClip - var3),
                      (double) ((float) this.posZClip - var3),
                      (double) ((float) (this.posXClip + 16) + var3),
                      (double) ((float) (this.posYClip + 16) + var3),
                      (double) ((float) (this.posZClip + 16) + var3)));
          GL11.glEndList();
          this.needsBoxUpdate = false;
        }

        if (Reflector.LightCache.exists()) {
          Object var25 = Reflector.getFieldValue(Reflector.LightCache_cache);
          Reflector.callVoid(var25, Reflector.LightCache_clear, new Object[0]);
          Reflector.callVoid(Reflector.BlockCoord_resetPool, new Object[0]);
        }

        Chunk.isLit = false;
      }

      int var26 = this.posX;
      int var4 = this.posY;
      int var5 = this.posZ;
      int var6 = this.posX + 16;
      int var7 = this.posY + 16;
      int var8 = this.posZ + 16;
      ChunkCache var9 = null;
      RenderBlocks var10 = null;
      HashSet var11 = null;

      if (!this.isUpdating) {
        for (int var12 = 0; var12 < 2; ++var12) {
          this.tempSkipRenderPass[var12] = true;
        }

        byte var27 = 1;
        var9 =
            new ChunkCache(
                this.worldObj,
                var26 - var27,
                var4 - var27,
                var5 - var27,
                var6 + var27,
                var7 + var27,
                var8 + var27,
                var27);
        var10 = new RenderBlocks(var9);
        var11 = new HashSet();
        var11.addAll(this.tileEntityRenderers);
        this.tileEntityRenderers.clear();
      }

      if (this.isUpdating || !var9.extendedLevelsInChunkCache()) {
        this.bytesDrawn = 0;
        Tessellator var28 = Tessellator.instance;
        boolean var13 = Reflector.ForgeHooksClient.exists();

        for (int var14 = 0; var14 < 2; ++var14) {
          boolean var15 = false;
          boolean var16 = false;
          boolean var17 = false;

          for (int var18 = var4; var18 < var7; ++var18) {
            if (this.isUpdating) {
              this.isUpdating = false;
              var9 = this.updateState.chunkcache;
              var10 = this.updateState.renderblocks;
              var11 = this.updateState.setOldEntityRenders;
              var14 = this.updateState.renderPass;
              var18 = this.updateState.y;
              var15 = this.updateState.flag;
              var16 = this.updateState.hasRenderedBlocks;
              var17 = this.updateState.hasGlList;

              if (var17) {
                GL11.glNewList(
                    this.glWorkLists[this.activeSet][var14][this.activeListIndex[var14]],
                    GL11.GL_COMPILE);
                var28.setRenderingChunk(true);
                var28.startDrawingQuads();
                var28.setTranslation(
                    (double) (-globalChunkOffsetX), 0.0D, (double) (-globalChunkOffsetZ));
              }
            } else if (var17
                && var1 != 0L
                && System.nanoTime() - var1 > 0L
                && this.activeListIndex[var14] < 15) {
              var28.draw();
              GL11.glEndList();
              var28.setRenderingChunk(false);
              var28.setTranslation(0.0D, 0.0D, 0.0D);
              ++this.activeListIndex[var14];
              this.updateState.chunkcache = var9;
              this.updateState.renderblocks = var10;
              this.updateState.setOldEntityRenders = var11;
              this.updateState.renderPass = var14;
              this.updateState.y = var18;
              this.updateState.flag = var15;
              this.updateState.hasRenderedBlocks = var16;
              this.updateState.hasGlList = var17;
              this.isUpdating = true;
              return false;
            }

            for (int var19 = var5; var19 < var8; ++var19) {
              for (int var20 = var26; var20 < var6; ++var20) {
                int var21 = var9.getBlockId(var20, var18, var19);

                if (var21 > 0) {
                  if (!var17) {
                    var17 = true;
                    GL11.glNewList(
                        this.glWorkLists[this.activeSet][var14][this.activeListIndex[var14]],
                        GL11.GL_COMPILE);
                    var28.setRenderingChunk(true);
                    var28.startDrawingQuads();
                    var28.setTranslation(
                        (double) (-globalChunkOffsetX), 0.0D, (double) (-globalChunkOffsetZ));
                  }

                  Block var22 = Block.blocksList[var21];

                  if (var14 == 0 && var22.hasTileEntity()) {
                    TileEntity var23 = var9.getBlockTileEntity(var20, var18, var19);

                    if (TileEntityRenderer.instance.hasSpecialRenderer(var23)) {
                      this.tileEntityRenderers.add(var23);
                    }
                  }

                  int var30 = var22.getRenderBlockPass();
                  boolean var24 = true;

                  if (var30 != var14) {
                    var15 = true;
                    var24 = false;
                  }

                  if (var13) {
                    var24 =
                        Reflector.callBoolean(
                            var22,
                            Reflector.ForgeBlock_canRenderInPass,
                            new Object[] {Integer.valueOf(var14)});
                  }

                  if (var24) {
                    var16 |= var10.renderBlockByRenderType(var22, var20, var18, var19);
                  }
                }
              }
            }
          }

          if (var17) {
            this.bytesDrawn += var28.draw();
            GL11.glEndList();
            var28.setRenderingChunk(false);
            var28.setTranslation(0.0D, 0.0D, 0.0D);
          } else {
            var16 = false;
          }

          if (var16) {
            this.tempSkipRenderPass[var14] = false;
          }

          if (!var15) {
            break;
          }
        }
      }

      HashSet var29 = new HashSet();
      var29.addAll(this.tileEntityRenderers);
      var29.removeAll(var11);
      this.tileEntities.addAll(var29);
      var11.removeAll(this.tileEntityRenderers);
      this.tileEntities.removeAll(var11);
      this.isChunkLit = Chunk.isLit;
      this.isInitialized = true;
      ++chunksUpdated;
      this.isVisible = true;
      this.isVisibleFromPosition = false;
      this.skipRenderPass[0] = this.tempSkipRenderPass[0];
      this.skipRenderPass[1] = this.tempSkipRenderPass[1];
      this.isUpdating = false;
      return true;
    }
  }
  public void renderPiston(
      TileEntityPiston par1TileEntityPiston, double par2, double par4, double par6, float par8) {
    Block block = Block.blocksList[par1TileEntityPiston.getStoredBlockID()];

    if (block != null && par1TileEntityPiston.getProgress(par8) < 1.0F) {
      Tessellator tessellator = Tessellator.instance;
      bindTextureByName("/terrain.png");
      RenderHelper.disableStandardItemLighting();
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glDisable(GL11.GL_CULL_FACE);

      if (Minecraft.isAmbientOcclusionEnabled()) {
        GL11.glShadeModel(GL11.GL_SMOOTH);
      } else {
        GL11.glShadeModel(GL11.GL_FLAT);
      }

      tessellator.startDrawingQuads();
      tessellator.setTranslation(
          ((float) par2 - par1TileEntityPiston.xCoord) + par1TileEntityPiston.getOffsetX(par8),
          ((float) par4 - par1TileEntityPiston.yCoord) + par1TileEntityPiston.getOffsetY(par8),
          ((float) par6 - par1TileEntityPiston.zCoord) + par1TileEntityPiston.getOffsetZ(par8));
      tessellator.setColorOpaque(1, 1, 1);

      if (block == Block.pistonExtension && par1TileEntityPiston.getProgress(par8) < 0.5F) {
        this.blockRenderer.renderPistonExtensionAllFaces(
            block,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord,
            false);
      } else if (par1TileEntityPiston.shouldRenderHead() && !par1TileEntityPiston.isExtending()) {
        Block.pistonExtension.setHeadTexture(((BlockPistonBase) block).getPistonExtensionTexture());
        this.blockRenderer.renderPistonExtensionAllFaces(
            Block.pistonExtension,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord,
            par1TileEntityPiston.getProgress(par8) < 0.5F);
        Block.pistonExtension.clearHeadTexture();
        tessellator.setTranslation(
            (float) par2 - par1TileEntityPiston.xCoord,
            (float) par4 - par1TileEntityPiston.yCoord,
            (float) par6 - par1TileEntityPiston.zCoord);
        this.blockRenderer.renderPistonBaseAllFaces(
            block,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord);
      } else {
        this.blockRenderer.renderBlockAllFaces(
            block,
            par1TileEntityPiston.xCoord,
            par1TileEntityPiston.yCoord,
            par1TileEntityPiston.zCoord);
      }

      tessellator.setTranslation(0.0D, 0.0D, 0.0D);
      tessellator.draw();
      RenderHelper.enableStandardItemLighting();
    }
  }