/** draws the vertical line cursor in the textbox */
  private void drawCursorVertical(int par1, int par2, int par3, int par4) {
    int var5;

    if (par1 < par3) {
      var5 = par1;
      par1 = par3;
      par3 = var5;
    }

    if (par2 < par4) {
      var5 = par2;
      par2 = par4;
      par4 = var5;
    }

    Tessellator var6 = Tessellator.instance;
    GL11.glColor4f(0.0F, 0.0F, 255.0F, 255.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_COLOR_LOGIC_OP);
    GL11.glLogicOp(GL11.GL_OR_REVERSE);
    var6.startDrawingQuads();
    var6.addVertex((double) par1, (double) par4, 0.0D);
    var6.addVertex((double) par3, (double) par4, 0.0D);
    var6.addVertex((double) par3, (double) par2, 0.0D);
    var6.addVertex((double) par1, (double) par2, 0.0D);
    var6.draw();
    GL11.glDisable(GL11.GL_COLOR_LOGIC_OP);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
  }
Beispiel #2
0
 /** Draws a rectangle with a vertical gradient between the specified colors. */
 protected void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
   float var7 = (float) (par5 >> 24 & 255) / 255.0F;
   float var8 = (float) (par5 >> 16 & 255) / 255.0F;
   float var9 = (float) (par5 >> 8 & 255) / 255.0F;
   float var10 = (float) (par5 & 255) / 255.0F;
   float var11 = (float) (par6 >> 24 & 255) / 255.0F;
   float var12 = (float) (par6 >> 16 & 255) / 255.0F;
   float var13 = (float) (par6 >> 8 & 255) / 255.0F;
   float var14 = (float) (par6 & 255) / 255.0F;
   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 var15 = Tessellator.instance;
   var15.startDrawingQuads();
   var15.setColorRGBA_F(var8, var9, var10, var7);
   var15.addVertex((double) par3, (double) par2, (double) this.zLevel);
   var15.addVertex((double) par1, (double) par2, (double) this.zLevel);
   var15.setColorRGBA_F(var12, var13, var14, var11);
   var15.addVertex((double) par1, (double) par4, (double) this.zLevel);
   var15.addVertex((double) par3, (double) par4, (double) this.zLevel);
   var15.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
Beispiel #3
0
  /** Draws a solid color rectangle with the specified coordinates and color. */
  public static void drawRect(int par0, int par1, int par2, int par3, int par4) {
    int var5;

    if (par0 < par2) {
      var5 = par0;
      par0 = par2;
      par2 = var5;
    }

    if (par1 < par3) {
      var5 = par1;
      par1 = par3;
      par3 = var5;
    }

    float var10 = (float) (par4 >> 24 & 255) / 255.0F;
    float var6 = (float) (par4 >> 16 & 255) / 255.0F;
    float var7 = (float) (par4 >> 8 & 255) / 255.0F;
    float var8 = (float) (par4 & 255) / 255.0F;
    Tessellator var9 = Tessellator.instance;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(var6, var7, var8, var10);
    var9.startDrawingQuads();
    var9.addVertex((double) par0, (double) par3, 0.0D);
    var9.addVertex((double) par2, (double) par3, 0.0D);
    var9.addVertex((double) par2, (double) par1, 0.0D);
    var9.addVertex((double) par0, (double) par1, 0.0D);
    var9.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
  }
  /** Renders the animation for when an enderdragon dies */
  protected void renderDragonDying(EntityDragon par1EntityDragon, float par2) {
    super.renderEquippedItems(par1EntityDragon, par2);
    Tessellator tessellator = Tessellator.instance;

    if (par1EntityDragon.deathTicks > 0) {
      RenderHelper.disableStandardItemLighting();
      float f = ((float) par1EntityDragon.deathTicks + par2) / 200F;
      float f1 = 0.0F;

      if (f > 0.8F) {
        f1 = (f - 0.8F) / 0.2F;
      }

      Random random = new Random(432L);
      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.glEnable(GL11.GL_CULL_FACE);
      GL11.glDepthMask(false);
      GL11.glPushMatrix();
      GL11.glTranslatef(0.0F, -1F, -2F);

      for (int i = 0; (float) i < ((f + f * f) / 2.0F) * 60F; i++) {
        GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(random.nextFloat() * 360F + f * 90F, 0.0F, 0.0F, 1.0F);
        tessellator.startDrawing(6);
        float f2 = random.nextFloat() * 20F + 5F + f1 * 10F;
        float f3 = random.nextFloat() * 2.0F + 1.0F + f1 * 2.0F;
        tessellator.setColorRGBA_I(0xffffff, (int) (255F * (1.0F - f1)));
        tessellator.addVertex(0.0D, 0.0D, 0.0D);
        tessellator.setColorRGBA_I(0xff00ff, 0);
        tessellator.addVertex(-0.86599999999999999D * (double) f3, f2, -0.5F * f3);
        tessellator.addVertex(0.86599999999999999D * (double) f3, f2, -0.5F * f3);
        tessellator.addVertex(0.0D, f2, 1.0F * f3);
        tessellator.addVertex(-0.86599999999999999D * (double) f3, f2, -0.5F * f3);
        tessellator.draw();
      }

      GL11.glPopMatrix();
      GL11.glDepthMask(true);
      GL11.glDisable(GL11.GL_CULL_FACE);
      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();
    }
  }
