public static void renderItemIntoGUI(
      FontRenderer fontRenderer,
      RenderEngine renderEngine,
      ItemStack stack,
      int x,
      int y,
      float opacity,
      float scale) {

    int itemID = stack.itemID;
    int meta = stack.getItemDamage();
    int iconIndex = stack.getIconIndex();

    GL11.glDisable(GL11.GL_LIGHTING);

    renderEngine.bindTexture(renderEngine.getTexture(stack.getItem().getTextureFile()));

    int overlayColour = Item.itemsList[itemID].getColorFromItemStack(stack, 0);
    float var17 = (float) (overlayColour >> 16 & 255) / 255.0F;
    float var16 = (float) (overlayColour >> 8 & 255) / 255.0F;
    float var12 = (float) (overlayColour & 255) / 255.0F;

    GL11.glColor4f(var17, var16, var12, opacity);

    drawTexturedQuad(x, y, iconIndex % 16 * 16, iconIndex / 16 * 16, 16, 16, -90, scale);
    GL11.glEnable(GL11.GL_LIGHTING);
  }
  public static void renderRotatingBlockIntoGUI(
      FontRenderer fontRenderer,
      RenderEngine renderEngine,
      ItemStack stack,
      int x,
      int y,
      float zLevel,
      float scale) {

    RenderBlocks renderBlocks = new RenderBlocks();

    Block block = Block.blocksList[stack.itemID];
    renderEngine.bindTexture(renderEngine.getTexture(block.getTextureFile()));
    GL11.glPushMatrix();
    GL11.glTranslatef((float) (x - 2), (float) (y + 3), -3.0F + zLevel);
    GL11.glScalef(10.0F, 10.0F, 10.0F);
    GL11.glTranslatef(1.0F, 0.5F, 1.0F);
    GL11.glScalef(1.0F * scale, 1.0F * scale, -1.0F);
    GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(0F + 1 * rotationAngle, 0.0F, 1.0F, 0.0F);
    rotationAngle = (rotationAngle + 1) % 360;

    int var10 = Item.itemsList[stack.itemID].getColorFromItemStack(stack, 0);
    float var16 = (float) (var10 >> 16 & 255) / 255.0F;
    float var12 = (float) (var10 >> 8 & 255) / 255.0F;
    float var13 = (float) (var10 & 255) / 255.0F;

    GL11.glColor4f(var16, var12, var13, 1.0F);

    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    renderBlocks.useInventoryTint = true;
    renderBlocks.renderBlockAsItem(block, stack.getItemDamage(), 1.0F);
    renderBlocks.useInventoryTint = true;
    GL11.glPopMatrix();
  }
示例#3
0
  public void registerTextureOverrides(RenderEngine renderer) {
    for (OverrideInfo animationOverride : animationSet) {
      renderer.registerTextureFX(animationOverride.textureFX);
      addedTextureFX.add(animationOverride.textureFX);
      FMLCommonHandler.instance()
          .getFMLLogger()
          .finer(
              String.format(
                  "Registered texture override %d (%d) on %s (%d)",
                  animationOverride.index,
                  animationOverride.textureFX.iconIndex,
                  animationOverride.textureFX.getClass().getSimpleName(),
                  animationOverride.textureFX.tileImage));
    }

    for (String fileToOverride : overrideInfo.keySet()) {
      for (OverrideInfo override : overrideInfo.get(fileToOverride)) {
        try {
          BufferedImage image = loadImageFromTexturePack(renderer, override.override);
          ModTextureStatic mts = new ModTextureStatic(override.index, 1, override.texture, image);
          renderer.registerTextureFX(mts);
          addedTextureFX.add(mts);
          FMLCommonHandler.instance()
              .getFMLLogger()
              .finer(
                  String.format(
                      "Registered texture override %d (%d) on %s (%d)",
                      override.index, mts.iconIndex, override.texture, mts.tileImage));
        } catch (IOException e) {
          FMLCommonHandler.instance()
              .getFMLLogger()
              .throwing("FMLClientHandler", "registerTextureOverrides", e);
        }
      }
    }
  }
  /** Render the item's icon or block into the GUI, including the glint effect. */
  public void renderItemAndEffectIntoGUI(
      FontRenderer par1FontRenderer,
      RenderEngine par2RenderEngine,
      ItemStack par3ItemStack,
      int par4,
      int par5) {
    if (par3ItemStack != null) {
      if (!ForgeHooksClient.renderInventoryItem(
          renderBlocks,
          par2RenderEngine,
          par3ItemStack,
          renderWithColor,
          zLevel,
          (float) par4,
          (float) par5)) {
        this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5);
      }

      if (par3ItemStack.hasEffect()) {
        GL11.glDepthFunc(GL11.GL_GREATER);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDepthMask(false);
        par2RenderEngine.bindTexture("%blur%/misc/glint.png");
        this.zLevel -= 50.0F;
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
        GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
        this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        this.zLevel += 50.0F;
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
      }
    }
  }
 @Override
 public void bindImage(RenderEngine renderEngine) {
   GL11.glBindTexture(
       GL11.GL_TEXTURE_2D,
       renderEngine.getTexture(Sprites.SPRITE_SHEET_LOCATION + Sprites.BLOCK_SPRITE_SHEET));
 }
  /** Renders the item's icon or block into the UI at the specified position. */
  public void renderItemIntoGUI(
      FontRenderer par1FontRenderer,
      RenderEngine par2RenderEngine,
      ItemStack par3ItemStack,
      int par4,
      int par5) {
    int k = par3ItemStack.itemID;
    int l = par3ItemStack.getItemDamage();
    Icon icon = par3ItemStack.getIconIndex();
    float f;
    float f1;
    float f2;

    int j1;

    if (Item.itemsList[k].requiresMultipleRenderPasses()) {
      GL11.glDisable(GL11.GL_LIGHTING);
      par2RenderEngine.bindTexture(
          par3ItemStack.getItemSpriteNumber() == 0 ? "/terrain.png" : "/gui/items.png");

      for (j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1) {
        Icon icon1 = Item.itemsList[k].getIcon(par3ItemStack, j1);
        int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
        f = (float) (k1 >> 16 & 255) / 255.0F;
        f1 = (float) (k1 >> 8 & 255) / 255.0F;
        float f3 = (float) (k1 & 255) / 255.0F;

        if (this.renderWithColor) {
          GL11.glColor4f(f, f1, f3, 1.0F);
        }

        this.renderIcon(par4, par5, icon1, 16, 16);
      }

      GL11.glEnable(GL11.GL_LIGHTING);
    } else {
      GL11.glDisable(GL11.GL_LIGHTING);

      if (par3ItemStack.getItemSpriteNumber() == 0) {
        par2RenderEngine.bindTexture("/terrain.png");
      } else {
        par2RenderEngine.bindTexture("/gui/items.png");
      }

      if (icon == null) {
        icon = par2RenderEngine.getMissingIcon(par3ItemStack.getItemSpriteNumber());
      }

      j1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
      float f4 = (float) (j1 >> 16 & 255) / 255.0F;
      f2 = (float) (j1 >> 8 & 255) / 255.0F;
      f = (float) (j1 & 255) / 255.0F;

      if (this.renderWithColor) {
        GL11.glColor4f(f4, f2, f, 1.0F);
      }

      this.renderIcon(par4, par5, icon, 16, 16);
      GL11.glEnable(GL11.GL_LIGHTING);
    }

    GL11.glEnable(GL11.GL_CULL_FACE);
  }