Пример #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();
    }
  }
Пример #2
0
 public void updateAchievementWindow() {
   if (theAchievement == null || achievementTime == 0L) {
     return;
   }
   double d = (double) (System.currentTimeMillis() - achievementTime) / 3000D;
   if (!haveAchiement && !haveAchiement && (d < 0.0D || d > 1.0D)) {
     achievementTime = 0L;
     return;
   }
   updateAchievementWindowScale();
   GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
   GL11.glDepthMask(false);
   double d1 = d * 2D;
   if (d1 > 1.0D) {
     d1 = 2D - d1;
   }
   d1 *= 4D;
   d1 = 1.0D - d1;
   if (d1 < 0.0D) {
     d1 = 0.0D;
   }
   d1 *= d1;
   d1 *= d1;
   int i = achievementWindowWidth - 160;
   int j = 0 - (int) (d1 * 36D);
   int k = theGame.renderEngine.getTexture("/achievement/bg.png");
   GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
   GL11.glEnable(3553 /*GL_TEXTURE_2D*/);
   GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, k);
   GL11.glDisable(2896 /*GL_LIGHTING*/);
   drawTexturedModalRect(i, j, 96, 202, 160, 32);
   if (haveAchiement) {
     theGame.fontRenderer.drawSplitString(achievementStatName, i + 30, j + 7, 120, -1);
   } else {
     theGame.fontRenderer.drawString(achievementGetLocalText, i + 30, j + 7, -256);
     theGame.fontRenderer.drawString(achievementStatName, i + 30, j + 18, -1);
   }
   GL11.glPushMatrix();
   GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
   RenderHelper.enableStandardItemLighting();
   GL11.glPopMatrix();
   GL11.glDisable(2896 /*GL_LIGHTING*/);
   GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
   GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/);
   GL11.glEnable(2896 /*GL_LIGHTING*/);
   itemRender.renderItemIntoGUI(
       theGame.fontRenderer, theGame.renderEngine, theAchievement.theItemStack, i + 8, j + 8);
   GL11.glDisable(2896 /*GL_LIGHTING*/);
   GL11.glDepthMask(true);
   GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
 }
Пример #3
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*/);
  }
Пример #4
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();
  }
Пример #5
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();
    }
  }
Пример #6
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();
    }
  }
Пример #8
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();
  }