Beispiel #5
0
  protected void renderLivingLabel(
      EntityLiving var1,
      String var2,
      double var3,
      double var5,
      double var7,
      int var9,
      int color,
      int color2) {
    // Spout end
    float var10 = var1.getDistanceToEntity(this.renderManager.livingPlayer);
    if (var10 <= (float) var9) {
      FontRenderer var11 = this.getFontRendererFromRenderManager();
      float var12 = 1.6F;
      float var13 = 0.016666668F * var12;
      GL11.glPushMatrix();
      GL11.glTranslatef((float) var3 + 0.0F, (float) var5 + 2.3F, (float) var7);
      GL11.glNormal3f(0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
      GL11.glScalef(-var13, -var13, var13);
      GL11.glDisable(2896 /*GL_LIGHTING*/);
      GL11.glDepthMask(false);
      GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
      GL11.glEnable(3042 /*GL_BLEND*/);
      GL11.glBlendFunc(770, 771);
      Tessellator var14 = Tessellator.instance;
      byte var15 = 0;
      if (var2.equals("deadmau5")) {
        var15 = -10;
      }

      GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
      var14.startDrawingQuads();
      int var16 = var11.getStringWidth(var2) / 2;
      var14.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
      var14.addVertex((double) (-var16 - 1), (double) (-1 + var15), 0.0D);
      var14.addVertex((double) (-var16 - 1), (double) (8 + var15), 0.0D);
      var14.addVertex((double) (var16 + 1), (double) (8 + var15), 0.0D);
      var14.addVertex((double) (var16 + 1), (double) (-1 + var15), 0.0D);
      var14.draw();
      GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
      var11.drawString(
          var2, -var11.getStringWidth(var2) / 2, var15, color); // Spout (changed to color var)
      GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
      GL11.glDepthMask(true);
      var11.drawString(
          var2, -var11.getStringWidth(var2) / 2, var15, color2); // Spout (changed to color2 var)
      GL11.glEnable(2896 /*GL_LIGHTING*/);
      GL11.glDisable(3042 /*GL_BLEND*/);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glPopMatrix();
    }
  }
  /** Draws the debug or playername text above a living */
  protected void renderLivingLabel(
      EntityLiving par1EntityLiving,
      String par2Str,
      double par3,
      double par5,
      double par7,
      int par9) {
    float f = par1EntityLiving.getDistanceToEntity(renderManager.livingPlayer);

    if (f > (float) par9) {
      return;
    }

    FontRenderer fontrenderer = getFontRendererFromRenderManager();
    float f1 = 1.6F;
    float f2 = 0.01666667F * f1;
    GL11.glPushMatrix();
    GL11.glTranslatef((float) par3 + 0.0F, (float) par5 + 2.3F, (float) par7);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(-f2, -f2, f2);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    Tessellator tessellator = Tessellator.instance;
    byte byte0 = 0;

    if (par2Str.equals("deadmau5")) {
      byte0 = -10;
    }

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    tessellator.startDrawingQuads();
    int i = fontrenderer.getStringWidth(par2Str) / 2;
    tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
    tessellator.addVertex(-i - 1, -1 + byte0, 0.0D);
    tessellator.addVertex(-i - 1, 8 + byte0, 0.0D);
    tessellator.addVertex(i + 1, 8 + byte0, 0.0D);
    tessellator.addVertex(i + 1, -1 + byte0, 0.0D);
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    fontrenderer.drawString(par2Str, -fontrenderer.getStringWidth(par2Str) / 2, byte0, 0x20ffffff);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    fontrenderer.drawString(par2Str, -fontrenderer.getStringWidth(par2Str) / 2, byte0, -1);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
  }
  /** Used to render a player's name above their head */
  protected void renderName(EntityPlayer par1EntityPlayer, double par2, double par4, double par6) {
    if (Minecraft.isGuiEnabled() && par1EntityPlayer != renderManager.livingPlayer) {
      float f = 1.6F;
      float f1 = 0.01666667F * f;
      float f2 = par1EntityPlayer.getDistanceToEntity(renderManager.livingPlayer);
      float f3 = par1EntityPlayer.isSneaking() ? 32F : 64F;

      if (f2 < f3) {
        String s = par1EntityPlayer.username;

        if (!par1EntityPlayer.isSneaking()) {
          if (par1EntityPlayer.isPlayerSleeping()) {
            renderLivingLabel(par1EntityPlayer, s, par2, par4 - 1.5D, par6, 64);
          } else {
            renderLivingLabel(par1EntityPlayer, s, par2, par4, par6, 64);
          }
        } else {
          FontRenderer fontrenderer = getFontRendererFromRenderManager();
          GL11.glPushMatrix();
          GL11.glTranslatef((float) par2 + 0.0F, (float) par4 + 2.3F, (float) par6);
          GL11.glNormal3f(0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
          GL11.glScalef(-f1, -f1, f1);
          GL11.glDisable(GL11.GL_LIGHTING);
          GL11.glTranslatef(0.0F, 0.25F / f1, 0.0F);
          GL11.glDepthMask(false);
          GL11.glEnable(GL11.GL_BLEND);
          GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
          Tessellator tessellator = Tessellator.instance;
          GL11.glDisable(GL11.GL_TEXTURE_2D);
          tessellator.startDrawingQuads();
          int i = fontrenderer.getStringWidth(s) / 2;

          tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
          tessellator.addVertex(-i - 1, -1D, 0.0D);
          tessellator.addVertex(-i - 1, 8D, 0.0D);
          tessellator.addVertex(i + 1, 8D, 0.0D);
          tessellator.addVertex(i + 1, -1D, 0.0D);

          tessellator.draw();
          GL11.glEnable(GL11.GL_TEXTURE_2D);
          GL11.glDepthMask(true);
          fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 0x20ffffff);

          GL11.glEnable(GL11.GL_LIGHTING);
          GL11.glDisable(GL11.GL_BLEND);
          GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
          GL11.glPopMatrix();
        }
      }
    }
  }
Beispiel #8
0
  public void doRenderFishHook(
      EntityFishHook entityfishhook, double d, double d1, double d2, float f, float f1) {
    GL11.glPushMatrix();
    GL11.glTranslatef((float) d, (float) d1, (float) d2);
    GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
    GL11.glScalef(0.5F, 0.5F, 0.5F);
    int i = 1;
    byte byte0 = 2;
    loadTexture("/particles.png");
    Tessellator tessellator = Tessellator.instance;
    float f2 = (float) (i * 8 + 0) / 128F;
    float f3 = (float) (i * 8 + 8) / 128F;
    float f4 = (float) (byte0 * 8 + 0) / 128F;
    float f5 = (float) (byte0 * 8 + 8) / 128F;
    float f6 = 1.0F;
    float f7 = 0.5F;
    float f8 = 0.5F;
    GL11.glRotatef(180F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    tessellator.addVertexWithUV(0.0F - f7, 0.0F - f8, 0.0D, f2, f5);
    tessellator.addVertexWithUV(f6 - f7, 0.0F - f8, 0.0D, f3, f5);
    tessellator.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
    tessellator.addVertexWithUV(0.0F - f7, 1.0F - f8, 0.0D, f2, f4);
    tessellator.draw();
    GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
    GL11.glPopMatrix();
    if (entityfishhook.angler != null) {
      float f9 =
          ((entityfishhook.angler.prevRotationYaw
                      + (entityfishhook.angler.rotationYaw - entityfishhook.angler.prevRotationYaw)
                          * f1)
                  * 3.141593F)
              / 180F;
      double d3 = MathHelper.sin(f9);
      double d5 = MathHelper.cos(f9);
      float f11 = entityfishhook.angler.getSwingProgress(f1);
      float f12 = MathHelper.sin(MathHelper.sqrt_float(f11) * 3.141593F);
      Vec3D vec3d = Vec3D.createVector(-0.5D, 0.029999999999999999D, 0.80000000000000004D);
      vec3d.rotateAroundX(
          (-(entityfishhook.angler.prevRotationPitch
                      + (entityfishhook.angler.rotationPitch
                              - entityfishhook.angler.prevRotationPitch)
                          * f1)
                  * 3.141593F)
              / 180F);
      vec3d.rotateAroundY(
          (-(entityfishhook.angler.prevRotationYaw
                      + (entityfishhook.angler.rotationYaw - entityfishhook.angler.prevRotationYaw)
                          * f1)
                  * 3.141593F)
              / 180F);
      vec3d.rotateAroundY(f12 * 0.5F);
      vec3d.rotateAroundX(-f12 * 0.7F);
      double d7 =
          entityfishhook.angler.prevPosX
              + (entityfishhook.angler.posX - entityfishhook.angler.prevPosX) * (double) f1
              + vec3d.xCoord;
      double d8 =
          entityfishhook.angler.prevPosY
              + (entityfishhook.angler.posY - entityfishhook.angler.prevPosY) * (double) f1
              + vec3d.yCoord;
      double d9 =
          entityfishhook.angler.prevPosZ
              + (entityfishhook.angler.posZ - entityfishhook.angler.prevPosZ) * (double) f1
              + vec3d.zCoord;
      if (renderManager.options.thirdPersonView > 0) {
        float f10 =
            ((entityfishhook.angler.prevRenderYawOffset
                        + (entityfishhook.angler.renderYawOffset
                                - entityfishhook.angler.prevRenderYawOffset)
                            * f1)
                    * 3.141593F)
                / 180F;
        double d4 = MathHelper.sin(f10);
        double d6 = MathHelper.cos(f10);
        d7 =
            (entityfishhook.angler.prevPosX
                    + (entityfishhook.angler.posX - entityfishhook.angler.prevPosX) * (double) f1)
                - d6 * 0.34999999999999998D
                - d4 * 0.84999999999999998D;
        d8 =
            (entityfishhook.angler.prevPosY
                    + (entityfishhook.angler.posY - entityfishhook.angler.prevPosY) * (double) f1)
                - 0.45000000000000001D;
        d9 =
            ((entityfishhook.angler.prevPosZ
                        + (entityfishhook.angler.posZ - entityfishhook.angler.prevPosZ)
                            * (double) f1)
                    - d4 * 0.34999999999999998D)
                + d6 * 0.84999999999999998D;
      }
      double d10 =
          entityfishhook.prevPosX + (entityfishhook.posX - entityfishhook.prevPosX) * (double) f1;
      double d11 =
          entityfishhook.prevPosY
              + (entityfishhook.posY - entityfishhook.prevPosY) * (double) f1
              + 0.25D;
      double d12 =
          entityfishhook.prevPosZ + (entityfishhook.posZ - entityfishhook.prevPosZ) * (double) f1;
      double d13 = (float) (d7 - d10);
      double d14 = (float) (d8 - d11);
      double d15 = (float) (d9 - d12);
      GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
      GL11.glDisable(2896 /*GL_LIGHTING*/);
      tessellator.startDrawing(3);
      tessellator.setColorOpaque_I(0);
      int j = 16;
      for (int k = 0; k <= j; k++) {
        float f13 = (float) k / (float) j;
        tessellator.addVertex(
            d + d13 * (double) f13,
            d1 + d14 * (double) (f13 * f13 + f13) * 0.5D + 0.25D,
            d2 + d15 * (double) f13);
      }

      tessellator.draw();
      GL11.glEnable(2896 /*GL_LIGHTING*/);
      GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
    }
  }
 /** Adds a vertex specifying both x,y,z and the texture u,v for it. */
 public void addVertexWithUV(double par1, double par3, double par5, double par7, double par9) {
   setTextureUV(par7, par9);
   addVertex(par1, par3, par5);
 }
  /** Actually renders the lightning bolt. This method is called through the doRender method. */
  public void doRenderLightningBolt(
      EntityLightningBolt par1EntityLightningBolt,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    Tessellator var10 = Tessellator.instance;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    double[] var11 = new double[8];
    double[] var12 = new double[8];
    double var13 = 0.0D;
    double var15 = 0.0D;
    Random var17 = new Random(par1EntityLightningBolt.boltVertex);

    for (int var18 = 7; var18 >= 0; --var18) {
      var11[var18] = var13;
      var12[var18] = var15;
      var13 += (double) (var17.nextInt(11) - 5);
      var15 += (double) (var17.nextInt(11) - 5);
    }

    for (int var45 = 0; var45 < 4; ++var45) {
      Random var46 = new Random(par1EntityLightningBolt.boltVertex);

      for (int var19 = 0; var19 < 3; ++var19) {
        int var20 = 7;
        int var21 = 0;

        if (var19 > 0) {
          var20 = 7 - var19;
        }

        if (var19 > 0) {
          var21 = var20 - 2;
        }

        double var22 = var11[var20] - var13;
        double var24 = var12[var20] - var15;

        for (int var26 = var20; var26 >= var21; --var26) {
          double var27 = var22;
          double var29 = var24;

          if (var19 == 0) {
            var22 += (double) (var46.nextInt(11) - 5);
            var24 += (double) (var46.nextInt(11) - 5);
          } else {
            var22 += (double) (var46.nextInt(31) - 15);
            var24 += (double) (var46.nextInt(31) - 15);
          }

          var10.startDrawing(5);
          float var31 = 0.5F;
          var10.setColorRGBA_F(0.9F * var31, 0.9F * var31, 1.0F * var31, 0.3F);
          double var32 = 0.1D + (double) var45 * 0.2D;

          if (var19 == 0) {
            var32 *= (double) var26 * 0.1D + 1.0D;
          }

          double var34 = 0.1D + (double) var45 * 0.2D;

          if (var19 == 0) {
            var34 *= (double) (var26 - 1) * 0.1D + 1.0D;
          }

          for (int var36 = 0; var36 < 5; ++var36) {
            double var37 = par2 + 0.5D - var32;
            double var39 = par6 + 0.5D - var32;

            if (var36 == 1 || var36 == 2) {
              var37 += var32 * 2.0D;
            }

            if (var36 == 2 || var36 == 3) {
              var39 += var32 * 2.0D;
            }

            double var41 = par2 + 0.5D - var34;
            double var43 = par6 + 0.5D - var34;

            if (var36 == 1 || var36 == 2) {
              var41 += var34 * 2.0D;
            }

            if (var36 == 2 || var36 == 3) {
              var43 += var34 * 2.0D;
            }

            var10.addVertex(var41 + var22, par4 + (double) (var26 * 16), var43 + var24);
            var10.addVertex(var37 + var27, par4 + (double) ((var26 + 1) * 16), var39 + var29);
          }

          var10.draw();
        }
      }
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
  }
Beispiel #11
0
  /** Used to render a player's name above their head */
  protected void renderName(EntityPlayer par1EntityPlayer, double par2, double par4, double par6) {
    if (!par1EntityPlayer.getHasActivePotion()) {
      if (Minecraft.isGuiEnabled()
          && (par1EntityPlayer != this.renderManager.livingPlayer
              || (Minecraft.theMinecraft.gameSettings.thirdPersonView != 0
                  && Minecraft.theMinecraft.currentScreen == null))) {
        float var8 = 1.6F;
        float var9 = 0.016666668F * var8;
        double var10 = par1EntityPlayer.getDistanceSqToEntity(this.renderManager.livingPlayer);
        float var12 = par1EntityPlayer.isSneaking() ? 32.0F : 64.0F;

        if (var10 < (double) (var12 * var12)) {
          // Spout Start
          String title = null;
          VIP vip = par1EntityPlayer.vip;
          if (vip != null) {
            title = vip.getTitle();
          } else {
            title = par1EntityPlayer.displayName;
          }
          float alpha = 0.25F;
          // If a plugin hasn't set a title, use the easter egg title (if one exists)
          /*if (EasterEggs.getEasterEggTitle(var1.username) != null && color == -1) {
          	title = EasterEggs.getEasterEggTitle(var1.username);
          	alpha = 0.0F;
          }*/
          if (!title.equals("[hide]")) {
            String lines[] = title.split("\\n");
            double y = par4;
            for (int line = 0; line < lines.length; line++) {
              title = lines[line];
              par4 = y + (0.275D * (lines.length - line - 1));

              if (AccessoryHandler.hasAccessory(
                  par1EntityPlayer.username, AccessoryType.NOTCHHAT)) {
                par4 = par4 + 0.275d;
              } else if (AccessoryHandler.hasAccessory(
                  par1EntityPlayer.username, AccessoryType.TOPHAT)) {
                par4 = par4 + 0.5d;
              }

              if (!par1EntityPlayer.isSneaking()) {
                if (par1EntityPlayer.isPlayerSleeping()) {
                  this.renderLivingLabel(par1EntityPlayer, title, par2, par4 - 1.5D, par6, 64);
                } else {
                  this.renderLivingLabel(par1EntityPlayer, title, par2, par4, par6, 64);
                  // TODO: Adapation needed.
                  /*if (color != -1) {
                  	this.renderLivingLabel(var1, title, var2, var4, var6, 64, color, color);
                  } else {
                  	this.renderLivingLabel(par1EntityPlayer, title, par2, par4, par6, 64);
                  }*/
                }
              } else {
                title = org.bukkit.ChatColor.stripColor(title); // strip colors when sneaking
                FontRenderer var14 = this.getFontRendererFromRenderManager();
                GL11.glPushMatrix();
                GL11.glTranslatef((float) par2 + 0.0F, (float) par4 + 2.3F, (float) par6);
                GL11.glNormal3f(0.0F, 1.0F, 0.0F);
                GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
                GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
                GL11.glScalef(-var9, -var9, var9);
                GL11.glDisable(GL11.GL_LIGHTING);
                GL11.glTranslatef(0.0F, 0.25F / var9, 0.0F);
                GL11.glDepthMask(false);

                GL11.glEnable(GL11.GL_BLEND);
                GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
                Tessellator var15 = Tessellator.instance;
                GL11.glDisable(GL11.GL_TEXTURE_2D);
                var15.startDrawingQuads();
                int var16 = var14.getStringWidth(title) / 2;
                var15.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
                var15.addVertex((double) (-var16 - 1), -1.0D, 0.0D);
                var15.addVertex((double) (-var16 - 1), 8.0D, 0.0D);
                var15.addVertex((double) (var16 + 1), 8.0D, 0.0D);
                var15.addVertex((double) (var16 + 1), -1.0D, 0.0D);
                var15.draw();
                GL11.glEnable(GL11.GL_TEXTURE_2D);
                GL11.glDepthMask(true);
                var14.drawString(title, -var14.getStringWidth(title) / 2, 0, 553648127);
                GL11.glEnable(GL11.GL_LIGHTING);

                GL11.glDisable(GL11.GL_BLEND);
                GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
                GL11.glPopMatrix();
                // Spout End
              }
            }
          }
        }
      }
    }
  }
  public void func_76906_a(
      TileEntityEndPortal par1TileEntityEndPortal,
      double par2,
      double par4,
      double par6,
      float par8) {
    float var9 = (float) this.tileEntityRenderer.playerX;
    float var10 = (float) this.tileEntityRenderer.playerY;
    float var11 = (float) this.tileEntityRenderer.playerZ;
    GL11.glDisable(GL11.GL_LIGHTING);
    Random var12 = new Random(31100L);
    float var13 = 0.75F;

    for (int var14 = 0; var14 < 16; ++var14) {
      GL11.glPushMatrix();
      float var15 = (float) (16 - var14);
      float var16 = 0.0625F;
      float var17 = 1.0F / (var15 + 1.0F);

      if (var14 == 0) {
        this.bindTextureByName("/misc/tunnel.png");
        var17 = 0.1F;
        var15 = 65.0F;
        var16 = 0.125F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      }

      if (var14 == 1) {
        this.bindTextureByName("/misc/particlefield.png");
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
        var16 = 0.5F;
      }

      float var18 = (float) (-(par4 + (double) var13));
      float var19 = var18 + ActiveRenderInfo.objectY;
      float var20 = var18 + var15 + ActiveRenderInfo.objectY;
      float var21 = var19 / var20;
      var21 += (float) (par4 + (double) var13);
      GL11.glTranslatef(var9, var21, var11);
      GL11.glTexGeni(GL11.GL_S, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_T, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_R, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_OBJECT_LINEAR);
      GL11.glTexGeni(GL11.GL_Q, GL11.GL_TEXTURE_GEN_MODE, GL11.GL_EYE_LINEAR);
      GL11.glTexGen(GL11.GL_S, GL11.GL_OBJECT_PLANE, this.func_76907_a(1.0F, 0.0F, 0.0F, 0.0F));
      GL11.glTexGen(GL11.GL_T, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 1.0F, 0.0F));
      GL11.glTexGen(GL11.GL_R, GL11.GL_OBJECT_PLANE, this.func_76907_a(0.0F, 0.0F, 0.0F, 1.0F));
      GL11.glTexGen(GL11.GL_Q, GL11.GL_EYE_PLANE, this.func_76907_a(0.0F, 1.0F, 0.0F, 0.0F));
      GL11.glEnable(GL11.GL_TEXTURE_GEN_S);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_T);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_R);
      GL11.glEnable(GL11.GL_TEXTURE_GEN_Q);
      GL11.glPopMatrix();
      GL11.glMatrixMode(GL11.GL_TEXTURE);
      GL11.glPushMatrix();
      GL11.glLoadIdentity();
      GL11.glTranslatef(0.0F, (float) (Minecraft.getSystemTime() % 700000L) / 700000.0F, 0.0F);
      GL11.glScalef(var16, var16, var16);
      GL11.glTranslatef(0.5F, 0.5F, 0.0F);
      GL11.glRotatef((float) (var14 * var14 * 4321 + var14 * 9) * 2.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-0.5F, -0.5F, 0.0F);
      GL11.glTranslatef(-var9, -var11, -var10);
      var19 = var18 + ActiveRenderInfo.objectY;
      GL11.glTranslatef(
          ActiveRenderInfo.objectX * var15 / var19,
          ActiveRenderInfo.objectZ * var15 / var19,
          -var10);
      Tessellator var24 = Tessellator.instance;
      var24.startDrawingQuads();
      var21 = var12.nextFloat() * 0.5F + 0.1F;
      float var22 = var12.nextFloat() * 0.5F + 0.4F;
      float var23 = var12.nextFloat() * 0.5F + 0.5F;

      if (var14 == 0) {
        var23 = 1.0F;
        var22 = 1.0F;
        var21 = 1.0F;
      }

      var24.setColorRGBA_F(var21 * var17, var22 * var17, var23 * var17, 1.0F);
      var24.addVertex(par2, par4 + (double) var13, par6);
      var24.addVertex(par2, par4 + (double) var13, par6 + 1.0D);
      var24.addVertex(par2 + 1.0D, par4 + (double) var13, par6 + 1.0D);
      var24.addVertex(par2 + 1.0D, par4 + (double) var13, par6);
      var24.draw();
      GL11.glPopMatrix();
      GL11.glMatrixMode(GL11.GL_MODELVIEW);
    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_S);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_T);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_R);
    GL11.glDisable(GL11.GL_TEXTURE_GEN_Q);
    GL11.glEnable(GL11.GL_LIGHTING);
  }
