예제 #1
0
  /** 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();
    }
  }
 private void func_82457_a(int par1, int par2, int par3) {
   this.func_82456_d(par1 + 1, par2 + 1);
   GL11.glEnable(GL12.GL_RESCALE_NORMAL);
   RenderHelper.enableGUIStandardItemLighting();
   GuiFlatPresets.getPresetIconRenderer()
       .renderItemIntoGUI(
           this.flatPresetsGui.fontRenderer,
           this.flatPresetsGui.mc.renderEngine,
           new ItemStack(par3, 1, 0),
           par1 + 2,
           par2 + 2);
   RenderHelper.disableStandardItemLighting();
   GL11.glDisable(GL12.GL_RESCALE_NORMAL);
 }
  public void renderParticle(
      Tessellator par1Tessellator,
      float par2,
      float par3,
      float par4,
      float par5,
      float par6,
      float par7) {
    int i = (int) ((((float) field_35130_a + par2) * 15F) / (float) field_35129_ay);

    if (i > 15) {
      return;
    } else {
      field_35128_az.bindTexture(field_35128_az.getTexture("/misc/explosion.png"));
      float f = (float) (i % 4) / 4F;
      float f1 = f + 0.24975F;
      float f2 = (float) (i / 4) / 4F;
      float f3 = f2 + 0.24975F;
      float f4 = 2.0F * field_35131_aA;
      float f5 = (float) ((prevPosX + (posX - prevPosX) * (double) par2) - interpPosX);
      float f6 = (float) ((prevPosY + (posY - prevPosY) * (double) par2) - interpPosY);
      float f7 = (float) ((prevPosZ + (posZ - prevPosZ) * (double) par2) - interpPosZ);
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glDisable(GL11.GL_LIGHTING);
      RenderHelper.disableStandardItemLighting();
      par1Tessellator.startDrawingQuads();
      par1Tessellator.setColorRGBA_F(rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), 1.0F);
      par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
      par1Tessellator.setBrightness(240);
      par1Tessellator.addVertexWithUV(
          f5 - par3 * f4 - par6 * f4, f6 - par4 * f4, f7 - par5 * f4 - par7 * f4, f1, f3);
      par1Tessellator.addVertexWithUV(
          (f5 - par3 * f4) + par6 * f4, f6 + par4 * f4, (f7 - par5 * f4) + par7 * f4, f1, f2);
      par1Tessellator.addVertexWithUV(
          f5 + par3 * f4 + par6 * f4, f6 + par4 * f4, f7 + par5 * f4 + par7 * f4, f, f2);
      par1Tessellator.addVertexWithUV(
          (f5 + par3 * f4) - par6 * f4, f6 - par4 * f4, (f7 + par5 * f4) - par7 * f4, f, f3);
      par1Tessellator.draw();
      GL11.glPolygonOffset(0.0F, 0.0F);
      GL11.glEnable(GL11.GL_LIGHTING);
      return;
    }
  }
예제 #4
0
  public void renderGameOverlay(float var1, boolean var2, int var3, int var4) {
    // Spout Start
    SpoutClient.getInstance().onTick();
    InGameHUD mainScreen = SpoutClient.getInstance().getActivePlayer().getMainScreen();
    // Spout End
    ScaledResolution var5 =
        new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
    int var6 = var5.getScaledWidth();
    int var7 = var5.getScaledHeight();
    FontRenderer var8 = this.mc.fontRenderer;
    this.mc.entityRenderer.func_905_b();
    GL11.glEnable(3042 /*GL_BLEND*/);
    if (Minecraft.isFancyGraphicsEnabled()) {
      this.renderVignette(this.mc.thePlayer.getEntityBrightness(var1), var6, var7);
    }

    ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3);
    if (!this.mc.gameSettings.thirdPersonView
        && var9 != null
        && var9.itemID == Block.pumpkin.blockID) {
      this.renderPumpkinBlur(var6, var7);
    }

    float var10 =
        this.mc.thePlayer.prevTimeInPortal
            + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * var1;
    if (var10 > 0.0F) {
      this.renderPortalOverlay(var10, var6, var7);
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, this.mc.renderEngine.getTexture("/gui/gui.png"));
    InventoryPlayer var11 = this.mc.thePlayer.inventory;
    this.zLevel = -90.0F;
    this.drawTexturedModalRect(var6 / 2 - 91, var7 - 22, 0, 0, 182, 22);
    this.drawTexturedModalRect(
        var6 / 2 - 91 - 1 + var11.currentItem * 20, var7 - 22 - 1, 0, 22, 24, 22);
    GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, this.mc.renderEngine.getTexture("/gui/icons.png"));
    GL11.glEnable(3042 /*GL_BLEND*/);
    GL11.glBlendFunc(775, 769);
    this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16);
    GL11.glDisable(3042 /*GL_BLEND*/);
    boolean var12 = this.mc.thePlayer.heartsLife / 3 % 2 == 1;
    if (this.mc.thePlayer.heartsLife < 10) {
      var12 = false;
    }

    int var13 = this.mc.thePlayer.health;
    int var14 = this.mc.thePlayer.prevHealth;
    this.rand.setSeed((long) (this.updateCounter * 312871));
    int var15;
    int var17;
    int var16;
    if (this.mc.playerController.shouldDrawHUD()) {
      var15 = this.mc.thePlayer.getPlayerArmorValue();

      int var18;
      for (var16 = 0; var16 < 10; ++var16) {
        var17 = var7 - 32;
        // Spout Start
        if (mainScreen.getArmorBar().isVisible()) {
          if (var15 > 0) {
            var18 = var6 / 2 + 91 - var16 * 8 - 9;
            if (var16 * 2 + 1 < var15) {
              this.drawTexturedModalRect(var18, var17, 34, 9, 9, 9);
            }

            if (var16 * 2 + 1 == var15) {
              this.drawTexturedModalRect(var18, var17, 25, 9, 9, 9);
            }

            if (var16 * 2 + 1 > var15) {
              this.drawTexturedModalRect(var18, var17, 16, 9, 9, 9);
            }
          }
        }
        // Spout End
        byte var31 = 0;
        if (var12) {
          var31 = 1;
        }

        int var19 = var6 / 2 - 91 + var16 * 8;
        if (var13 <= 4) {
          var17 += this.rand.nextInt(2);
        }
        // Spout Start
        if (mainScreen.getHealthBar().isVisible()) {
          this.drawTexturedModalRect(var19, var17, 16 + var31 * 9, 0, 9, 9);
          if (var12) {
            if (var16 * 2 + 1 < var14) {
              this.drawTexturedModalRect(var19, var17, 70, 0, 9, 9);
            }
            if (var16 * 2 + 1 == var14) {
              this.drawTexturedModalRect(var19, var17, 79, 0, 9, 9);
            }
          }

          if (var16 * 2 + 1 < var13) {
            this.drawTexturedModalRect(var19, var17, 52, 0, 9, 9);
          }

          if (var16 * 2 + 1 == var13) {
            this.drawTexturedModalRect(var19, var17, 61, 0, 9, 9);
          }
        }
        // Spout End
      }

      if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) {
        // Spout Start
        var16 =
            (int) Math.ceil(((double) (mc.thePlayer.air - 2) * 10D) / (mc.thePlayer.maxAir * 1D));
        var17 =
            (int) Math.ceil(((double) mc.thePlayer.air * 10D) / (mc.thePlayer.maxAir * 1D)) - var16;
        if (mainScreen.getBubbleBar().isVisible()) {
          for (var18 = 0; var18 < var16 + var17; ++var18) {
            if (var18 < var16) {
              this.drawTexturedModalRect(var6 / 2 - 91 + var18 * 8, var7 - 32 - 9, 16, 18, 9, 9);
            } else {
              this.drawTexturedModalRect(var6 / 2 - 91 + var18 * 8, var7 - 32 - 9, 25, 18, 9, 9);
            }
          }
        }
        // Spout End
      }
    }

    GL11.glDisable(3042 /*GL_BLEND*/);
    GL11.glEnable('\u803a');
    GL11.glPushMatrix();
    GL11.glRotatef(120.0F, 1.0F, 0.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();

    for (var15 = 0; var15 < 9; ++var15) {
      var16 = var6 / 2 - 90 + var15 * 20 + 2;
      var17 = var7 - 16 - 3;
      this.renderInventorySlot(var15, var16, var17, var1);
    }

    RenderHelper.disableStandardItemLighting();
    GL11.glDisable('\u803a');
    if (this.mc.thePlayer.func_22060_M() > 0) {
      GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
      GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
      var15 = this.mc.thePlayer.func_22060_M();
      float var26 = (float) var15 / 100.0F;
      if (var26 > 1.0F) {
        var26 = 1.0F - (float) (var15 - 100) / 10.0F;
      }

      var17 = (int) (220.0F * var26) << 24 | 1052704;
      this.drawRect(0, 0, var6, var7, var17);
      GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
      GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
    }
    // Spout Start
    mainScreen.render();
    // Spout End
    String var23;
    if (this.mc.gameSettings.showDebugInfo) {
      GL11.glPushMatrix();
      if (Minecraft.hasPaidCheckTime > 0L) {
        GL11.glTranslatef(0.0F, 32.0F, 0.0F);
      }

      var8.drawStringWithShadow("Minecraft Beta 1.7.3 (" + this.mc.debug + ")", 2, 2, 16777215);
      var8.drawStringWithShadow(this.mc.func_6241_m(), 2, 12, 16777215);
      var8.drawStringWithShadow(this.mc.func_6262_n(), 2, 22, 16777215);
      var8.drawStringWithShadow(this.mc.func_6245_o(), 2, 32, 16777215);
      var8.drawStringWithShadow(this.mc.func_21002_o(), 2, 42, 16777215);
      long var25 = Runtime.getRuntime().maxMemory();
      long var30 = Runtime.getRuntime().totalMemory();
      long var29 = Runtime.getRuntime().freeMemory();
      long var21 = var30 - var29;
      var23 =
          "Used memory: "
              + var21 * 100L / var25
              + "% ("
              + var21 / 1024L / 1024L
              + "MB) of "
              + var25 / 1024L / 1024L
              + "MB";
      this.drawString(var8, var23, var6 - var8.getStringWidth(var23) - 2, 2, 14737632);
      var23 = "Allocated memory: " + var30 * 100L / var25 + "% (" + var30 / 1024L / 1024L + "MB)";
      this.drawString(var8, var23, var6 - var8.getStringWidth(var23) - 2, 12, 14737632);
      // Spout Start
      // No Cheating!
      if (SpoutClient.getInstance().isCheatMode()) {
        this.drawString(var8, "x: " + this.mc.thePlayer.posX, 2, 64, 14737632);
        this.drawString(var8, "y: " + this.mc.thePlayer.posY, 2, 72, 14737632);
        this.drawString(var8, "z: " + this.mc.thePlayer.posZ, 2, 80, 14737632);
        this.drawString(
            var8,
            "f: "
                + (MathHelper.floor_double(
                        (double) (this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D)
                    & 3),
            2,
            88,
            14737632);
      }
      // Spout End
      // Spout Start
      this.drawString(var8, "Map Data Info", 2, 64, 14737632);
      this.drawString(
          var8,
          "Average packet size: " + ChunkCache.averageChunkSize.get() + " bytes",
          2,
          72,
          14737632);
      this.drawString(
          var8, "Cache hit percent: " + ChunkCache.hitPercentage.get(), 2, 80, 14737632);
      // Spout end
      GL11.glPopMatrix();
    }

    if (this.recordPlayingUpFor > 0) {
      float var24 = (float) this.recordPlayingUpFor - var1;
      var16 = (int) (var24 * 256.0F / 20.0F);
      if (var16 > 255) {
        var16 = 255;
      }

      if (var16 > 0) {
        GL11.glPushMatrix();
        GL11.glTranslatef((float) (var6 / 2), (float) (var7 - 48), 0.0F);
        GL11.glEnable(3042 /*GL_BLEND*/);
        GL11.glBlendFunc(770, 771);
        var17 = 16777215;
        if (this.field_22065_l) {
          var17 = Color.HSBtoRGB(var24 / 50.0F, 0.7F, 0.6F) & 16777215;
        }

        var8.drawString(
            this.recordPlaying,
            -var8.getStringWidth(this.recordPlaying) / 2,
            -4,
            var17 + (var16 << 24));
        GL11.glDisable(3042 /*GL_BLEND*/);
        GL11.glPopMatrix();
      }
    }

    byte var27 = 10;
    boolean var28 = false;
    // Spout Start
    if (mainScreen.getChatBar().isVisible()) {
      if (mc.currentScreen instanceof GuiChat) {
        var27 = 20;
        var28 = true;
      }
    }
    boolean chatOpen = var28;
    int lines =
        chatOpen
            ? mainScreen.getChatTextBox().getNumVisibleChatLines()
            : mainScreen.getChatTextBox().getNumVisibleLines();
    // Spout End

    GL11.glEnable(3042 /*GL_BLEND*/);
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, (float) (var7 - 48), 0.0F);

    // Spout Start

    if (mainScreen.getChatTextBox().isVisible()) {
      Math.max(
          0,
          chatMessageList.size()
              - SpoutClient.getInstance().getChatManager().chatScroll
              - 1
              - var27);
      int viewedLine = 0;

      for (int line = SpoutClient.getInstance().getChatManager().chatScroll;
          line
              < Math.min(
                  chatMessageList.size() - 1,
                  (lines + SpoutClient.getInstance().getChatManager().chatScroll));
          line++) {
        if (chatOpen || chatMessageList.get(line).updateCounter < 250) {
          double opacity = 1.0D - chatMessageList.get(line).updateCounter / 250D;
          opacity *= 10D;
          if (opacity < 0.0D) {
            opacity = 0.0D;
          }
          if (opacity > 1.0D) {
            opacity = 1.0D;
          }
          opacity *= opacity;
          int color = chatOpen ? 255 : (int) (255D * opacity);
          if (color > 0) {
            int height = 2;
            int width = -viewedLine * 9;
            String chat = chatMessageList.get(line).message;
            chat = SpoutClient.getInstance().getChatManager().formatChatColors(chat);
            chat = ChatManager.formatUrl(chat);
            // TODO add support for opening URL in browser if clicked?
            drawRect(height, width - 1, height + 320, width + 8, color / 2 << 24);
            GL11.glEnable(3042 /*GL_BLEND*/);
            var8.drawStringWithShadow(chat, height, width, 0xffffff + (color << 24));
          }
          viewedLine++;
        }
      }
    }
    // Spout End

    GL11.glPopMatrix();
    GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
    GL11.glDisable(3042 /*GL_BLEND*/);
  }
