コード例 #1
0
 @Override
 public void renderPre(
     GuiBooklet gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed) {
   if (this.input != null || this.getInputForOutput(this.result) != null) {
     gui.mc
         .getTextureManager()
         .bindTexture(
             ClientProxy.bulletForMyValentine ? GuiBooklet.resLocValentine : GuiBooklet.resLoc);
     gui.drawTexturedModalRect(gui.guiLeft + 37, gui.guiTop + 20, 0, 180, 60, 60);
   }
 }
コード例 #2
0
  @SuppressWarnings("unchecked")
  @SideOnly(Side.CLIENT)
  protected void renderTooltipAndTransfer(
      GuiBooklet gui,
      ItemStack stack,
      int x,
      int y,
      boolean checkAndTransfer,
      boolean mousePressed) {
    boolean flagBefore = gui.mc.fontRenderer.getUnicodeFlag();
    gui.mc.fontRenderer.setUnicodeFlag(false);

    List list = stack.getTooltip(gui.mc.thePlayer, gui.mc.gameSettings.advancedItemTooltips);

    for (int k = 0; k < list.size(); ++k) {
      if (k == 0) {
        list.set(k, stack.getRarity().rarityColor + (String) list.get(k));
      } else {
        list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
      }
    }

    if (checkAndTransfer) {
      BookletPage page = BookletUtils.getFirstPageForStack(stack);
      if (page != null && page != this) {
        list.add(
            EnumChatFormatting.GOLD
                + StringUtil.localize("booklet." + ModUtil.MOD_ID_LOWER + ".clickToSeeRecipe"));

        if (mousePressed) {
          BookletUtils.openIndexEntry(
              gui,
              page.getChapter().entry,
              InitBooklet.entries.indexOf(page.getChapter().entry)
                      / GuiBooklet.CHAPTER_BUTTONS_AMOUNT
                  + 1,
              true);
          BookletUtils.openChapter(gui, page.getChapter(), page);
          Minecraft.getMinecraft()
              .getSoundHandler()
              .playSound(
                  PositionedSoundRecord.func_147674_a(
                      new ResourceLocation("gui.button.press"), 1.0F));
        }
      }
    }

    gui.drawHoveringText(list, x, y);

    gui.mc.fontRenderer.setUnicodeFlag(flagBefore);
  }