Ejemplo n.º 1
0
  /** Renders the item */
  public void doRenderItem(
      ArrowEntity arrow, double par2, double par4, double par6, float par8, float par9) {
    this.random.setSeed(187L);
    ItemStack itemstack = arrow.getEntityItem();

    if (itemstack.getItem() != null) {
      GL11.glPushMatrix();
      float f2 =
          shouldBob() ? MathHelper.sin(((float) 0 + par9 * 0.2f) / 10.0F + 0) * 0.1F + 0.1F : 0F;
      float f3 = (((float) 0 + par9 * 0.2f) / 20.0F + 0) * (180F / (float) Math.PI);
      byte b0 = getMiniBlockCount(itemstack);

      GL11.glTranslatef((float) par2, (float) par4 + f2, (float) par6);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      int i;
      float f4;
      float f5;
      float f6;

      float f8;

      if (itemstack.getItem().requiresMultipleRenderPasses()) {
        // GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
        GL11.glTranslatef(0.0F, -0.05F, 0.0F);

        this.loadTexture("/gui/items.png");

        for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) {
          this.random.setSeed(187L);
          Icon icon = itemstack.getItem().getIcon(itemstack, k);
          f8 = 1.0F;

          if (this.renderWithColor) {
            i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, k);
            f5 = (float) (i >> 16 & 255) / 255.0F;
            f4 = (float) (i >> 8 & 255) / 255.0F;
            f6 = (float) (i & 255) / 255.0F;
            GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
            this.renderDroppedItem(arrow, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8);
          } else {
            this.renderDroppedItem(arrow, icon, b0, par9, 1.0F, 1.0F, 1.0F);
          }
          GL11.glScalef(1.005f, 1.005f, 1.005f);
          // GL11.glTranslatef(0F, -0.0025F, 0.0F);
        }
      } else {
        GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
        GL11.glTranslatef(0.0F, -0.05F, 0.0F);

        Icon icon1 = itemstack.getIconIndex();

        if (itemstack.getItemSpriteNumber() == 0) {
          this.loadTexture("/terrain.png");
        } else {
          this.loadTexture("/gui/items.png");
        }

        if (this.renderWithColor) {
          int l = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
          f8 = (float) (l >> 16 & 255) / 255.0F;
          float f9 = (float) (l >> 8 & 255) / 255.0F;
          f5 = (float) (l & 255) / 255.0F;
          f4 = 1.0F;
          this.renderDroppedItem(arrow, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
        } else {
          this.renderDroppedItem(arrow, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
        }
      }

      GL11.glDisable(GL12.GL_RESCALE_NORMAL);
      GL11.glPopMatrix();
    }
  }
Ejemplo n.º 2
0
  /** Renders a dropped item */
  private void renderDroppedItem(
      ArrowEntity arrow, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) {
    Tessellator tessellator = Tessellator.instance;

    if (par2Icon == null) {
      par2Icon =
          this.renderManager.renderEngine.getMissingIcon(
              arrow.getEntityItem().getItemSpriteNumber());
    }

    float f4 = par2Icon.getMinU();
    float f5 = par2Icon.getMaxU();
    float f6 = par2Icon.getMinV();
    float f7 = par2Icon.getMaxV();
    float f8 = 1.0F;
    float f9 = 0.5F;
    float f10 = 0.25F;
    float f11;

    GL11.glPushMatrix();
    /*float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par7;
    GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-rotation * 15, 0.0F, 0.0F, 1.0F);*/
    GL11.glRotatef(
        arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F,
        0.0F,
        1.0F,
        0.0F);
    GL11.glRotatef(
        arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F,
        0.0F,
        0.0F,
        1.0F);
    float f12 = 0.0625F;
    f11 = 0.021875F;
    ItemStack itemstack = arrow.getEntityItem();
    int j = itemstack.stackSize;
    byte b0 = getMiniItemCount(itemstack);

    GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));

    for (int k = 0; k < b0; ++k) {
      GL11.glTranslatef(0f, 0f, f12 + f11);

      if (itemstack.getItemSpriteNumber() == 0) {
        this.loadTexture("/terrain.png");
      } else {
        this.loadTexture("/gui/items.png");
      }

      GL11.glColor4f(par5, par6, par7, 1.0F);
      ItemRenderer.renderItemIn2D(
          tessellator, f5, f6, f4, f7, par2Icon.getSheetWidth(), par2Icon.getSheetHeight(), f12);

      if (itemstack != null && itemstack.hasEffect()) {
        GL11.glDepthFunc(GL11.GL_EQUAL);
        GL11.glDisable(GL11.GL_LIGHTING);
        this.renderManager.renderEngine.bindTexture("%blur%/misc/glint.png");
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
        float f13 = 0.76F;
        GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F);
        GL11.glMatrixMode(GL11.GL_TEXTURE);
        GL11.glPushMatrix();
        float f14 = 0.125F;
        GL11.glScalef(f14, f14, f14);
        float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
        GL11.glTranslatef(f15, 0.0F, 0.0F);
        GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
        GL11.glPopMatrix();
        GL11.glPushMatrix();
        GL11.glScalef(f14, f14, f14);
        f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
        GL11.glTranslatef(-f15, 0.0F, 0.0F);
        GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
        ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 255, 255, f12);
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }
    }

    GL11.glPopMatrix();
  }