예제 #5
0
  public void renderItemInFirstPerson(float par1) {
    float var2 =
        this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * par1;
    EntityPlayerSP var3 = this.mc.thePlayer;
    float var4 = var3.prevRotationPitch + (var3.rotationPitch - var3.prevRotationPitch) * par1;
    GL11.glPushMatrix();
    GL11.glRotatef(var4, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(
        var3.prevRotationYaw + (var3.rotationYaw - var3.prevRotationYaw) * par1, 0.0F, 1.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();
    float var6;
    float var7;
    if (var3 instanceof EntityPlayerSP) {
      EntityPlayerSP var5 = (EntityPlayerSP) var3;
      var6 = var5.prevRenderArmPitch + (var5.renderArmPitch - var5.prevRenderArmPitch) * par1;
      var7 = var5.prevRenderArmYaw + (var5.renderArmYaw - var5.prevRenderArmYaw) * par1;
      GL11.glRotatef((var3.rotationPitch - var6) * 0.1F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef((var3.rotationYaw - var7) * 0.1F, 0.0F, 1.0F, 0.0F);
    }

    ItemStack var14 = this.itemToRender;
    var6 =
        this.mc.theWorld.getLightBrightness(
            MathHelper.floor_double(var3.posX),
            MathHelper.floor_double(var3.posY),
            MathHelper.floor_double(var3.posZ));
    var6 = 1.0F;
    int var15 =
        this.mc.theWorld.getLightBrightnessForSkyBlocks(
            MathHelper.floor_double(var3.posX),
            MathHelper.floor_double(var3.posY),
            MathHelper.floor_double(var3.posZ),
            0);
    int var8 = var15 % 65536;
    int var9 = var15 / 65536;
    OpenGlHelper.setLightmapTextureCoords(
        OpenGlHelper.lightmapTexUnit, (float) var8 / 1.0F, (float) var9 / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float var10;
    float var17;
    float var18;
    if (var14 != null) {
      var15 = Item.itemsList[var14.itemID].getColorFromDamage(var14.getItemDamage(), 0);
      var17 = (float) (var15 >> 16 & 255) / 255.0F;
      var18 = (float) (var15 >> 8 & 255) / 255.0F;
      var10 = (float) (var15 & 255) / 255.0F;
      GL11.glColor4f(var6 * var17, var6 * var18, var6 * var10, 1.0F);
    } else {
      GL11.glColor4f(var6, var6, var6, 1.0F);
    }

    float var11;
    float var13;
    if (var14 != null && var14.itemID == Item.map.shiftedIndex) {
      GL11.glPushMatrix();
      var7 = 0.8F;
      var17 = var3.getSwingProgress(par1);
      var18 = MathHelper.sin(var17 * (float) Math.PI);
      var10 = MathHelper.sin(MathHelper.sqrt_float(var17) * (float) Math.PI);
      GL11.glTranslatef(
          -var10 * 0.4F,
          MathHelper.sin(MathHelper.sqrt_float(var17) * (float) Math.PI * 2.0F) * 0.2F,
          -var18 * 0.2F);
      var17 = 1.0F - var4 / 45.0F + 0.1F;
      if (var17 < 0.0F) {
        var17 = 0.0F;
      }

      if (var17 > 1.0F) {
        var17 = 1.0F;
      }

      var17 = -MathHelper.cos(var17 * (float) Math.PI) * 0.5F + 0.5F;
      GL11.glTranslatef(
          0.0F, 0.0F * var7 - (1.0F - var2) * 1.2F - var17 * 0.5F + 0.04F, -0.9F * var7);
      GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(var17 * -85.0F, 0.0F, 0.0F, 1.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          this.mc.renderEngine.getTextureForDownloadableImage(
              this.mc.thePlayer.skinUrl, this.mc.thePlayer.getTexture()));

      for (var9 = 0; var9 < 2; ++var9) {
        int var25 = var9 * 2 - 1;
        GL11.glPushMatrix();
        GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float) var25);
        GL11.glRotatef((float) (-45 * var25), 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef((float) (-65 * var25), 0.0F, 1.0F, 0.0F);
        Render var21 = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
        RenderPlayer var24 = (RenderPlayer) var21;
        var13 = 1.0F;
        GL11.glScalef(var13, var13, var13);
        var24.drawFirstPersonHand();
        GL11.glPopMatrix();
      }

      var18 = var3.getSwingProgress(par1);
      var10 = MathHelper.sin(var18 * var18 * (float) Math.PI);
      var11 = MathHelper.sin(MathHelper.sqrt_float(var18) * (float) Math.PI);
      GL11.glRotatef(-var10 * 20.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-var11 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-var11 * 80.0F, 1.0F, 0.0F, 0.0F);
      var18 = 0.38F;
      GL11.glScalef(var18, var18, var18);
      GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
      var10 = 0.015625F;
      GL11.glScalef(var10, var10, var10);
      this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/misc/mapbg.png"));
      Tessellator var26 = Tessellator.instance;
      GL11.glNormal3f(0.0F, 0.0F, -1.0F);
      var26.startDrawingQuads();
      byte var27 = 7;
      var26.addVertexWithUV((double) (0 - var27), (double) (128 + var27), 0.0D, 0.0D, 1.0D);
      var26.addVertexWithUV((double) (128 + var27), (double) (128 + var27), 0.0D, 1.0D, 1.0D);
      var26.addVertexWithUV((double) (128 + var27), (double) (0 - var27), 0.0D, 1.0D, 0.0D);
      var26.addVertexWithUV((double) (0 - var27), (double) (0 - var27), 0.0D, 0.0D, 0.0D);
      var26.draw();
      MapData var23 = Item.map.getMapData(var14, this.mc.theWorld);
      this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, var23);
      GL11.glPopMatrix();
    } else if (var14 != null) {
      GL11.glPushMatrix();
      var7 = 0.8F;
      float var12;
      if (var3.getItemInUseCount() > 0) {
        EnumAction var16 = var14.getItemUseAction();
        if (var16 == EnumAction.eat || var16 == EnumAction.drink) {
          var18 = (float) var3.getItemInUseCount() - par1 + 1.0F;
          var10 = 1.0F - var18 / (float) var14.getMaxItemUseDuration();
          var12 = 1.0F - var10;
          var12 = var12 * var12 * var12;
          var12 = var12 * var12 * var12;
          var12 = var12 * var12 * var12;
          var13 = 1.0F - var12;
          GL11.glTranslatef(
              0.0F,
              MathHelper.abs(MathHelper.cos(var18 / 4.0F * (float) Math.PI) * 0.1F)
                  * (float) ((double) var10 > 0.2D ? 1 : 0),
              0.0F);
          GL11.glTranslatef(var13 * 0.6F, -var13 * 0.5F, 0.0F);
          GL11.glRotatef(var13 * 90.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(var13 * 10.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(var13 * 30.0F, 0.0F, 0.0F, 1.0F);
        }
      } else {
        var17 = var3.getSwingProgress(par1);
        var18 = MathHelper.sin(var17 * (float) Math.PI);
        var10 = MathHelper.sin(MathHelper.sqrt_float(var17) * (float) Math.PI);
        GL11.glTranslatef(
            -var10 * 0.4F,
            MathHelper.sin(MathHelper.sqrt_float(var17) * (float) Math.PI * 2.0F) * 0.2F,
            -var18 * 0.2F);
      }

      GL11.glTranslatef(0.7F * var7, -0.65F * var7 - (1.0F - var2) * 0.6F, -0.9F * var7);
      GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      var17 = var3.getSwingProgress(par1);
      var18 = MathHelper.sin(var17 * var17 * (float) Math.PI);
      var10 = MathHelper.sin(MathHelper.sqrt_float(var17) * (float) Math.PI);
      GL11.glRotatef(-var18 * 20.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-var10 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-var10 * 80.0F, 1.0F, 0.0F, 0.0F);
      var17 = 0.4F;
      GL11.glScalef(var17, var17, var17);
      if (var3.getItemInUseCount() > 0) {
        EnumAction var20 = var14.getItemUseAction();
        if (var20 == EnumAction.block) {
          GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
          GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
        } else if (var20 == EnumAction.bow) {
          GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F);
          GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
          var10 =
              (float) var14.getMaxItemUseDuration()
                  - ((float) var3.getItemInUseCount() - par1 + 1.0F);
          var11 = var10 / 20.0F;
          var11 = (var11 * var11 + var11 * 2.0F) / 3.0F;
          if (var11 > 1.0F) {
            var11 = 1.0F;
          }

          if (var11 > 0.1F) {
            GL11.glTranslatef(
                0.0F, MathHelper.sin((var10 - 0.1F) * 1.3F) * 0.01F * (var11 - 0.1F), 0.0F);
          }

          GL11.glTranslatef(0.0F, 0.0F, var11 * 0.1F);
          GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glTranslatef(0.0F, 0.5F, 0.0F);
          var12 = 1.0F + var11 * 0.2F;
          GL11.glScalef(1.0F, 1.0F, var12);
          GL11.glTranslatef(0.0F, -0.5F, 0.0F);
          GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
        }
      }

      if (var14.getItem().shouldRotateAroundWhenRendering()) {
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
      }

      if (var14.getItem().func_46058_c()) {
        this.renderItem(var3, var14, 0);
        var9 = Item.itemsList[var14.itemID].getColorFromDamage(var14.getItemDamage(), 1);
        var10 = (float) (var9 >> 16 & 255) / 255.0F;
        var11 = (float) (var9 >> 8 & 255) / 255.0F;
        var12 = (float) (var9 & 255) / 255.0F;
        GL11.glColor4f(var6 * var10, var6 * var11, var6 * var12, 1.0F);
        this.renderItem(var3, var14, 1);
      } else {
        this.renderItem(var3, var14, 0);
      }

      GL11.glPopMatrix();
    } else {
      GL11.glPushMatrix();
      var7 = 0.8F;
      var17 = var3.getSwingProgress(par1);
      var18 = MathHelper.sin(var17 * (float) Math.PI);
      var10 = MathHelper.sin(MathHelper.sqrt_float(var17) * (float) Math.PI);
      GL11.glTranslatef(
          -var10 * 0.3F,
          MathHelper.sin(MathHelper.sqrt_float(var17) * (float) Math.PI * 2.0F) * 0.4F,
          -var18 * 0.4F);
      GL11.glTranslatef(0.8F * var7, -0.75F * var7 - (1.0F - var2) * 0.6F, -0.9F * var7);
      GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      var17 = var3.getSwingProgress(par1);
      var18 = MathHelper.sin(var17 * var17 * (float) Math.PI);
      var10 = MathHelper.sin(MathHelper.sqrt_float(var17) * (float) Math.PI);
      GL11.glRotatef(var10 * 70.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-var18 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          this.mc.renderEngine.getTextureForDownloadableImage(
              this.mc.thePlayer.skinUrl, this.mc.thePlayer.getTexture()));
      GL11.glTranslatef(-1.0F, 3.6F, 3.5F);
      GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
      GL11.glScalef(1.0F, 1.0F, 1.0F);
      GL11.glTranslatef(5.6F, 0.0F, 0.0F);
      Render var19 = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
      RenderPlayer var22 = (RenderPlayer) var19;
      var10 = 1.0F;
      GL11.glScalef(var10, var10, var10);
      var22.drawFirstPersonHand();
      GL11.glPopMatrix();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.disableStandardItemLighting();
  }
예제 #6
0
  /** Renders the dragon, along with its dying animation */
  public void renderDragon(
      EntityDragon par1EntityDragon,
      double par2,
      double par4,
      double par6,
      float par8,
      float par9) {
    entityDragon = par1EntityDragon;

    if (updateModelState != 4) {
      mainModel = new ModelDragon(0.0F);
      updateModelState = 4;
    }

    super.doRenderLiving(par1EntityDragon, par2, par4, par6, par8, par9);

    if (par1EntityDragon.healingEnderCrystal != null) {
      float f = (float) par1EntityDragon.healingEnderCrystal.innerRotation + par9;
      float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F;
      f1 = (f1 * f1 + f1) * 0.2F;
      float f2 =
          (float)
              (par1EntityDragon.healingEnderCrystal.posX
                  - par1EntityDragon.posX
                  - (par1EntityDragon.prevPosX - par1EntityDragon.posX) * (double) (1.0F - par9));
      float f3 =
          (float)
              (((double) f1 + par1EntityDragon.healingEnderCrystal.posY)
                  - 1.0D
                  - par1EntityDragon.posY
                  - (par1EntityDragon.prevPosY - par1EntityDragon.posY) * (double) (1.0F - par9));
      float f4 =
          (float)
              (par1EntityDragon.healingEnderCrystal.posZ
                  - par1EntityDragon.posZ
                  - (par1EntityDragon.prevPosZ - par1EntityDragon.posZ) * (double) (1.0F - par9));
      float f5 = MathHelper.sqrt_float(f2 * f2 + f4 * f4);
      float f6 = MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4);
      GL11.glPushMatrix();
      GL11.glTranslatef((float) par2, (float) par4 + 2.0F, (float) par6);
      GL11.glRotatef(
          ((float) (-Math.atan2(f4, f2)) * 180F) / (float) Math.PI - 90F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(
          ((float) (-Math.atan2(f5, f3)) * 180F) / (float) Math.PI - 90F, 1.0F, 0.0F, 0.0F);
      Tessellator tessellator = Tessellator.instance;
      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL11.GL_CULL_FACE);
      loadTexture("/mob/enderdragon/beam.png");
      GL11.glShadeModel(GL11.GL_SMOOTH);
      float f7 = 0.0F - ((float) par1EntityDragon.ticksExisted + par9) * 0.01F;
      float f8 =
          MathHelper.sqrt_float(f2 * f2 + f3 * f3 + f4 * f4) / 32F
              - ((float) par1EntityDragon.ticksExisted + par9) * 0.01F;
      tessellator.startDrawing(5);
      int i = 8;

      for (int j = 0; j <= i; j++) {
        float f9 = MathHelper.sin(((float) (j % i) * (float) Math.PI * 2.0F) / (float) i) * 0.75F;
        float f10 = MathHelper.cos(((float) (j % i) * (float) Math.PI * 2.0F) / (float) i) * 0.75F;
        float f11 = ((float) (j % i) * 1.0F) / (float) i;
        tessellator.setColorOpaque_I(0);
        tessellator.addVertexWithUV(f9 * 0.2F, f10 * 0.2F, 0.0D, f11, f8);
        tessellator.setColorOpaque_I(0xffffff);
        tessellator.addVertexWithUV(f9, f10, f6, f11, f7);
      }

      tessellator.draw();
      GL11.glEnable(GL11.GL_CULL_FACE);
      GL11.glShadeModel(GL11.GL_FLAT);
      RenderHelper.enableStandardItemLighting();
      GL11.glPopMatrix();
    }
  }
예제 #7
0
  /** Render the ingame overlay with quick icon bar, ... */
  public void renderGameOverlay(float par1, boolean par2, int par3, int par4) {
    ScaledResolution var5 =
        new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);
    AxiomWrapper.scaledGui = var5;
    int var6 = var5.getScaledWidth();
    int var7 = var5.getScaledHeight();
    FontRenderer var8 = this.mc.fontRenderer;
    this.mc.entityRenderer.setupOverlayRendering();
    GL11.glEnable(GL11.GL_BLEND);

    if (Minecraft.isFancyGraphicsEnabled()) {
      this.renderVignette(this.mc.thePlayer.getBrightness(par1), var6, var7);
    } else {
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    }

    ItemStack var9 = this.mc.thePlayer.inventory.armorItemInSlot(3);

    if (this.mc.gameSettings.thirdPersonView == 0
        && var9 != null
        && var9.itemID == Block.pumpkin.blockID) {
      this.renderPumpkinBlur(var6, var7);
    }

    if (!this.mc.thePlayer.isPotionActive(Potion.confusion)) {
      float var10 =
          this.mc.thePlayer.prevTimeInPortal
              + (this.mc.thePlayer.timeInPortal - this.mc.thePlayer.prevTimeInPortal) * par1;

      if (var10 > 0.0F) {
        this.renderPortalOverlay(var10, var6, var7);
      }
    }

    int var11;
    int var12;
    int var13;
    int var14;
    int var15;
    int var17;
    int var16;
    int var19;
    int var18;
    byte var30;
    boolean var33;

    if (!this.mc.playerController.func_78747_a()) {
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/gui.png"));
      InventoryPlayer var20 = this.mc.thePlayer.inventory;
      this.zLevel = -90.0F;
      this.drawTexturedModalRect(var6 / 2 - 91, var7 - 22, 0, 0, 182, 22);
      this.drawTexturedModalRect(
          var6 / 2 - 91 - 1 + var20.currentItem * 20, var7 - 22 - 1, 0, 22, 24, 22);
      GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/icons.png"));
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
      this.drawTexturedModalRect(var6 / 2 - 7, var7 / 2 - 7, 0, 0, 16, 16);
      GL11.glDisable(GL11.GL_BLEND);
      var33 = this.mc.thePlayer.hurtResistantTime / 3 % 2 == 1;

      if (this.mc.thePlayer.hurtResistantTime < 10) {
        var33 = false;
      }

      var11 = this.mc.thePlayer.getHealth();
      var12 = this.mc.thePlayer.prevHealth;
      this.rand.setSeed((long) (this.updateCounter * 312871));
      boolean var21 = false;
      FoodStats var22 = this.mc.thePlayer.getFoodStats();
      var14 = var22.getFoodLevel();
      var13 = var22.getPrevFoodLevel();
      this.mc.mcProfiler.startSection("bossHealth");
      this.renderBossHealth();
      this.mc.mcProfiler.endSection();
      int var23;

      if (this.mc.playerController.shouldDrawHUD()) {
        var23 = var6 / 2 - 91;
        var15 = var6 / 2 + 91;
        this.mc.mcProfiler.startSection("expBar");
        var16 = this.mc.thePlayer.xpBarCap();

        if (var16 > 0) {
          short var24 = 182;
          var18 = (int) (this.mc.thePlayer.experience * (float) (var24 + 1));
          var17 = var7 - 32 + 3;
          this.drawTexturedModalRect(var23, var17, 0, 64, var24, 5);

          if (var18 > 0) {
            this.drawTexturedModalRect(var23, var17, 0, 69, var18, 5);
          }
        }

        var19 = var7 - 39;
        var18 = var19 - 10;
        var17 = this.mc.thePlayer.getTotalArmorValue();
        int var41 = -1;

        if (this.mc.thePlayer.isPotionActive(Potion.regeneration)) {
          var41 = this.updateCounter % 25;
        }

        this.mc.mcProfiler.endStartSection("healthArmor");
        int var25;
        int var27;
        int var26;
        int var28;

        for (var25 = 0; var25 < 10; ++var25) {
          if (var17 > 0) {
            var26 = var23 + var25 * 8;

            if (var25 * 2 + 1 < var17) {
              this.drawTexturedModalRect(var26, var18, 34, 9, 9, 9);
            }

            if (var25 * 2 + 1 == var17) {
              this.drawTexturedModalRect(var26, var18, 25, 9, 9, 9);
            }

            if (var25 * 2 + 1 > var17) {
              this.drawTexturedModalRect(var26, var18, 16, 9, 9, 9);
            }
          }

          var26 = 16;

          if (this.mc.thePlayer.isPotionActive(Potion.poison)) {
            var26 += 36;
          }

          byte var29 = 0;

          if (var33) {
            var29 = 1;
          }

          var28 = var23 + var25 * 8;
          var27 = var19;

          if (var11 <= 4) {
            var27 = var19 + this.rand.nextInt(2);
          }

          if (var25 == var41) {
            var27 -= 2;
          }

          var30 = 0;

          if (this.mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) {
            var30 = 5;
          }

          this.drawTexturedModalRect(var28, var27, 16 + var29 * 9, 9 * var30, 9, 9);

          if (var33) {
            if (var25 * 2 + 1 < var12) {
              this.drawTexturedModalRect(var28, var27, var26 + 54, 9 * var30, 9, 9);
            }

            if (var25 * 2 + 1 == var12) {
              this.drawTexturedModalRect(var28, var27, var26 + 63, 9 * var30, 9, 9);
            }
          }

          if (var25 * 2 + 1 < var11) {
            this.drawTexturedModalRect(var28, var27, var26 + 36, 9 * var30, 9, 9);
          }

          if (var25 * 2 + 1 == var11) {
            this.drawTexturedModalRect(var28, var27, var26 + 45, 9 * var30, 9, 9);
          }
        }

        this.mc.mcProfiler.endStartSection("food");
        int var47;

        for (var25 = 0; var25 < 10; ++var25) {
          var26 = var19;
          var47 = 16;
          var30 = 0;

          if (this.mc.thePlayer.isPotionActive(Potion.hunger)) {
            var47 += 36;
            var30 = 13;
          }

          if (this.mc.thePlayer.getFoodStats().getSaturationLevel() <= 0.0F
              && this.updateCounter % (var14 * 3 + 1) == 0) {
            var26 = var19 + (this.rand.nextInt(3) - 1);
          }

          if (var21) {
            var30 = 1;
          }

          var27 = var15 - var25 * 8 - 9;
          this.drawTexturedModalRect(var27, var26, 16 + var30 * 9, 27, 9, 9);

          if (var21) {
            if (var25 * 2 + 1 < var13) {
              this.drawTexturedModalRect(var27, var26, var47 + 54, 27, 9, 9);
            }

            if (var25 * 2 + 1 == var13) {
              this.drawTexturedModalRect(var27, var26, var47 + 63, 27, 9, 9);
            }
          }

          if (var25 * 2 + 1 < var14) {
            this.drawTexturedModalRect(var27, var26, var47 + 36, 27, 9, 9);
          }

          if (var25 * 2 + 1 == var14) {
            this.drawTexturedModalRect(var27, var26, var47 + 45, 27, 9, 9);
          }
        }

        this.mc.mcProfiler.endStartSection("air");

        if (this.mc.thePlayer.isInsideOfMaterial(Material.water)) {
          var25 = this.mc.thePlayer.getAir();
          var26 = MathHelper.ceiling_double_int((double) (var25 - 2) * 10.0D / 300.0D);
          var47 = MathHelper.ceiling_double_int((double) var25 * 10.0D / 300.0D) - var26;

          for (var28 = 0; var28 < var26 + var47; ++var28) {
            if (var28 < var26) {
              this.drawTexturedModalRect(var15 - var28 * 8 - 9, var18, 16, 18, 9, 9);
            } else {
              this.drawTexturedModalRect(var15 - var28 * 8 - 9, var18, 25, 18, 9, 9);
            }
          }
        }

        this.mc.mcProfiler.endSection();
      }

      GL11.glDisable(GL11.GL_BLEND);
      this.mc.mcProfiler.startSection("actionBar");
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      RenderHelper.enableGUIStandardItemLighting();

      for (var23 = 0; var23 < 9; ++var23) {
        var15 = var6 / 2 - 90 + var23 * 20 + 2;
        var16 = var7 - 16 - 3;
        this.renderInventorySlot(var23, var15, var16, par1);
      }

      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
      this.mc.mcProfiler.endSection();
    }

    float var34;
    int var36;

    if (this.mc.thePlayer.getSleepTimer() > 0) {
      this.mc.mcProfiler.startSection("sleep");
      GL11.glDisable(GL11.GL_DEPTH_TEST);
      GL11.glDisable(GL11.GL_ALPHA_TEST);
      var36 = this.mc.thePlayer.getSleepTimer();
      var34 = (float) var36 / 100.0F;

      if (var34 > 1.0F) {
        var34 = 1.0F - (float) (var36 - 100) / 10.0F;
      }

      var11 = (int) (220.0F * var34) << 24 | 1052704;
      drawRect(0, 0, var6, var7, var11);
      GL11.glEnable(GL11.GL_ALPHA_TEST);
      GL11.glEnable(GL11.GL_DEPTH_TEST);
      this.mc.mcProfiler.endSection();
    }

    int var35;
    String var40;

    if (this.mc.playerController.func_78763_f() && this.mc.thePlayer.experienceLevel > 0) {
      this.mc.mcProfiler.startSection("expLevel");
      var33 = false;
      var11 = var33 ? 16777215 : 8453920;
      var40 = "" + this.mc.thePlayer.experienceLevel;
      var35 = (var6 - var8.getStringWidth(var40)) / 2;
      var36 = var7 - 31 - 4;
      var8.drawString(var40, var35 + 1, var36, 0);
      var8.drawString(var40, var35 - 1, var36, 0);
      var8.drawString(var40, var35, var36 + 1, 0);
      var8.drawString(var40, var35, var36 - 1, 0);
      var8.drawString(var40, var35, var36, var11);
      this.mc.mcProfiler.endSection();
    }

    if (this.mc.isDemo()) {
      this.mc.mcProfiler.startSection("demo");
      var40 = "";

      if (this.mc.theWorld.getWorldTime() >= 120500L) {
        var40 = StatCollector.translateToLocal("demo.demoExpired");
      } else {
        var40 =
            String.format(
                StatCollector.translateToLocal("demo.remainingTime"),
                new Object[] {
                  StringUtils.ticksToElapsedTime((int) (120500L - this.mc.theWorld.getWorldTime()))
                });
      }

      var11 = var8.getStringWidth(var40);
      var8.drawStringWithShadow(var40, var6 - var11 - 10, 5, 16777215);
      this.mc.mcProfiler.endSection();
    }

    if (this.mc.gameSettings.showDebugInfo) {
      this.mc.mcProfiler.startSection("debug");
      GL11.glPushMatrix();
      var8.drawStringWithShadow("Minecraft 1.3.2 (" + this.mc.debug + ")", 2, 2, 16777215);
      var8.drawStringWithShadow(this.mc.debugInfoRenders(), 2, 12, 16777215);
      var8.drawStringWithShadow(this.mc.getEntityDebug(), 2, 22, 16777215);
      var8.drawStringWithShadow(this.mc.debugInfoEntities(), 2, 32, 16777215);
      var8.drawStringWithShadow(this.mc.getWorldProviderName(), 2, 42, 16777215);
      long var38 = Runtime.getRuntime().maxMemory();
      long var42 = Runtime.getRuntime().totalMemory();
      long var45 = Runtime.getRuntime().freeMemory();
      long var49 = var42 - var45;
      String var31 =
          "Used memory: "
              + var49 * 100L / var38
              + "% ("
              + var49 / 1024L / 1024L
              + "MB) of "
              + var38 / 1024L / 1024L
              + "MB";
      this.drawString(var8, var31, var6 - var8.getStringWidth(var31) - 2, 2, 14737632);
      var31 = "Allocated memory: " + var42 * 100L / var38 + "% (" + var42 / 1024L / 1024L + "MB)";
      this.drawString(var8, var31, var6 - var8.getStringWidth(var31) - 2, 12, 14737632);
      this.drawString(
          var8,
          String.format("x: %.5f", new Object[] {Double.valueOf(this.mc.thePlayer.posX)}),
          2,
          64,
          14737632);
      this.drawString(
          var8,
          String.format(
              "y: %.3f (feet pos, %.3f eyes pos)",
              new Object[] {
                Double.valueOf(this.mc.thePlayer.boundingBox.minY),
                Double.valueOf(this.mc.thePlayer.posY)
              }),
          2,
          72,
          14737632);
      this.drawString(
          var8,
          String.format("z: %.5f", new Object[] {Double.valueOf(this.mc.thePlayer.posZ)}),
          2,
          80,
          14737632);
      this.drawString(
          var8,
          "f: "
              + (MathHelper.floor_double(
                      (double) (this.mc.thePlayer.rotationYaw * 4.0F / 360.0F) + 0.5D)
                  & 3),
          2,
          88,
          14737632);
      var19 = MathHelper.floor_double(this.mc.thePlayer.posX);
      var18 = MathHelper.floor_double(this.mc.thePlayer.posY);
      var17 = MathHelper.floor_double(this.mc.thePlayer.posZ);

      if (this.mc.theWorld != null && this.mc.theWorld.blockExists(var19, var18, var17)) {
        Chunk var32 = this.mc.theWorld.getChunkFromBlockCoords(var19, var17);
        this.drawString(
            var8,
            "lc: "
                + (var32.getTopFilledSegment() + 15)
                + " b: "
                + var32.getBiomeGenForWorldCoords(
                        var19 & 15, var17 & 15, this.mc.theWorld.getWorldChunkManager())
                    .biomeName
                + " bl: "
                + var32.getSavedLightValue(EnumSkyBlock.Block, var19 & 15, var18, var17 & 15)
                + " sl: "
                + var32.getSavedLightValue(EnumSkyBlock.Sky, var19 & 15, var18, var17 & 15)
                + " rl: "
                + var32.getBlockLightValue(var19 & 15, var18, var17 & 15, 0),
            2,
            96,
            14737632);
      }

      this.drawString(
          var8,
          String.format(
              "ws: %.3f, fs: %.3f, g: %b",
              new Object[] {
                Float.valueOf(this.mc.thePlayer.capabilities.getWalkSpeed()),
                Float.valueOf(this.mc.thePlayer.capabilities.getFlySpeed()),
                Boolean.valueOf(this.mc.thePlayer.onGround)
              }),
          2,
          104,
          14737632);
      GL11.glPopMatrix();
      this.mc.mcProfiler.endSection();
    } else {
      AxiomSetup.renderIGGUI();
    }

    if (this.recordPlayingUpFor > 0) {
      this.mc.mcProfiler.startSection("overlayMessage");
      var34 = (float) this.recordPlayingUpFor - par1;
      var11 = (int) (var34 * 256.0F / 20.0F);

      if (var11 > 255) {
        var11 = 255;
      }

      if (var11 > 0) {
        GL11.glPushMatrix();
        GL11.glTranslatef((float) (var6 / 2), (float) (var7 - 48), 0.0F);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        var12 = 16777215;

        if (this.recordIsPlaying) {
          var12 = Color.HSBtoRGB(var34 / 50.0F, 0.7F, 0.6F) & 16777215;
        }

        var8.drawString(
            this.recordPlaying,
            -var8.getStringWidth(this.recordPlaying) / 2,
            -4,
            var12 + (var11 << 24));
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glPopMatrix();
      }

      this.mc.mcProfiler.endSection();
    }

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, (float) (var7 - 48), 0.0F);
    this.mc.mcProfiler.startSection("chat");
    this.persistantChatGUI.func_73762_a(this.updateCounter);
    this.mc.mcProfiler.endSection();
    GL11.glPopMatrix();

    if (this.mc.gameSettings.keyBindPlayerList.pressed
        && (!this.mc.isIntegratedServerRunning()
            || this.mc.thePlayer.sendQueue.playerInfoList.size() > 1)) {
      this.mc.mcProfiler.startSection("playerList");
      NetClientHandler var39 = this.mc.thePlayer.sendQueue;
      List var37 = var39.playerInfoList;
      var12 = var39.currentServerMaxPlayers;
      var35 = var12;

      for (var36 = 1; var35 > 20; var35 = (var12 + var36 - 1) / var36) {
        ++var36;
      }

      var14 = 300 / var36;

      if (var14 > 150) {
        var14 = 150;
      }

      var13 = (var6 - var36 * var14) / 2;
      byte var43 = 10;
      drawRect(var13 - 1, var43 - 1, var13 + var14 * var36, var43 + 9 * var35, Integer.MIN_VALUE);

      for (var15 = 0; var15 < var12; ++var15) {
        var16 = var13 + var15 % var36 * var14;
        var19 = var43 + var15 / var36 * 9;
        drawRect(var16, var19, var16 + var14 - 1, var19 + 8, 553648127);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(GL11.GL_ALPHA_TEST);

        if (var15 < var37.size()) {
          GuiPlayerInfo var48 = (GuiPlayerInfo) var37.get(var15);
          String var44 = AxiomHook.tabListNameSetHook(var48.name);
          var8.drawStringWithShadow(var44, var16, var19, 16777215);
          this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/gui/icons.png"));
          byte var46 = 0;
          boolean var50 = false;

          if (var48.responseTime < 0) {
            var30 = 5;
          } else if (var48.responseTime < 150) {
            var30 = 0;
          } else if (var48.responseTime < 300) {
            var30 = 1;
          } else if (var48.responseTime < 600) {
            var30 = 2;
          } else if (var48.responseTime < 1000) {
            var30 = 3;
          } else {
            var30 = 4;
          }

          this.zLevel += 100.0F;
          this.drawTexturedModalRect(
              var16 + var14 - 12, var19, 0 + var46 * 10, 176 + var30 * 8, 10, 8);
          this.zLevel -= 100.0F;
        }
      }
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
  }
예제 #8
0
  public void renderGameOverlay(float f, boolean flag, int i, int j) {
    ScaledResolution scaledresolution =
        new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
    int k = scaledresolution.getScaledWidth();
    int l = scaledresolution.getScaledHeight();
    FontRenderer fontrenderer = mc.fontRenderer;
    mc.entityRenderer.setupOverlayRendering();
    GL11.glEnable(3042 /*GL_BLEND*/);
    if (Minecraft.isFancyGraphicsEnabled()) {
      renderVignette(mc.thePlayer.getEntityBrightness(f), k, l);
    } else {
      GL11.glBlendFunc(770, 771);
    }
    ItemStack itemstack = mc.thePlayer.inventory.armorItemInSlot(3);
    if (mc.gameSettings.thirdPersonView == 0
        && itemstack != null
        && itemstack.itemID == Block.pumpkin.blockID) {
      renderPumpkinBlur(k, l);
    }
    if (!mc.thePlayer.isPotionActive(Potion.confusion)) {
      float f1 =
          mc.thePlayer.prevTimeInPortal
              + (mc.thePlayer.timeInPortal - mc.thePlayer.prevTimeInPortal) * f;
      if (f1 > 0.0F) {
        renderPortalOverlay(f1, k, l);
      }
    }
    if (!mc.playerController.func_35643_e()) {
      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
      GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/gui.png"));
      InventoryPlayer inventoryplayer = mc.thePlayer.inventory;
      zLevel = -90F;
      drawTexturedModalRect(k / 2 - 91, l - 22, 0, 0, 182, 22);
      drawTexturedModalRect(
          (k / 2 - 91 - 1) + inventoryplayer.currentItem * 20, l - 22 - 1, 0, 22, 24, 22);
      GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, mc.renderEngine.getTexture("/gui/icons.png"));
      GL11.glEnable(3042 /*GL_BLEND*/);
      GL11.glBlendFunc(775, 769);
      drawTexturedModalRect(k / 2 - 7, l / 2 - 7, 0, 0, 16, 16);
      GL11.glDisable(3042 /*GL_BLEND*/);
      boolean flag2 = (mc.thePlayer.heartsLife / 3) % 2 == 1;
      if (mc.thePlayer.heartsLife < 10) {
        flag2 = false;
      }
      int i2 = mc.thePlayer.getEntityHealth();
      int j3 = mc.thePlayer.prevHealth;
      rand.setSeed(updateCounter * 0x4c627);
      boolean flag4 = false;
      FoodStats foodstats = mc.thePlayer.getFoodStats();
      int i5 = foodstats.getFoodLevel();
      int k5 = foodstats.getPrevFoodLevel();
      renderBossHealth();
      if (mc.playerController.shouldDrawHUD()) {
        int k6 = k / 2 - 91;
        int j7 = k / 2 + 91;
        int l7 = mc.thePlayer.xpBarCap();
        if (l7 > 0) {
          char c = '\266';
          int i9 = (int) (mc.thePlayer.currentXP * (float) (c + 1));
          int l9 = (l - 32) + 3;
          drawTexturedModalRect(k6, l9, 0, 64, c, 5);
          if (i9 > 0) {
            drawTexturedModalRect(k6, l9, 0, 69, i9, 5);
          }
        }
        int k8 = l - 39;
        int j9 = k8 - 10;
        int i10 = mc.thePlayer.getPlayerArmorValue();
        int j10 = -1;
        if (mc.thePlayer.isPotionActive(Potion.regeneration)) {
          j10 = updateCounter % 25;
        }
        for (int l10 = 0; l10 < 10; l10++) {
          if (i10 > 0) {
            int k11 = k6 + l10 * 8;
            if (l10 * 2 + 1 < i10) {
              drawTexturedModalRect(k11, j9, 34, 9, 9, 9);
            }
            if (l10 * 2 + 1 == i10) {
              drawTexturedModalRect(k11, j9, 25, 9, 9, 9);
            }
            if (l10 * 2 + 1 > i10) {
              drawTexturedModalRect(k11, j9, 16, 9, 9, 9);
            }
          }
          int l11 = 16;
          if (mc.thePlayer.isPotionActive(Potion.poison)) {
            l11 += 36;
          }
          int k12 = 0;
          if (flag2) {
            k12 = 1;
          }
          int j13 = k6 + l10 * 8;
          int k13 = k8;
          if (i2 <= 4) {
            k13 += rand.nextInt(2);
          }
          if (l10 == j10) {
            k13 -= 2;
          }
          byte byte5 = 0;
          if (mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) {
            byte5 = 5;
          }
          drawTexturedModalRect(j13, k13, 16 + k12 * 9, 9 * byte5, 9, 9);
          if (flag2) {
            if (l10 * 2 + 1 < j3) {
              drawTexturedModalRect(j13, k13, l11 + 54, 9 * byte5, 9, 9);
            }
            if (l10 * 2 + 1 == j3) {
              drawTexturedModalRect(j13, k13, l11 + 63, 9 * byte5, 9, 9);
            }
          }
          if (l10 * 2 + 1 < i2) {
            drawTexturedModalRect(j13, k13, l11 + 36, 9 * byte5, 9, 9);
          }
          if (l10 * 2 + 1 == i2) {
            drawTexturedModalRect(j13, k13, l11 + 45, 9 * byte5, 9, 9);
          }
        }

        for (int i11 = 0; i11 < 10; i11++) {
          int i12 = k8;
          int l12 = 16;
          byte byte4 = 0;
          if (mc.thePlayer.isPotionActive(Potion.hunger)) {
            l12 += 36;
            byte4 = 13;
          }
          if (mc.thePlayer.getFoodStats().getFoodSaturationLevel() <= 0.0F
              && updateCounter % (i5 * 3 + 1) == 0) {
            i12 += rand.nextInt(3) - 1;
          }
          if (flag4) {
            byte4 = 1;
          }
          int l13 = j7 - i11 * 8 - 9;
          drawTexturedModalRect(l13, i12, 16 + byte4 * 9, 27, 9, 9);
          if (flag4) {
            if (i11 * 2 + 1 < k5) {
              drawTexturedModalRect(l13, i12, l12 + 54, 27, 9, 9);
            }
            if (i11 * 2 + 1 == k5) {
              drawTexturedModalRect(l13, i12, l12 + 63, 27, 9, 9);
            }
          }
          if (i11 * 2 + 1 < i5) {
            drawTexturedModalRect(l13, i12, l12 + 36, 27, 9, 9);
          }
          if (i11 * 2 + 1 == i5) {
            drawTexturedModalRect(l13, i12, l12 + 45, 27, 9, 9);
          }
        }

        if (mc.thePlayer.isInsideOfMaterial(Material.water)) {
          int j11 = (int) Math.ceil(((double) (mc.thePlayer.getAir() - 2) * 10D) / 300D);
          int j12 = (int) Math.ceil(((double) mc.thePlayer.getAir() * 10D) / 300D) - j11;
          for (int i13 = 0; i13 < j11 + j12; i13++) {
            if (i13 < j11) {
              drawTexturedModalRect(j7 - i13 * 8 - 9, j9, 16, 18, 9, 9);
            } else {
              drawTexturedModalRect(j7 - i13 * 8 - 9, j9, 25, 18, 9, 9);
            }
          }
        }
      }
      GL11.glDisable(3042 /*GL_BLEND*/);
      GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
      RenderHelper.func_41089_c();
      for (int l6 = 0; l6 < 9; l6++) {
        int k7 = (k / 2 - 90) + l6 * 20 + 2;
        int i8 = l - 16 - 3;
        renderInventorySlot(l6, k7, i8, f);
      }

      RenderHelper.disableStandardItemLighting();
      GL11.glDisable(32826 /*GL_RESCALE_NORMAL_EXT*/);
    }
    if (mc.thePlayer.getSleepTimer() > 0) {
      GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
      GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
      int i1 = mc.thePlayer.getSleepTimer();
      float f3 = (float) i1 / 100F;
      if (f3 > 1.0F) {
        f3 = 1.0F - (float) (i1 - 100) / 10F;
      }
      int j2 = (int) (220F * f3) << 24 | 0x101020;
      drawRect(0, 0, k, l, j2);
      GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
      GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
    }
    if (mc.playerController.func_35642_f() && mc.thePlayer.playerLevel > 0) {
      boolean flag1 = false;
      int j1 = flag1 ? 0xffffff : 0x80ff20;
      String s = (new StringBuilder()).append("").append(mc.thePlayer.playerLevel).toString();
      int k3 = (k - fontrenderer.getStringWidth(s)) / 2;
      int l3 = l - 31 - 4;
      fontrenderer.drawString(s, k3 + 1, l3, 0);
      fontrenderer.drawString(s, k3 - 1, l3, 0);
      fontrenderer.drawString(s, k3, l3 + 1, 0);
      fontrenderer.drawString(s, k3, l3 - 1, 0);
      fontrenderer.drawString(s, k3, l3, j1);
    }
    if (mc.gameSettings.showDebugInfo) {
      GL11.glPushMatrix();
      if (Minecraft.hasPaidCheckTime > 0L) {
        GL11.glTranslatef(0.0F, 32F, 0.0F);
      }
      fontrenderer.drawStringWithShadow(
          (new StringBuilder()).append("Minecraft 1.0.0 (").append(mc.debug).append(")").toString(),
          2,
          2,
          0xffffff);
      fontrenderer.drawStringWithShadow(mc.debugInfoRenders(), 2, 12, 0xffffff);
      fontrenderer.drawStringWithShadow(mc.func_6262_n(), 2, 22, 0xffffff);
      fontrenderer.drawStringWithShadow(mc.debugInfoEntities(), 2, 32, 0xffffff);
      fontrenderer.drawStringWithShadow(mc.func_21002_o(), 2, 42, 0xffffff);
      long l1 = Runtime.getRuntime().maxMemory();
      long l2 = Runtime.getRuntime().totalMemory();
      long l4 = Runtime.getRuntime().freeMemory();
      long l5 = l2 - l4;
      String s1 =
          (new StringBuilder())
              .append("Used memory: ")
              .append((l5 * 100L) / l1)
              .append("% (")
              .append(l5 / 1024L / 1024L)
              .append("MB) of ")
              .append(l1 / 1024L / 1024L)
              .append("MB")
              .toString();
      drawString(fontrenderer, s1, k - fontrenderer.getStringWidth(s1) - 2, 2, 0xe0e0e0);
      s1 =
          (new StringBuilder())
              .append("Allocated memory: ")
              .append((l2 * 100L) / l1)
              .append("% (")
              .append(l2 / 1024L / 1024L)
              .append("MB)")
              .toString();
      drawString(fontrenderer, s1, k - fontrenderer.getStringWidth(s1) - 2, 12, 0xe0e0e0);
      drawString(
          fontrenderer,
          (new StringBuilder()).append("x: ").append(mc.thePlayer.posX).toString(),
          2,
          64,
          0xe0e0e0);
      drawString(
          fontrenderer,
          (new StringBuilder()).append("y: ").append(mc.thePlayer.posY).toString(),
          2,
          72,
          0xe0e0e0);
      drawString(
          fontrenderer,
          (new StringBuilder()).append("z: ").append(mc.thePlayer.posZ).toString(),
          2,
          80,
          0xe0e0e0);
      drawString(
          fontrenderer,
          (new StringBuilder())
              .append("f: ")
              .append(
                  MathHelper.floor_double((double) ((mc.thePlayer.rotationYaw * 4F) / 360F) + 0.5D)
                      & 3)
              .toString(),
          2,
          88,
          0xe0e0e0);
      drawString(
          fontrenderer,
          (new StringBuilder()).append("Seed: ").append(mc.theWorld.getWorldSeed()).toString(),
          2,
          104,
          0xe0e0e0);
      GL11.glPopMatrix();
    }
    if (recordPlayingUpFor > 0) {
      float f2 = (float) recordPlayingUpFor - f;
      int k1 = (int) ((f2 * 256F) / 20F);
      if (k1 > 255) {
        k1 = 255;
      }
      if (k1 > 0) {
        GL11.glPushMatrix();
        GL11.glTranslatef(k / 2, l - 48, 0.0F);
        GL11.glEnable(3042 /*GL_BLEND*/);
        GL11.glBlendFunc(770, 771);
        int k2 = 0xffffff;
        if (recordIsPlaying) {
          k2 = Color.HSBtoRGB(f2 / 50F, 0.7F, 0.6F) & 0xffffff;
        }
        fontrenderer.drawString(
            recordPlaying, -fontrenderer.getStringWidth(recordPlaying) / 2, -4, k2 + (k1 << 24));
        GL11.glDisable(3042 /*GL_BLEND*/);
        GL11.glPopMatrix();
      }
    }
    byte byte0 = 10;
    boolean flag3 = false;
    if (mc.currentScreen instanceof GuiChat) {
      byte0 = 20;
      flag3 = true;
    }
    GL11.glEnable(3042 /*GL_BLEND*/);
    GL11.glBlendFunc(770, 771);
    GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, l - 48, 0.0F);
    for (int i3 = 0; i3 < chatMessageList.size() && i3 < byte0; i3++) {
      if (((ChatLine) chatMessageList.get(i3)).updateCounter >= 200 && !flag3) {
        continue;
      }
      double d = (double) ((ChatLine) chatMessageList.get(i3)).updateCounter / 200D;
      d = 1.0D - d;
      d *= 10D;
      if (d < 0.0D) {
        d = 0.0D;
      }
      if (d > 1.0D) {
        d = 1.0D;
      }
      d *= d;
      int j4 = (int) (255D * d);
      if (flag3) {
        j4 = 255;
      }
      if (j4 > 0) {
        byte byte1 = 2;
        int i6 = -i3 * 9;
        String s2 = ((ChatLine) chatMessageList.get(i3)).message;
        drawRect(byte1, i6 - 1, byte1 + 320, i6 + 8, j4 / 2 << 24);
        GL11.glEnable(3042 /*GL_BLEND*/);
        fontrenderer.drawStringWithShadow(s2, byte1, i6, 0xffffff + (j4 << 24));
      }
    }

    GL11.glPopMatrix();
    if ((mc.thePlayer instanceof EntityClientPlayerMP)
        && mc.gameSettings.keyBindPlayerList.pressed) {
      NetClientHandler netclienthandler = ((EntityClientPlayerMP) mc.thePlayer).sendQueue;
      java.util.List list = netclienthandler.playerNames;
      int i4 = netclienthandler.currentServerMaxPlayers;
      int k4 = i4;
      int j5 = 1;
      for (; k4 > 20; k4 = ((i4 + j5) - 1) / j5) {
        j5++;
      }

      int j6 = 300 / j5;
      if (j6 > 150) {
        j6 = 150;
      }
      int i7 = (k - j5 * j6) / 2;
      byte byte2 = 10;
      drawRect(i7 - 1, byte2 - 1, i7 + j6 * j5, byte2 + 9 * k4, 0x80000000);
      for (int j8 = 0; j8 < i4; j8++) {
        int l8 = i7 + (j8 % j5) * j6;
        int k9 = byte2 + (j8 / j5) * 9;
        drawRect(l8, k9, (l8 + j6) - 1, k9 + 8, 0x20ffffff);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
        if (j8 >= list.size()) {
          continue;
        }
        GuiSavingLevelString guisavinglevelstring = (GuiSavingLevelString) list.get(j8);
        fontrenderer.drawStringWithShadow(guisavinglevelstring.stringValue, l8, k9, 0xffffff);
        mc.renderEngine.bindTexture(mc.renderEngine.getTexture("/gui/icons.png"));
        int k10 = 0;
        byte byte3 = 0;
        k10 = 0;
        byte3 = 0;
        if (guisavinglevelstring.responseTime < 0) {
          byte3 = 5;
        } else if (guisavinglevelstring.responseTime < 150) {
          byte3 = 0;
        } else if (guisavinglevelstring.responseTime < 300) {
          byte3 = 1;
        } else if (guisavinglevelstring.responseTime < 600) {
          byte3 = 2;
        } else if (guisavinglevelstring.responseTime < 1000) {
          byte3 = 3;
        } else {
          byte3 = 4;
        }
        zLevel += 100F;
        drawTexturedModalRect((l8 + j6) - 12, k9, 0 + k10 * 10, 176 + byte3 * 8, 10, 8);
        zLevel -= 100F;
      }
    }
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(2896 /*GL_LIGHTING*/);
    GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
  }