Beispiel #13
0
  /** Render a single line string at the current (posX,posY) and update posX */
  private void renderStringAtPos(String par1Str, boolean par2) {
    for (int var3 = 0; var3 < par1Str.length(); ++var3) {
      char var4 = par1Str.charAt(var3);
      int var5;
      int var6;

      if (var4 == 167 && var3 + 1 < par1Str.length()) {
        var5 = "0123456789abcdefklmnor".indexOf(par1Str.toLowerCase().charAt(var3 + 1));

        if (var5 < 16) {
          this.randomStyle = false;
          this.boldStyle = false;
          this.strikethroughStyle = false;
          this.underlineStyle = false;
          this.italicStyle = false;

          if (var5 < 0 || var5 > 15) {
            var5 = 15;
          }

          if (par2) {
            var5 += 16;
          }

          var6 = this.colorCode[var5];
          this.textColor = var6;
          GL11.glColor4f(
              (float) (var6 >> 16) / 255.0F,
              (float) (var6 >> 8 & 255) / 255.0F,
              (float) (var6 & 255) / 255.0F,
              this.alpha);
        } else if (var5 == 16) {
          this.randomStyle = true;
        } else if (var5 == 17) {
          this.boldStyle = true;
        } else if (var5 == 18) {
          this.strikethroughStyle = true;
        } else if (var5 == 19) {
          this.underlineStyle = true;
        } else if (var5 == 20) {
          this.italicStyle = true;
        } else if (var5 == 21) {
          this.randomStyle = false;
          this.boldStyle = false;
          this.strikethroughStyle = false;
          this.underlineStyle = false;
          this.italicStyle = false;
          GL11.glColor4f(this.red, this.blue, this.green, this.alpha);
        }

        ++var3;
      } else {
        var5 = ChatAllowedCharacters.allowedCharacters.indexOf(var4);

        if (this.randomStyle && var5 > 0) {
          do {
            var6 = this.fontRandom.nextInt(ChatAllowedCharacters.allowedCharacters.length());
          } while (this.charWidth[var5 + 32] != this.charWidth[var6 + 32]);

          var5 = var6;
        }

        float var9 = this.renderCharAtPos(var5, var4, this.italicStyle);

        if (this.boldStyle) {
          ++this.posX;
          this.renderCharAtPos(var5, var4, this.italicStyle);
          --this.posX;
          ++var9;
        }

        Tessellator var7;

        if (this.strikethroughStyle) {
          var7 = Tessellator.instance;
          GL11.glDisable(GL11.GL_TEXTURE_2D);
          var7.startDrawingQuads();
          var7.addVertex(
              (double) this.posX, (double) (this.posY + (float) (this.FONT_HEIGHT / 2)), 0.0D);
          var7.addVertex(
              (double) (this.posX + var9),
              (double) (this.posY + (float) (this.FONT_HEIGHT / 2)),
              0.0D);
          var7.addVertex(
              (double) (this.posX + var9),
              (double) (this.posY + (float) (this.FONT_HEIGHT / 2) - 1.0F),
              0.0D);
          var7.addVertex(
              (double) this.posX,
              (double) (this.posY + (float) (this.FONT_HEIGHT / 2) - 1.0F),
              0.0D);
          var7.draw();
          GL11.glEnable(GL11.GL_TEXTURE_2D);
        }

        if (this.underlineStyle) {
          var7 = Tessellator.instance;
          GL11.glDisable(GL11.GL_TEXTURE_2D);
          var7.startDrawingQuads();
          int var8 = this.underlineStyle ? -1 : 0;
          var7.addVertex(
              (double) (this.posX + (float) var8),
              (double) (this.posY + (float) this.FONT_HEIGHT),
              0.0D);
          var7.addVertex(
              (double) (this.posX + var9), (double) (this.posY + (float) this.FONT_HEIGHT), 0.0D);
          var7.addVertex(
              (double) (this.posX + var9),
              (double) (this.posY + (float) this.FONT_HEIGHT - 1.0F),
              0.0D);
          var7.addVertex(
              (double) (this.posX + (float) var8),
              (double) (this.posY + (float) this.FONT_HEIGHT - 1.0F),
              0.0D);
          var7.draw();
          GL11.glEnable(GL11.GL_TEXTURE_2D);
        }

        this.posX += (float) ((int) var9);
      }
    }
  }
