public static void drawGradientRect(
     int x, int y, float z, int toX, int toY, Color color, Color colorFade) {
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
   GL11.glShadeModel(GL11.GL_SMOOTH);
   Tessellator tes = Tessellator.getInstance();
   VertexBuffer vb = tes.getBuffer();
   vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
   vb.pos(toX, y, z)
       .color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())
       .endVertex();
   vb.pos(x, y, z)
       .color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())
       .endVertex();
   vb.pos(x, toY, z)
       .color(colorFade.getRed(), colorFade.getGreen(), colorFade.getBlue(), colorFade.getAlpha())
       .endVertex();
   vb.pos(toX, toY, z)
       .color(colorFade.getRed(), colorFade.getGreen(), colorFade.getBlue(), colorFade.getAlpha())
       .endVertex();
   tes.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
  public static void renderFacingQuad(
      double px,
      double py,
      double pz,
      float partialTicks,
      float scale,
      float angle,
      double u,
      double v,
      double uLength,
      double vLength) {
    float arX = ActiveRenderInfo.getRotationX();
    float arZ = ActiveRenderInfo.getRotationZ();
    float arYZ = ActiveRenderInfo.getRotationYZ();
    float arXY = ActiveRenderInfo.getRotationXY();
    float arXZ = ActiveRenderInfo.getRotationXZ();

    Entity e = Minecraft.getMinecraft().getRenderViewEntity();
    if (e == null) {
      e = Minecraft.getMinecraft().thePlayer;
    }
    double iPX = e.prevPosX + (e.posX - e.prevPosX) * partialTicks;
    double iPY = e.prevPosY + (e.posY - e.prevPosY) * partialTicks;
    double iPZ = e.prevPosZ + (e.posZ - e.prevPosZ) * partialTicks;

    Vector3 v1 =
        new Vector3(-arX * scale - arYZ * scale, -arXZ * scale, -arZ * scale - arXY * scale);
    Vector3 v2 =
        new Vector3(-arX * scale + arYZ * scale, arXZ * scale, -arZ * scale + arXY * scale);
    Vector3 v3 = new Vector3(arX * scale + arYZ * scale, arXZ * scale, arZ * scale + arXY * scale);
    Vector3 v4 = new Vector3(arX * scale - arYZ * scale, -arXZ * scale, arZ * scale - arXY * scale);
    if (angle != 0.0F) {
      Vector3 pvec = new Vector3(iPX, iPY, iPZ);
      Vector3 tvec = new Vector3(px, py, pz);
      Vector3 qvec = pvec.subtract(tvec).normalize();
      Vector3.Quat q = Vector3.Quat.aroundAxis(qvec, angle);
      q.rotate(v1);
      q.rotate(v2);
      q.rotate(v3);
      q.rotate(v4);
    }
    Tessellator t = Tessellator.getInstance();
    VertexBuffer vb = t.getBuffer();
    vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    vb.pos(px + v1.getX() - iPX, py + v1.getY() - iPY, pz + v1.getZ() - iPZ)
        .tex(u, v + vLength)
        .endVertex();
    vb.pos(px + v2.getX() - iPX, py + v2.getY() - iPY, pz + v2.getZ() - iPZ)
        .tex(u + uLength, v + vLength)
        .endVertex();
    vb.pos(px + v3.getX() - iPX, py + v3.getY() - iPY, pz + v3.getZ() - iPZ)
        .tex(u + uLength, v)
        .endVertex();
    vb.pos(px + v4.getX() - iPX, py + v4.getY() - iPY, pz + v4.getZ() - iPZ).tex(u, v).endVertex();
    t.draw();
  }
  public static void drawCube(AxisAlignedBB cube) {
    double xa = cube.minX;
    double xb = cube.maxX;
    double ya = cube.minY;
    double yb = cube.maxY;
    double za = cube.minZ;
    double zb = cube.maxZ;

    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer worldRenderer = Tessellator.getInstance().getBuffer();
    worldRenderer.begin(GL11.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
    worldRenderer.pos(xa, ya, za).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xa, yb, za).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xb, yb, za).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xb, ya, za).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xa, ya, za).color(1F, 1F, 0.0F, 1.0F).endVertex();

    worldRenderer.pos(xa, ya, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xa, yb, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xb, yb, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xb, ya, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xa, ya, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();
    tessellator.draw();

    worldRenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR);
    worldRenderer.pos(xa, ya, za).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xa, ya, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();

    worldRenderer.pos(xa, yb, za).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xa, yb, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();

    worldRenderer.pos(xb, ya, za).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xb, ya, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();

    worldRenderer.pos(xb, yb, za).color(1F, 1F, 0.0F, 1.0F).endVertex();
    worldRenderer.pos(xb, yb, zb).color(1F, 1F, 0.0F, 1.0F).endVertex();
    tessellator.draw();
  }
  public static void renderAngleRotatedTexturedRect(
      Vector3 renderOffset,
      Vector3 axis,
      double angleRad,
      double scale,
      double u,
      double v,
      double uLength,
      double vLength,
      float partialTicks) {
    GL11.glPushMatrix();
    removeStandartTranslationFromTESRMatrix(partialTicks);

    Vector3 renderStart = axis.clone().perpendicular().rotate(angleRad, axis).normalize();
    Tessellator tes = Tessellator.getInstance();
    VertexBuffer buf = tes.getBuffer();

    buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);

    Vector3 vec =
        renderStart
            .clone()
            .rotate(Math.toRadians(90), axis)
            .normalize()
            .multiply(scale)
            .add(renderOffset);
    buf.pos(vec.getX(), vec.getY(), vec.getZ()).tex(u, v + vLength).endVertex();

    vec = renderStart.clone().multiply(-1).normalize().multiply(scale).add(renderOffset);
    buf.pos(vec.getX(), vec.getY(), vec.getZ()).tex(u + uLength, v + vLength).endVertex();

    vec =
        renderStart
            .clone()
            .rotate(Math.toRadians(270), axis)
            .normalize()
            .multiply(scale)
            .add(renderOffset);
    buf.pos(vec.getX(), vec.getY(), vec.getZ()).tex(u + uLength, v).endVertex();

    vec = renderStart.clone().normalize().multiply(scale).add(renderOffset);
    buf.pos(vec.getX(), vec.getY(), vec.getZ()).tex(u, v).endVertex();

    tes.draw();

    GL11.glPopMatrix();
  }
  public static void renderLightRayEffects(
      double x,
      double y,
      double z,
      Color effectColor,
      long seed,
      int continuousTick,
      int dstJump,
      float scale,
      int countFancy,
      int countNormal) {
    rand.setSeed(seed);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);

    int fancy_count =
        !FMLClientHandler.instance().getClient().gameSettings.fancyGraphics
            ? countNormal
            : countFancy;

    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();

    RenderHelper.disableStandardItemLighting();
    float f1 = continuousTick / 400.0F;
    float f2 = 0.4F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();
    for (int i = 0; i < fancy_count; i++) {
      GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F + f1 * 360.0F, 0.0F, 0.0F, 1.0F);
      vb.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
      float fa = rand.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
      float f4 = rand.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
      fa /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F);
      f4 /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F);
      vb.pos(0, 0, 0)
          .color(
              effectColor.getRed(),
              effectColor.getGreen(),
              effectColor.getBlue(),
              (int) (255.0F * (1.0F - f2)))
          .endVertex();
      vb.pos(-0.7D * f4, fa, -0.5F * f4)
          .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0)
          .endVertex();
      vb.pos(0.7D * f4, fa, -0.5F * f4)
          .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0)
          .endVertex();
      vb.pos(0.0D, fa, 1.0F * f4)
          .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0)
          .endVertex();
      vb.pos(-0.7D * f4, fa, -0.5F * f4)
          .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0)
          .endVertex();
      tes.draw();
    }
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    RenderHelper.enableStandardItemLighting();

    GL11.glPopMatrix();
  }
  /** Renders the desired {@code T} type Entity. */
  public void doRender(
      EntityFishHook entity, double x, double y, double z, float entityYaw, float partialTicks) {
    GlStateManager.pushMatrix();
    GlStateManager.translate((float) x, (float) y, (float) z);
    GlStateManager.enableRescaleNormal();
    GlStateManager.scale(0.5F, 0.5F, 0.5F);
    this.bindEntityTexture(entity);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    int i = 1;
    int j = 2;
    float f = 0.0625F;
    float f1 = 0.125F;
    float f2 = 0.125F;
    float f3 = 0.1875F;
    float f4 = 1.0F;
    float f5 = 0.5F;
    float f6 = 0.5F;
    GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.rotate(
        (float) (this.renderManager.options.thirdPersonView == 2 ? -1 : 1)
            * -this.renderManager.playerViewX,
        1.0F,
        0.0F,
        0.0F);

    if (this.renderOutlines) {
      GlStateManager.enableColorMaterial();
      GlStateManager.enableOutlineMode(this.getTeamColor(entity));
    }

    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_NORMAL);
    vertexbuffer.pos(-0.5D, -0.5D, 0.0D).tex(0.0625D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex();
    vertexbuffer.pos(0.5D, -0.5D, 0.0D).tex(0.125D, 0.1875D).normal(0.0F, 1.0F, 0.0F).endVertex();
    vertexbuffer.pos(0.5D, 0.5D, 0.0D).tex(0.125D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex();
    vertexbuffer.pos(-0.5D, 0.5D, 0.0D).tex(0.0625D, 0.125D).normal(0.0F, 1.0F, 0.0F).endVertex();
    tessellator.draw();

    if (this.renderOutlines) {
      GlStateManager.disableOutlineMode();
      GlStateManager.disableColorMaterial();
    }

    GlStateManager.disableRescaleNormal();
    GlStateManager.popMatrix();

    if (entity.angler != null && !this.renderOutlines) {
      int k = entity.angler.getPrimaryHand() == EnumHandSide.RIGHT ? 1 : -1;
      float f7 = entity.angler.getSwingProgress(partialTicks);
      float f8 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      float f9 =
          (entity.angler.prevRenderYawOffset
                  + (entity.angler.renderYawOffset - entity.angler.prevRenderYawOffset)
                      * partialTicks)
              * 0.017453292F;
      double d0 = (double) MathHelper.sin(f9);
      double d1 = (double) MathHelper.cos(f9);
      double d2 = (double) k * 0.35D;
      double d3 = 0.8D;
      double d4;
      double d5;
      double d6;
      double d7;

      if ((this.renderManager.options == null || this.renderManager.options.thirdPersonView <= 0)
          && entity.angler == Minecraft.getMinecraft().thePlayer) {
        Vec3d vec3d = new Vec3d((double) k * -0.36D, -0.05D, 0.4D);
        vec3d =
            vec3d.rotatePitch(
                -(entity.angler.prevRotationPitch
                        + (entity.angler.rotationPitch - entity.angler.prevRotationPitch)
                            * partialTicks)
                    * 0.017453292F);
        vec3d =
            vec3d.rotateYaw(
                -(entity.angler.prevRotationYaw
                        + (entity.angler.rotationYaw - entity.angler.prevRotationYaw)
                            * partialTicks)
                    * 0.017453292F);
        vec3d = vec3d.rotateYaw(f8 * 0.5F);
        vec3d = vec3d.rotatePitch(-f8 * 0.7F);
        d4 =
            entity.angler.prevPosX
                + (entity.angler.posX - entity.angler.prevPosX) * (double) partialTicks
                + vec3d.xCoord;
        d5 =
            entity.angler.prevPosY
                + (entity.angler.posY - entity.angler.prevPosY) * (double) partialTicks
                + vec3d.yCoord;
        d6 =
            entity.angler.prevPosZ
                + (entity.angler.posZ - entity.angler.prevPosZ) * (double) partialTicks
                + vec3d.zCoord;
        d7 = (double) entity.angler.getEyeHeight();
      } else {
        d4 =
            entity.angler.prevPosX
                + (entity.angler.posX - entity.angler.prevPosX) * (double) partialTicks
                - d1 * d2
                - d0 * 0.8D;
        d5 =
            entity.angler.prevPosY
                + (double) entity.angler.getEyeHeight()
                + (entity.angler.posY - entity.angler.prevPosY) * (double) partialTicks
                - 0.45D;
        d6 =
            entity.angler.prevPosZ
                + (entity.angler.posZ - entity.angler.prevPosZ) * (double) partialTicks
                - d0 * d2
                + d1 * 0.8D;
        d7 = entity.angler.isSneaking() ? -0.1875D : 0.0D;
      }

      double d13 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double) partialTicks;
      double d8 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double) partialTicks + 0.25D;
      double d9 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double) partialTicks;
      double d10 = (double) ((float) (d4 - d13));
      double d11 = (double) ((float) (d5 - d8)) + d7;
      double d12 = (double) ((float) (d6 - d9));
      GlStateManager.disableTexture2D();
      GlStateManager.disableLighting();
      vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
      int l = 16;

      for (int i1 = 0; i1 <= 16; ++i1) {
        float f10 = (float) i1 / 16.0F;
        vertexbuffer
            .pos(
                x + d10 * (double) f10,
                y + d11 * (double) (f10 * f10 + f10) * 0.5D + 0.25D,
                z + d12 * (double) f10)
            .color(0, 0, 0, 255)
            .endVertex();
      }

      tessellator.draw();
      GlStateManager.enableLighting();
      GlStateManager.enableTexture2D();
      super.doRender(entity, x, y, z, entityYaw, partialTicks);
    }
  }