Ejemplo n.º 1
0
  @Override
  protected void keyTyped(char c, int i) {
    searchBar.textboxKeyTyped(c, i);
    if (searchBar.isFocused()) {
      onSearch();
    }
    if (i == 1) {
      if (searchBar.isFocused()) {
        searchBar.setText("");
        searchBar.setFocused(false);
        onSearchBarInteract();
      } else {
        exitWithoutUpdate();

        this.mc.setIngameFocus();
      }
    }
    if (!searchBar.isFocused()) {
      GameSettings gameSettings = Minecraft.getMinecraft().gameSettings;
      if (i == Keyboard.KEY_R) {
        mc.getSoundHandler()
            .playSound(
                PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
        randomize();
      } else if (i == Keyboard.KEY_TAB || i == gameSettings.keyBindChat.getKeyCode()) {
        searchBar.setFocused(true);
        onSearchBarInteract();
      } else if (i == Keyboard.KEY_H
          && !(stand.hatName.equalsIgnoreCase("") && view == VIEW_HATS)) {
        mc.getSoundHandler()
            .playSound(
                PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
        toggleHatsColourizer();
      } else if (i == Keyboard.KEY_N && !stand.hatName.equalsIgnoreCase("")) {
        mc.getSoundHandler()
            .playSound(
                PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
        removeHat();
      }
      if (view == VIEW_HATS) {
        if ((i == gameSettings.keyBindLeft.getKeyCode() || i == Keyboard.KEY_LEFT)
            && pageNumber > 0) {
          mc.getSoundHandler()
              .playSound(
                  PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
          switchPage(true);
        } else if ((i == gameSettings.keyBindRight.getKeyCode() || i == Keyboard.KEY_RIGHT)
            && !((pageNumber + 1) * 6 >= hatsToShow.size())) {
          mc.getSoundHandler()
              .playSound(
                  PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
          switchPage(false);
        }
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  public boolean mouseClicked(int button) {
    if (actionResult != null) actionResult.run();
    sounds.playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));

    return false;
  }
 @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));
   }
 }
Ejemplo n.º 4
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));
   }
 }
Ejemplo n.º 5
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);
  }
      @Override
      public boolean mousePressed(
          int slotIndex, int x, int y, int mouseEvent, int relativeX, int relativeY) {
        if (selectedMod != slotIndex) {
          selectedMod = slotIndex;

          mc.getSoundHandler()
              .playSound(
                  PositionedSoundRecord.createPositionedSoundRecord(
                      new ResourceLocation("gui.button.press"), 1.0F));
          return true;
        }

        return false;
      }
    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;
    }
Ejemplo n.º 8
0
    protected void func_148132_a(int p_148132_1_, int p_148132_2_) {
      this.field_148218_l = -1;

      if (p_148132_1_ >= 79 && p_148132_1_ < 115) {
        this.field_148218_l = 0;
      } else if (p_148132_1_ >= 129 && p_148132_1_ < 165) {
        this.field_148218_l = 1;
      } else if (p_148132_1_ >= 179 && p_148132_1_ < 215) {
        this.field_148218_l = 2;
      }

      if (this.field_148218_l >= 0) {
        this.func_148212_h(this.field_148218_l);
        this.mc
            .getSoundHandler()
            .playSound(
                PositionedSoundRecord.createPositionedSoundRecord(
                    new ResourceLocation("gui.button.press"), 1.0F));
      }
    }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
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();
          }
        }
      }
    }
  }
Ejemplo n.º 11
0
    public void update() {
      MusicTicker.MusicType musictype = this.field_147677_b.func_147109_W();

      if (FMLClientHandler.instance().getWorldClient() != null
          && FMLClientHandler.instance().getWorldClient().provider
              instanceof IGalacticraftWorldProvider) {
        musictype = MUSIC_TYPE_MARS;
      }

      if (this.field_147678_c != null) {
        if (!musictype
            .getMusicTickerLocation()
            .equals(this.field_147678_c.getPositionedSoundLocation())) {
          this.field_147677_b.getSoundHandler().stopSound(this.field_147678_c);
          this.field_147676_d =
              MathHelper.getRandomIntegerInRange(
                  this.field_147679_a, 0, musictype.func_148634_b() / 2);
        }

        if (!this.field_147677_b.getSoundHandler().isSoundPlaying(this.field_147678_c)) {
          this.field_147678_c = null;
          this.field_147676_d =
              Math.min(
                  MathHelper.getRandomIntegerInRange(
                      this.field_147679_a, musictype.func_148634_b(), musictype.func_148633_c()),
                  this.field_147676_d);
        }
      }

      if (this.field_147678_c == null && this.field_147676_d-- <= 0) {
        this.field_147678_c =
            PositionedSoundRecord.func_147673_a(musictype.getMusicTickerLocation());
        this.field_147677_b.getSoundHandler().playSound(this.field_147678_c);
        this.field_147676_d = Integer.MAX_VALUE;
      }
    }
Ejemplo n.º 12
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));
 }
Ejemplo n.º 13
0
 public void playPressSound(SoundHandler soundHandlerIn) {
   soundHandlerIn.playSound(
       PositionedSoundRecord.createPositionedSoundRecord(
           new ResourceLocation("gui.button.press"), 1.0F));
 }
Ejemplo n.º 14
0
 public void playSound(String soundName) {
   Minecraft.getMinecraft()
       .getSoundHandler()
       .playSound(PositionedSoundRecord.func_147673_a(new ResourceLocation(soundName)));
 }