コード例 #1
0
 @Override
 public void mouseClicked(int x, int y, int button) {
   if (hasValidItem) {
     Minecraft.getMinecraft()
         .getSoundHandler()
         .playSound(
             PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
   }
 }
コード例 #2
0
 public static void setTab(WikiTab tab) {
   if (!isTabSelected(tab)) {
     gui.tab = tab;
     gui.mc
         .getSoundHandler()
         .playSound(
             PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
   }
 }
コード例 #3
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);
  }
コード例 #4
0
    public void func_146118_a(int p_146118_1_, int p_146118_2_) {
      if (this.field_146155_p) {
        if (this.field_146153_r == SoundCategory.MASTER) {
          float var10000 = 1.0F;
        } else {
          GuiScreenOptionsSounds.this.field_146506_g.func_151438_a(this.field_146153_r);
        }

        GuiScreenOptionsSounds.this
            .field_146297_k
            .func_147118_V()
            .func_147682_a(
                PositionedSoundRecord.func_147674_a(
                    new ResourceLocation("gui.button.press"), 1.0F));
      }

      this.field_146155_p = false;
    }
コード例 #5
0
 public boolean mouseClicked(int mouseX, int mouseY, int button) {
   if (!this.visible) {
     return false;
   }
   for (int i = 0; i < listItems.size(); i++) {
     int yLocation = y - scrollAmount + 2 + i * slotHeight;
     if (mouseY >= y & mouseY <= y + height - 2) {
       if (listItems
           .get(i)
           .mousePressed(fontRenderer, x + 2, yLocation, mouseX, mouseY, button, width)) {
         SoundHandler sh = mc.getSoundHandler();
         sh.playSound(
             PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
         selectedIndex = i;
         return true;
       }
     }
   }
   return false;
 }
コード例 #6
0
  @Override
  protected final void mouseClicked(int x, int y, int a) {
    super.mouseClicked(x, y, a);
    int j = (width - xSize) / 2 - 2;
    int k = (height - ySize) / 2 - 8;
    if (a == 0) {
      int dx = x - j;
      int dy = y - k;
      if (HandbookNotifications.instance.newAlerts()
          || PackModificationTracker.instance.modificationsExist(RotaryCraft.instance)) {
        if (ReikaMathLibrary.isValueInsideBoundsIncl(261, 377, dx)
            && ReikaMathLibrary.isValueInsideBoundsIncl(22, 36, dy)) {
          mc.getSoundHandler()
              .playSound(
                  PositionedSoundRecord.func_147674_a(
                      new ResourceLocation("gui.button.press"), 1.0F));
          int screen = -1;
          int page = -1;

          if (HandbookNotifications.instance.newAlerts()) {
            screen = HandbookRegistry.ALERTS.getScreen();
            page = HandbookRegistry.ALERTS.getPage();
          } else if (PackModificationTracker.instance.modificationsExist(RotaryCraft.instance)) {
            screen = HandbookRegistry.PACKMODS.getScreen();
            page = HandbookRegistry.PACKMODS.getPage();
          }

          if (screen >= 0 && page >= 0) {
            this.screen = screen;
            this.page = page;
            this.initGui();
            HandbookNotifications.instance.clearAlert();
          }
        }
      }
    }
  }
コード例 #7
0
 public void func_146113_a(SoundHandler p_146113_1_) {
   p_146113_1_.playSound(
       PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
 }