예제 #9
0
  protected void genAchievementBackground(int par1, int par2, float par3) {
    int i = MathHelper.floor_double(field_27116_m + (guiMapX - field_27116_m) * (double) par3);
    int j = MathHelper.floor_double(field_27115_n + (guiMapY - field_27115_n) * (double) par3);

    if (i < guiMapTop) {
      i = guiMapTop;
    }

    if (j < guiMapLeft) {
      j = guiMapLeft;
    }

    if (i >= guiMapBottom) {
      i = guiMapBottom - 1;
    }

    if (j >= guiMapRight) {
      j = guiMapRight - 1;
    }

    int k = mc.renderEngine.getTexture("/terrain.png");
    int l = mc.renderEngine.getTexture("/achievement/bg.png");
    int i1 = (width - achievementsPaneWidth) / 2;
    int j1 = (height - achievementsPaneHeight) / 2;
    int k1 = i1 + 16;
    int l1 = j1 + 17;
    zLevel = 0.0F;
    GL11.glDepthFunc(GL11.GL_GEQUAL);
    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, 0.0F, -200F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    mc.renderEngine.bindTexture(k);
    int i2 = i + 288 >> 4;
    int j2 = j + 288 >> 4;
    int k2 = (i + 288) % 16;
    int l2 = (j + 288) % 16;
    Random random = new Random();

    for (int i3 = 0; i3 * 16 - l2 < 155; i3++) {
      float f = 0.6F - ((float) (j2 + i3) / 25F) * 0.3F;
      GL11.glColor4f(f, f, f, 1.0F);

      for (int k3 = 0; k3 * 16 - k2 < 224; k3++) {
        random.setSeed(1234 + i2 + k3);
        random.nextInt();
        int j4 = random.nextInt(1 + j2 + i3) + (j2 + i3) / 2;
        int l4 = Block.sand.blockIndexInTexture;

        if (j4 > 37 || j2 + i3 == 35) {
          l4 = Block.bedrock.blockIndexInTexture;
        } else if (j4 == 22) {
          if (random.nextInt(2) == 0) {
            l4 = Block.oreDiamond.blockIndexInTexture;
          } else {
            l4 = Block.oreRedstone.blockIndexInTexture;
          }
        } else if (j4 == 10) {
          l4 = Block.oreIron.blockIndexInTexture;
        } else if (j4 == 8) {
          l4 = Block.oreCoal.blockIndexInTexture;
        } else if (j4 > 4) {
          l4 = Block.stone.blockIndexInTexture;
        } else if (j4 > 0) {
          l4 = Block.dirt.blockIndexInTexture;
        }

        drawTexturedModalRect(
            (k1 + k3 * 16) - k2, (l1 + i3 * 16) - l2, l4 % 16 << 4, (l4 >> 4) << 4, 16, 16);
      }
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    for (int j3 = 0; j3 < AchievementList.achievementList.size(); j3++) {
      Achievement achievement1 = (Achievement) AchievementList.achievementList.get(j3);

      if (achievement1.parentAchievement == null) {
        continue;
      }

      int l3 = (achievement1.displayColumn * 24 - i) + 11 + k1;
      int k4 = (achievement1.displayRow * 24 - j) + 11 + l1;
      int i5 = (achievement1.parentAchievement.displayColumn * 24 - i) + 11 + k1;
      int l5 = (achievement1.parentAchievement.displayRow * 24 - j) + 11 + l1;
      boolean flag = statFileWriter.hasAchievementUnlocked(achievement1);
      boolean flag1 = statFileWriter.canUnlockAchievement(achievement1);
      char c =
          Math.sin(((double) (System.currentTimeMillis() % 600L) / 600D) * Math.PI * 2D)
                  <= 0.59999999999999998D
              ? '\202'
              : '\377';
      int i8 = 0xff000000;

      if (flag) {
        i8 = 0xff707070;
      } else if (flag1) {
        i8 = 65280 + (c << 24);
      }

      drawHorizontalLine(l3, i5, k4, i8);
      drawVerticalLine(i5, k4, l5, i8);
    }

    Achievement achievement = null;
    RenderItem renderitem = new RenderItem();
    RenderHelper.enableGUIStandardItemLighting();
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);

    for (int i4 = 0; i4 < AchievementList.achievementList.size(); i4++) {
      Achievement achievement2 = (Achievement) AchievementList.achievementList.get(i4);
      int j5 = achievement2.displayColumn * 24 - i;
      int i6 = achievement2.displayRow * 24 - j;

      if (j5 < -24 || i6 < -24 || j5 > 224 || i6 > 155) {
        continue;
      }

      if (statFileWriter.hasAchievementUnlocked(achievement2)) {
        float f1 = 1.0F;
        GL11.glColor4f(f1, f1, f1, 1.0F);
      } else if (statFileWriter.canUnlockAchievement(achievement2)) {
        float f2 =
            Math.sin(((double) (System.currentTimeMillis() % 600L) / 600D) * Math.PI * 2D)
                    >= 0.59999999999999998D
                ? 0.8F
                : 0.6F;
        GL11.glColor4f(f2, f2, f2, 1.0F);
      } else {
        float f3 = 0.3F;
        GL11.glColor4f(f3, f3, f3, 1.0F);
      }

      mc.renderEngine.bindTexture(l);
      int k6 = k1 + j5;
      int j7 = l1 + i6;

      if (achievement2.getSpecial()) {
        drawTexturedModalRect(k6 - 2, j7 - 2, 26, 202, 26, 26);
      } else {
        drawTexturedModalRect(k6 - 2, j7 - 2, 0, 202, 26, 26);
      }

      if (!statFileWriter.canUnlockAchievement(achievement2)) {
        float f4 = 0.1F;
        GL11.glColor4f(f4, f4, f4, 1.0F);
        renderitem.field_27004_a = false;
      }

      GL11.glEnable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_CULL_FACE);
      renderitem.renderItemIntoGUI(
          mc.fontRenderer, mc.renderEngine, achievement2.theItemStack, k6 + 3, j7 + 3);
      GL11.glDisable(GL11.GL_LIGHTING);

      if (!statFileWriter.canUnlockAchievement(achievement2)) {
        renderitem.field_27004_a = true;
      }

      GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

      if (par1 >= k1
          && par2 >= l1
          && par1 < k1 + 224
          && par2 < l1 + 155
          && par1 >= k6
          && par1 <= k6 + 22
          && par2 >= j7
          && par2 <= j7 + 22) {
        achievement = achievement2;
      }
    }

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    mc.renderEngine.bindTexture(l);
    drawTexturedModalRect(i1, j1, 0, 0, achievementsPaneWidth, achievementsPaneHeight);
    GL11.glPopMatrix();
    zLevel = 0.0F;
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    super.drawScreen(par1, par2, par3);

    if (achievement != null) {
      String s = StatCollector.translateToLocal(achievement.getName());
      String s1 = achievement.getDescription();
      int k5 = par1 + 12;
      int j6 = par2 - 4;

      if (statFileWriter.canUnlockAchievement(achievement)) {
        int l6 = Math.max(fontRenderer.getStringWidth(s), 120);
        int k7 = fontRenderer.splitStringWidth(s1, l6);

        if (statFileWriter.hasAchievementUnlocked(achievement)) {
          k7 += 12;
        }

        drawGradientRect(k5 - 3, j6 - 3, k5 + l6 + 3, j6 + k7 + 3 + 12, 0xc0000000, 0xc0000000);
        fontRenderer.drawSplitString(s1, k5, j6 + 12, l6, 0xffa0a0a0);

        if (statFileWriter.hasAchievementUnlocked(achievement)) {
          fontRenderer.drawStringWithShadow(
              StatCollector.translateToLocal("achievement.taken"), k5, j6 + k7 + 4, 0xff9090ff);
        }
      } else {
        int i7 = Math.max(fontRenderer.getStringWidth(s), 120);
        String s2 =
            StatCollector.translateToLocalFormatted(
                "achievement.requires",
                new Object[] {
                  StatCollector.translateToLocal(achievement.parentAchievement.getName())
                });
        int l7 = fontRenderer.splitStringWidth(s2, i7);
        drawGradientRect(k5 - 3, j6 - 3, k5 + i7 + 3, j6 + l7 + 12 + 3, 0xc0000000, 0xc0000000);
        fontRenderer.drawSplitString(s2, k5, j6 + 12, i7, 0xff705050);
      }

      fontRenderer.drawStringWithShadow(
          s,
          k5,
          j6,
          statFileWriter.canUnlockAchievement(achievement)
              ? achievement.getSpecial() ? -128 : -1
              : achievement.getSpecial() ? 0xff808040 : 0xff808080);
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_LIGHTING);
    RenderHelper.disableStandardItemLighting();
  }