Beispiel #14
0
  private void displayDebugInfo(long l) {
    long l1 = 0xfe502aL;
    if (prevFrameTime == -1L) {
      prevFrameTime = System.nanoTime();
    }
    long l2 = System.nanoTime();
    tickTimes[numRecordedFrameTimes & frameTimes.length - 1] = l;
    frameTimes[numRecordedFrameTimes++ & frameTimes.length - 1] = l2 - prevFrameTime;
    prevFrameTime = l2;
    GL11.glClear(256);
    GL11.glMatrixMode(5889 /*GL_PROJECTION*/);
    GL11.glLoadIdentity();
    GL11.glOrtho(0.0D, displayWidth, displayHeight, 0.0D, 1000D, 3000D);
    GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.0F, 0.0F, -2000F);
    GL11.glLineWidth(1.0F);
    GL11.glDisable(3553 /*GL_TEXTURE_2D*/);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawing(7);
    int i = (int) (l1 / 0x30d40L);
    tessellator.setColorOpaque_I(0x20000000);
    tessellator.addVertex(0.0D, displayHeight - i, 0.0D);
    tessellator.addVertex(0.0D, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i, 0.0D);
    tessellator.setColorOpaque_I(0x20200000);
    tessellator.addVertex(0.0D, displayHeight - i * 2, 0.0D);
    tessellator.addVertex(0.0D, displayHeight - i, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - i * 2, 0.0D);
    tessellator.draw();
    long l3 = 0L;
    for (int j = 0; j < frameTimes.length; j++) {
      l3 += frameTimes[j];
    }

    int k = (int) (l3 / 0x30d40L / (long) frameTimes.length);
    tessellator.startDrawing(7);
    tessellator.setColorOpaque_I(0x20400000);
    tessellator.addVertex(0.0D, displayHeight - k, 0.0D);
    tessellator.addVertex(0.0D, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight, 0.0D);
    tessellator.addVertex(frameTimes.length, displayHeight - k, 0.0D);
    tessellator.draw();
    tessellator.startDrawing(1);
    for (int i1 = 0; i1 < frameTimes.length; i1++) {
      int j1 = ((i1 - numRecordedFrameTimes & frameTimes.length - 1) * 255) / frameTimes.length;
      int k1 = (j1 * j1) / 255;
      k1 = (k1 * k1) / 255;
      int i2 = (k1 * k1) / 255;
      i2 = (i2 * i2) / 255;
      if (frameTimes[i1] > l1) {
        tessellator.setColorOpaque_I(0xff000000 + k1 * 0x10000);
      } else {
        tessellator.setColorOpaque_I(0xff000000 + k1 * 256);
      }
      long l4 = frameTimes[i1] / 0x30d40L;
      long l5 = tickTimes[i1] / 0x30d40L;
      tessellator.addVertex((float) i1 + 0.5F, (float) ((long) displayHeight - l4) + 0.5F, 0.0D);
      tessellator.addVertex((float) i1 + 0.5F, (float) displayHeight + 0.5F, 0.0D);
      tessellator.setColorOpaque_I(0xff000000 + k1 * 0x10000 + k1 * 256 + k1 * 1);
      tessellator.addVertex((float) i1 + 0.5F, (float) ((long) displayHeight - l4) + 0.5F, 0.0D);
      tessellator.addVertex(
          (float) i1 + 0.5F, (float) ((long) displayHeight - (l4 - l5)) + 0.5F, 0.0D);
    }

    tessellator.draw();
    GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
  }