示例#1
0
  @Override
  public final void keyTyped(char c, int key) {
    super.keyTyped(c, key);

    if (ModList.NEI.isLoaded() && key == NEIClientConfig.getKeyBinding("gui.recipe")) {
      int x = ReikaGuiAPI.instance.getMouseRealX();
      int y = ReikaGuiAPI.instance.getMouseRealY();
      int j = (width - xSize) / 2 - 2;
      int k = (height - ySize) / 2 - 8;
      if (x >= j && y >= k && x < j + xSize && y < k + ySize) {
        ItemStack is = ReikaGuiAPI.instance.getItemRenderAt(x, y);
        if (is != null) {
          GuiCraftingRecipe.openRecipeGui("item", is);
        }
      }
    }

    if (key == Keyboard.KEY_LEFT) {
      this.prevPage();
    } else if (key == Keyboard.KEY_RIGHT) {
      this.nextPage();
    } else if (key == Keyboard.KEY_PRIOR) {
      this.prevScreen();
    } else if (key == Keyboard.KEY_NEXT) {
      this.nextScreen();
    }
  }
  @Override
  public final void keyTyped(char c, int key) {
    super.keyTyped(c, key);

    if (ModList.NEI.isLoaded() && key == NEIClientConfig.getKeyBinding("gui.recipe")) {
      int x = ReikaGuiAPI.instance.getMouseRealX();
      int y = ReikaGuiAPI.instance.getMouseRealY();
      int j = (width - xSize) / 2;
      int k = (height - ySize) / 2;
      if (x >= j && y >= k && x < j + xSize && y < k + ySize) {
        ItemStack is = ReikaGuiAPI.instance.getItemRenderAt(x, y);
        if (is != null) {
          ReikaSoundHelper.playClientSound(ChromaSounds.GUICLICK, player, 0.33F, 1);
          if (!MinecraftForge.EVENT_BUS.post(new NEIRecipeCheckEvent(null, is)))
            codechicken.nei.recipe.GuiCraftingRecipe.openRecipeGui("item", is);
        }
      }
    }
  }