예제 #10
0
  /**
   * Renders the active item in the player's hand when in first person mode. Args: partialTickTime
   */
  public void renderItemInFirstPerson(float par1) {
    float var2 =
        this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * par1;
    EntityClientPlayerMP var3 = this.mc.thePlayer;
    float var4 = var3.prevRotationPitch + (var3.rotationPitch - var3.prevRotationPitch) * par1;
    GL11.glPushMatrix();
    GL11.glRotatef(var4, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(
        var3.prevRotationYaw + (var3.rotationYaw - var3.prevRotationYaw) * par1, 0.0F, 1.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();
    float var5;
    float var6;

    if (var3 instanceof EntityPlayerSP) {
      var5 = var3.prevRenderArmPitch + (var3.renderArmPitch - var3.prevRenderArmPitch) * par1;
      var6 = var3.prevRenderArmYaw + (var3.renderArmYaw - var3.prevRenderArmYaw) * par1;
      GL11.glRotatef((var3.rotationPitch - var5) * 0.1F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef((var3.rotationYaw - var6) * 0.1F, 0.0F, 1.0F, 0.0F);
    }

    ItemStack var7 = this.itemToRender;
    var5 =
        this.mc.theWorld.getLightBrightness(
            MathHelper.floor_double(var3.posX),
            MathHelper.floor_double(var3.posY),
            MathHelper.floor_double(var3.posZ));
    var5 = 1.0F;
    int var8 =
        this.mc.theWorld.getLightBrightnessForSkyBlocks(
            MathHelper.floor_double(var3.posX),
            MathHelper.floor_double(var3.posY),
            MathHelper.floor_double(var3.posZ),
            0);
    int var9 = var8 % 65536;
    int var10 = var8 / 65536;
    OpenGlHelper.setLightmapTextureCoords(
        OpenGlHelper.lightmapTexUnit, (float) var9 / 1.0F, (float) var10 / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float var11;
    float var12;
    float var13;

    if (var7 != null) {
      var8 = Item.itemsList[var7.itemID].getColorFromItemStack(var7, 0);
      var13 = (float) (var8 >> 16 & 255) / 255.0F;
      var12 = (float) (var8 >> 8 & 255) / 255.0F;
      var11 = (float) (var8 & 255) / 255.0F;
      GL11.glColor4f(var5 * var13, var5 * var12, var5 * var11, 1.0F);
    } else {
      GL11.glColor4f(var5, var5, var5, 1.0F);
    }

    float var14;
    float var15;
    Render var17;
    float var16;
    RenderPlayer var18;

    if (var7 != null && var7.itemID == Item.map.itemID) {
      GL11.glPushMatrix();
      var6 = 0.8F;
      var13 = var3.getSwingProgress(par1);
      var12 = MathHelper.sin(var13 * (float) Math.PI);
      var11 = MathHelper.sin(MathHelper.sqrt_float(var13) * (float) Math.PI);
      GL11.glTranslatef(
          -var11 * 0.4F,
          MathHelper.sin(MathHelper.sqrt_float(var13) * (float) Math.PI * 2.0F) * 0.2F,
          -var12 * 0.2F);
      var13 = 1.0F - var4 / 45.0F + 0.1F;

      if (var13 < 0.0F) {
        var13 = 0.0F;
      }

      if (var13 > 1.0F) {
        var13 = 1.0F;
      }

      var13 = -MathHelper.cos(var13 * (float) Math.PI) * 0.5F + 0.5F;
      GL11.glTranslatef(
          0.0F, 0.0F * var6 - (1.0F - var2) * 1.2F - var13 * 0.5F + 0.04F, -0.9F * var6);
      GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(var13 * -85.0F, 0.0F, 0.0F, 1.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          this.mc.renderEngine.getTextureForDownloadableImage(
              this.mc.thePlayer.skinUrl, this.mc.thePlayer.getTexture()));

      for (var10 = 0; var10 < 2; ++var10) {
        int var24 = var10 * 2 - 1;
        GL11.glPushMatrix();
        GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float) var24);
        GL11.glRotatef((float) (-45 * var24), 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef((float) (-65 * var24), 0.0F, 1.0F, 0.0F);
        var17 = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
        var18 = (RenderPlayer) var17;
        var16 = 1.0F;
        GL11.glScalef(var16, var16, var16);
        var18.func_82441_a(this.mc.thePlayer);
        GL11.glPopMatrix();
      }

      var12 = var3.getSwingProgress(par1);
      var11 = MathHelper.sin(var12 * var12 * (float) Math.PI);
      var14 = MathHelper.sin(MathHelper.sqrt_float(var12) * (float) Math.PI);
      GL11.glRotatef(-var11 * 20.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-var14 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-var14 * 80.0F, 1.0F, 0.0F, 0.0F);
      var15 = 0.38F;
      GL11.glScalef(var15, var15, var15);
      GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
      var16 = 0.015625F;
      GL11.glScalef(var16, var16, var16);
      this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/misc/mapbg.png"));
      Tessellator var25 = Tessellator.instance;
      GL11.glNormal3f(0.0F, 0.0F, -1.0F);
      var25.startDrawingQuads();
      byte var23 = 7;
      var25.addVertexWithUV((double) (0 - var23), (double) (128 + var23), 0.0D, 0.0D, 1.0D);
      var25.addVertexWithUV((double) (128 + var23), (double) (128 + var23), 0.0D, 1.0D, 1.0D);
      var25.addVertexWithUV((double) (128 + var23), (double) (0 - var23), 0.0D, 1.0D, 0.0D);
      var25.addVertexWithUV((double) (0 - var23), (double) (0 - var23), 0.0D, 0.0D, 0.0D);
      var25.draw();
      MapData var27 = Item.map.getMapData(var7, this.mc.theWorld);

      if (var27 != null) {
        this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, var27);
      }

      GL11.glPopMatrix();
    } else if (var7 != null) {
      GL11.glPushMatrix();
      var6 = 0.8F;

      if (var3.getItemInUseCount() > 0) {
        EnumAction var19 = var7.getItemUseAction();

        if (var19 == EnumAction.eat || var19 == EnumAction.drink) {
          var12 = (float) var3.getItemInUseCount() - par1 + 1.0F;
          var11 = 1.0F - var12 / (float) var7.getMaxItemUseDuration();
          var14 = 1.0F - var11;
          var14 = var14 * var14 * var14;
          var14 = var14 * var14 * var14;
          var14 = var14 * var14 * var14;
          var15 = 1.0F - var14;
          GL11.glTranslatef(
              0.0F,
              MathHelper.abs(MathHelper.cos(var12 / 4.0F * (float) Math.PI) * 0.1F)
                  * (float) ((double) var11 > 0.2D ? 1 : 0),
              0.0F);
          GL11.glTranslatef(var15 * 0.6F, -var15 * 0.5F, 0.0F);
          GL11.glRotatef(var15 * 90.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(var15 * 10.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(var15 * 30.0F, 0.0F, 0.0F, 1.0F);
        }
      } else {
        var13 = var3.getSwingProgress(par1);
        var12 = MathHelper.sin(var13 * (float) Math.PI);
        var11 = MathHelper.sin(MathHelper.sqrt_float(var13) * (float) Math.PI);
        GL11.glTranslatef(
            -var11 * 0.4F,
            MathHelper.sin(MathHelper.sqrt_float(var13) * (float) Math.PI * 2.0F) * 0.2F,
            -var12 * 0.2F);
      }

      GL11.glTranslatef(0.7F * var6, -0.65F * var6 - (1.0F - var2) * 0.6F, -0.9F * var6);
      GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      var13 = var3.getSwingProgress(par1);
      var12 = MathHelper.sin(var13 * var13 * (float) Math.PI);
      var11 = MathHelper.sin(MathHelper.sqrt_float(var13) * (float) Math.PI);
      GL11.glRotatef(-var12 * 20.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-var11 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-var11 * 80.0F, 1.0F, 0.0F, 0.0F);
      var14 = 0.4F;
      GL11.glScalef(var14, var14, var14);
      float var20;
      float var22;

      if (var3.getItemInUseCount() > 0) {
        EnumAction var21 = var7.getItemUseAction();

        if (var21 == EnumAction.block) {
          GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
          GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
        } else if (var21 == EnumAction.bow) {
          GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F);
          GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
          var16 =
              (float) var7.getMaxItemUseDuration()
                  - ((float) var3.getItemInUseCount() - par1 + 1.0F);
          var22 = var16 / 20.0F;
          var22 = (var22 * var22 + var22 * 2.0F) / 3.0F;

          if (var22 > 1.0F) {
            var22 = 1.0F;
          }

          if (var22 > 0.1F) {
            GL11.glTranslatef(
                0.0F, MathHelper.sin((var16 - 0.1F) * 1.3F) * 0.01F * (var22 - 0.1F), 0.0F);
          }

          GL11.glTranslatef(0.0F, 0.0F, var22 * 0.1F);
          GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glTranslatef(0.0F, 0.5F, 0.0F);
          var20 = 1.0F + var22 * 0.2F;
          GL11.glScalef(1.0F, 1.0F, var20);
          GL11.glTranslatef(0.0F, -0.5F, 0.0F);
          GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
        }
      }

      if (var7.getItem().shouldRotateAroundWhenRendering()) {
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
      }

      if (var7.getItem().requiresMultipleRenderPasses()) {
        this.renderItem(var3, var7, 0);
        int var26 = Item.itemsList[var7.itemID].getColorFromItemStack(var7, 1);
        var16 = (float) (var26 >> 16 & 255) / 255.0F;
        var22 = (float) (var26 >> 8 & 255) / 255.0F;
        var20 = (float) (var26 & 255) / 255.0F;
        GL11.glColor4f(var5 * var16, var5 * var22, var5 * var20, 1.0F);
        this.renderItem(var3, var7, 1);
      } else {
        this.renderItem(var3, var7, 0);
      }

      GL11.glPopMatrix();
    } else if (!var3.getHasActivePotion()) {
      GL11.glPushMatrix();
      var6 = 0.8F;
      var13 = var3.getSwingProgress(par1);
      var12 = MathHelper.sin(var13 * (float) Math.PI);
      var11 = MathHelper.sin(MathHelper.sqrt_float(var13) * (float) Math.PI);
      GL11.glTranslatef(
          -var11 * 0.3F,
          MathHelper.sin(MathHelper.sqrt_float(var13) * (float) Math.PI * 2.0F) * 0.4F,
          -var12 * 0.4F);
      GL11.glTranslatef(0.8F * var6, -0.75F * var6 - (1.0F - var2) * 0.6F, -0.9F * var6);
      GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      var13 = var3.getSwingProgress(par1);
      var12 = MathHelper.sin(var13 * var13 * (float) Math.PI);
      var11 = MathHelper.sin(MathHelper.sqrt_float(var13) * (float) Math.PI);
      GL11.glRotatef(var11 * 70.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-var12 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          this.mc.renderEngine.getTextureForDownloadableImage(
              this.mc.thePlayer.skinUrl, this.mc.thePlayer.getTexture()));
      GL11.glTranslatef(-1.0F, 3.6F, 3.5F);
      GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
      GL11.glScalef(1.0F, 1.0F, 1.0F);
      GL11.glTranslatef(5.6F, 0.0F, 0.0F);
      var17 = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
      var18 = (RenderPlayer) var17;
      var16 = 1.0F;
      GL11.glScalef(var16, var16, var16);
      var18.func_82441_a(this.mc.thePlayer);
      GL11.glPopMatrix();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.disableStandardItemLighting();
  }
  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();
    }
  }
예제 #12
0
  /**
   * Renders the active item in the player's hand when in first person mode. Args: partialTickTime
   */
  public void renderItemInFirstPerson(float par1) {
    float f = prevEquippedProgress + (equippedProgress - prevEquippedProgress) * par1;
    EntityPlayerSP entityplayersp = mc.thePlayer;
    float f1 =
        ((EntityPlayer) (entityplayersp)).prevRotationPitch
            + (((EntityPlayer) (entityplayersp)).rotationPitch
                    - ((EntityPlayer) (entityplayersp)).prevRotationPitch)
                * par1;
    GL11.glPushMatrix();
    GL11.glRotatef(f1, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(
        ((EntityPlayer) (entityplayersp)).prevRotationYaw
            + (((EntityPlayer) (entityplayersp)).rotationYaw
                    - ((EntityPlayer) (entityplayersp)).prevRotationYaw)
                * par1,
        0.0F,
        1.0F,
        0.0F);
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();

    if (entityplayersp instanceof EntityPlayerSP) {
      EntityPlayerSP entityplayersp1 = (EntityPlayerSP) entityplayersp;
      float f2 =
          entityplayersp1.prevRenderArmPitch
              + (entityplayersp1.renderArmPitch - entityplayersp1.prevRenderArmPitch) * par1;
      float f4 =
          entityplayersp1.prevRenderArmYaw
              + (entityplayersp1.renderArmYaw - entityplayersp1.prevRenderArmYaw) * par1;
      GL11.glRotatef(
          (((EntityPlayer) (entityplayersp)).rotationPitch - f2) * 0.1F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef((((EntityPlayer) (entityplayersp)).rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
    }

    ItemStack itemstack = itemToRender;
    float f3 =
        mc.theWorld.getLightBrightness(
            MathHelper.floor_double(((EntityPlayer) (entityplayersp)).posX),
            MathHelper.floor_double(((EntityPlayer) (entityplayersp)).posY),
            MathHelper.floor_double(((EntityPlayer) (entityplayersp)).posZ));
    f3 = 1.0F;
    int i =
        mc.theWorld.getLightBrightnessForSkyBlocks(
            MathHelper.floor_double(((EntityPlayer) (entityplayersp)).posX),
            MathHelper.floor_double(((EntityPlayer) (entityplayersp)).posY),
            MathHelper.floor_double(((EntityPlayer) (entityplayersp)).posZ),
            0);
    int k = i % 0x10000;
    int l = i / 0x10000;
    OpenGlHelper.setLightmapTextureCoords(
        OpenGlHelper.lightmapTexUnit, (float) k / 1.0F, (float) l / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    if (itemstack != null) {
      int j = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage(), 0);
      float f8 = (float) (j >> 16 & 0xff) / 255F;
      float f13 = (float) (j >> 8 & 0xff) / 255F;
      float f19 = (float) (j & 0xff) / 255F;
      GL11.glColor4f(f3 * f8, f3 * f13, f3 * f19, 1.0F);
    } else {
      GL11.glColor4f(f3, f3, f3, 1.0F);
    }

    if (itemstack != null && itemstack.itemID == Item.map.shiftedIndex) {
      GL11.glPushMatrix();
      float f5 = 0.8F;
      float f9 = entityplayersp.getSwingProgress(par1);
      float f14 = MathHelper.sin(f9 * (float) Math.PI);
      float f20 = MathHelper.sin(MathHelper.sqrt_float(f9) * (float) Math.PI);
      GL11.glTranslatef(
          -f20 * 0.4F,
          MathHelper.sin(MathHelper.sqrt_float(f9) * (float) Math.PI * 2.0F) * 0.2F,
          -f14 * 0.2F);
      f9 = (1.0F - f1 / 45F) + 0.1F;

      if (f9 < 0.0F) {
        f9 = 0.0F;
      }

      if (f9 > 1.0F) {
        f9 = 1.0F;
      }

      f9 = -MathHelper.cos(f9 * (float) Math.PI) * 0.5F + 0.5F;
      GL11.glTranslatef(0.0F, (0.0F * f5 - (1.0F - f) * 1.2F - f9 * 0.5F) + 0.04F, -0.9F * f5);
      GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(f9 * -85F, 0.0F, 0.0F, 1.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          mc.renderEngine.getTextureForDownloadableImage(
              mc.thePlayer.skinUrl, mc.thePlayer.getTexture()));

      for (f14 = 0; f14 < 2; f14++) {
        f20 = f14 * 2 - 1;
        GL11.glPushMatrix();
        GL11.glTranslatef(-0F, -0.6F, 1.1F * (float) f20);
        GL11.glRotatef(-45 * f20, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-90F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(59F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(-65 * f20, 0.0F, 1.0F, 0.0F);
        Render render1 = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
        RenderPlayer renderplayer1 = (RenderPlayer) render1;
        float f34 = 1.0F;
        GL11.glScalef(f34, f34, f34);
        renderplayer1.drawFirstPersonHand();
        GL11.glPopMatrix();
      }

      f14 = entityplayersp.getSwingProgress(par1);
      f20 = MathHelper.sin(f14 * f14 * (float) Math.PI);
      float f27 = MathHelper.sin(MathHelper.sqrt_float(f14) * (float) Math.PI);
      GL11.glRotatef(-f20 * 20F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f27 * 20F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-f27 * 80F, 1.0F, 0.0F, 0.0F);
      f14 = 0.38F;
      GL11.glScalef(f14, f14, f14);
      GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-1F, -1F, 0.0F);
      f20 = 0.015625F;
      GL11.glScalef(f20, f20, f20);
      mc.renderEngine.bindTexture(mc.renderEngine.getTexture("/misc/mapbg.png"));
      Tessellator tessellator = Tessellator.instance;
      GL11.glNormal3f(0.0F, 0.0F, -1F);
      tessellator.startDrawingQuads();
      byte byte0 = 7;
      tessellator.addVertexWithUV(0 - byte0, 128 + byte0, 0.0D, 0.0D, 1.0D);
      tessellator.addVertexWithUV(128 + byte0, 128 + byte0, 0.0D, 1.0D, 1.0D);
      tessellator.addVertexWithUV(128 + byte0, 0 - byte0, 0.0D, 1.0D, 0.0D);
      tessellator.addVertexWithUV(0 - byte0, 0 - byte0, 0.0D, 0.0D, 0.0D);
      tessellator.draw();
      MapData mapdata = Item.map.getMapData(itemstack, mc.theWorld);
      mapItemRenderer.renderMap(mc.thePlayer, mc.renderEngine, mapdata);
      GL11.glPopMatrix();
    } else if (itemstack != null) {
      GL11.glPushMatrix();
      float f6 = 0.8F;

      if (entityplayersp.getItemInUseCount() > 0) {
        EnumAction enumaction = itemstack.getItemUseAction();

        if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) {
          float f15 = ((float) entityplayersp.getItemInUseCount() - par1) + 1.0F;
          float f21 = 1.0F - f15 / (float) itemstack.getMaxItemUseDuration();
          float f28 = f21;
          float f31 = 1.0F - f28;
          f31 = f31 * f31 * f31;
          f31 = f31 * f31 * f31;
          f31 = f31 * f31 * f31;
          float f35 = 1.0F - f31;
          GL11.glTranslatef(
              0.0F,
              MathHelper.abs(MathHelper.cos((f15 / 4F) * (float) Math.PI) * 0.1F)
                  * (float) ((double) f28 <= 0.20000000000000001D ? 0 : 1),
              0.0F);
          GL11.glTranslatef(f35 * 0.6F, -f35 * 0.5F, 0.0F);
          GL11.glRotatef(f35 * 90F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(f35 * 10F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(f35 * 30F, 0.0F, 0.0F, 1.0F);
        }
      } else {
        float f10 = entityplayersp.getSwingProgress(par1);
        float f16 = MathHelper.sin(f10 * (float) Math.PI);
        float f22 = MathHelper.sin(MathHelper.sqrt_float(f10) * (float) Math.PI);
        GL11.glTranslatef(
            -f22 * 0.4F,
            MathHelper.sin(MathHelper.sqrt_float(f10) * (float) Math.PI * 2.0F) * 0.2F,
            -f16 * 0.2F);
      }

      GL11.glTranslatef(0.7F * f6, -0.65F * f6 - (1.0F - f) * 0.6F, -0.9F * f6);
      GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      float f11 = entityplayersp.getSwingProgress(par1);
      float f17 = MathHelper.sin(f11 * f11 * (float) Math.PI);
      float f23 = MathHelper.sin(MathHelper.sqrt_float(f11) * (float) Math.PI);
      GL11.glRotatef(-f17 * 20F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f23 * 20F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-f23 * 80F, 1.0F, 0.0F, 0.0F);
      f11 = 0.4F;
      GL11.glScalef(f11, f11, f11);

      if (entityplayersp.getItemInUseCount() > 0) {
        EnumAction enumaction1 = itemstack.getItemUseAction();

        if (enumaction1 == EnumAction.block) {
          GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
          GL11.glRotatef(30F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-80F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(60F, 0.0F, 1.0F, 0.0F);
        } else if (enumaction1 == EnumAction.bow) {
          GL11.glRotatef(-18F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-12F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-8F, 1.0F, 0.0F, 0.0F);
          GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
          float f24 =
              (float) itemstack.getMaxItemUseDuration()
                  - (((float) entityplayersp.getItemInUseCount() - par1) + 1.0F);
          float f29 = f24 / 20F;
          f29 = (f29 * f29 + f29 * 2.0F) / 3F;

          if (f29 > 1.0F) {
            f29 = 1.0F;
          }

          if (f29 > 0.1F) {
            GL11.glTranslatef(
                0.0F, MathHelper.sin((f24 - 0.1F) * 1.3F) * 0.01F * (f29 - 0.1F), 0.0F);
          }

          GL11.glTranslatef(0.0F, 0.0F, f29 * 0.1F);
          GL11.glRotatef(-335F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-50F, 0.0F, 1.0F, 0.0F);
          GL11.glTranslatef(0.0F, 0.5F, 0.0F);
          float f32 = 1.0F + f29 * 0.2F;
          GL11.glScalef(1.0F, 1.0F, f32);
          GL11.glTranslatef(0.0F, -0.5F, 0.0F);
          GL11.glRotatef(50F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(335F, 0.0F, 0.0F, 1.0F);
        }
      }

      if (itemstack.getItem().shouldRotateAroundWhenRendering()) {
        GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
      }

      if (itemstack.getItem().func_46058_c()) {
        renderItem(entityplayersp, itemstack, 0);
        int i1 = Item.itemsList[itemstack.itemID].getColorFromDamage(itemstack.getItemDamage(), 1);
        float f25 = (float) (i1 >> 16 & 0xff) / 255F;
        float f30 = (float) (i1 >> 8 & 0xff) / 255F;
        float f33 = (float) (i1 & 0xff) / 255F;
        GL11.glColor4f(f3 * f25, f3 * f30, f3 * f33, 1.0F);
        renderItem(entityplayersp, itemstack, 1);
      } else {
        renderItem(entityplayersp, itemstack, 0);
      }

      GL11.glPopMatrix();
    } else {
      GL11.glPushMatrix();
      float f7 = 0.8F;
      float f12 = entityplayersp.getSwingProgress(par1);
      float f18 = MathHelper.sin(f12 * (float) Math.PI);
      float f26 = MathHelper.sin(MathHelper.sqrt_float(f12) * (float) Math.PI);
      GL11.glTranslatef(
          -f26 * 0.3F,
          MathHelper.sin(MathHelper.sqrt_float(f12) * (float) Math.PI * 2.0F) * 0.4F,
          -f18 * 0.4F);
      GL11.glTranslatef(0.8F * f7, -0.75F * f7 - (1.0F - f) * 0.6F, -0.9F * f7);
      GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      f12 = entityplayersp.getSwingProgress(par1);
      f18 = MathHelper.sin(f12 * f12 * (float) Math.PI);
      f26 = MathHelper.sin(MathHelper.sqrt_float(f12) * (float) Math.PI);
      GL11.glRotatef(f26 * 70F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f18 * 20F, 0.0F, 0.0F, 1.0F);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          mc.renderEngine.getTextureForDownloadableImage(
              mc.thePlayer.skinUrl, mc.thePlayer.getTexture()));
      GL11.glTranslatef(-1F, 3.6F, 3.5F);
      GL11.glRotatef(120F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F);
      GL11.glScalef(1.0F, 1.0F, 1.0F);
      GL11.glTranslatef(5.6F, 0.0F, 0.0F);
      Render render = RenderManager.instance.getEntityRenderObject(mc.thePlayer);
      RenderPlayer renderplayer = (RenderPlayer) render;
      f26 = 1.0F;
      GL11.glScalef(f26, f26, f26);
      renderplayer.drawFirstPersonHand();
      GL11.glPopMatrix();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.disableStandardItemLighting();
  }