@Override
  public void initGui() {
    super.initGui();

    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;

    String file = "Textures/GUIs/Handbook/buttons.png";
    if (recipes.size() > 1) {
      buttonList.add(
          new CustomSoundImagedGuiButton(
              0, j + 205, k - 3, 10, 12, 183, 6, file, ChromatiCraft.class, this));
      buttonList.add(
          new CustomSoundImagedGuiButton(
              1, j + 215, k - 3, 10, 12, 193, 6, file, ChromatiCraft.class, this));
    }

    if (subpage == 0 && this.getItemCounts().size() > 10) {
      buttonList.add(
          new CustomSoundImagedGuiButton(
              2, j + 205, k + 50, 12, 10, 100, 6, file, ChromatiCraft.class, this));
      buttonList.add(
          new CustomSoundImagedGuiButton(
              3, j + 205, k + 60, 12, 10, 112, 6, file, ChromatiCraft.class, this));
    }
  }
  @Override
  public final void drawScreen(int x, int y, float f) {
    super.drawScreen(x, y, f);

    int posX = (width - xSize) / 2;
    int posY = (height - ySize) / 2 - 8;

    // if (subpage == 0 && !disable)
    this.drawRecipes();

    this.drawGraphics();

    RenderHelper.disableStandardItemLighting();
  }
 @Override
 protected void actionPerformed(GuiButton button) {
   if (System.currentTimeMillis() - buttoncooldown >= 50) {
     if (button.id == 2 && modifier > 0) {
       modifier--;
     } else if (button.id == 3) {
       if (modifier < view.getSizeY() - 1) modifier++;
     } else {
       modifier = 0;
     }
   }
   // renderq = 22.5F;
   super.actionPerformed(button);
   this.initGui();
 }
  @Override
  public void initGui() {
    super.initGui();
    render.resetRotation();
    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;

    buttonList.add(new CustomSoundGuiButton(0, j + 185, k - 2, 20, 20, "3D", this));
    buttonList.add(new CustomSoundGuiButton(1, j + 205, k - 2, 20, 20, "2D", this));
    buttonList.add(
        new CustomSoundGuiButton(4, mode == 1 ? j + 125 : j + 165, k - 2, 20, 20, "N#", this));

    if (mode == 1) {
      buttonList.add(new CustomSoundGuiButton(2, j + 165, k - 2, 20, 20, "+", this));
      buttonList.add(new CustomSoundGuiButton(3, j + 145, k - 2, 20, 20, "-", this));
    }
  }
  @Override
  public void initGui() {
    super.initGui();

    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;

    String file = "Textures/GUIs/Handbook/buttons.png";

    if (page == ChromaResearch.USINGRUNES && subpage == 1 && view.getSizeY() > 1) {
      buttonList.add(
          new CustomSoundImagedGuiButton(
              3, j + 230, k + 75, 12, 10, 100, 6, file, ChromatiCraft.class, this));
      buttonList.add(
          new CustomSoundImagedGuiButton(
              2, j + 230, k + 85, 12, 10, 112, 6, file, ChromatiCraft.class, this));
    }
  }
  @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);
        }
      }
    }
  }
 @Override
 protected void actionPerformed(GuiButton button) {
   if (button.id == 0 && index > 0) {
     index--;
     recipeTextOffset = 0;
     subpage = Math.min(subpage, this.getMaxSubpage());
   } else if (button.id == 1 && index < recipes.size() - 1) {
     index++;
     recipeTextOffset = 0;
     subpage = Math.min(subpage, this.getMaxSubpage());
   }
   if (button.id == 2 && recipeTextOffset > 0) {
     recipeTextOffset--;
   } else if (button.id == 3 && recipeTextOffset < this.getItemCounts().size() - 11) {
     recipeTextOffset++;
   }
   // renderq = 22.5F;
   super.actionPerformed(button);
   this.initGui();
 }
  @Override
  public void drawScreen(int mx, int my, float f) {
    int posX = (width - xSize) / 2;
    int posY = (height - ySize) / 2 - 8;
    super.drawScreen(mx, my, f);

    int c = 0xffffff;
    int px = posX + descX;
    if (subpage == 0 || page.sameTextAllSubpages()) {
      fontRendererObj.drawSplitString(
          String.format("%s", page.getData()), px, posY + descY, 242, c);
    }
    if (this.isElementPage()) {
      this.renderElementPage(CrystalElement.elements[subpage - 1], posX, posY, px, c);
    } else if (page == ChromaResearch.CRYSTALS) {
      this.renderCrystal(posX, posY);
    } else if (page == ChromaResearch.PYLONS) {
      this.renderPylon(posX, posY);
    } else if (page == ChromaResearch.USINGRUNES && subpage == 1) {
      this.renderRunes(posX, posY);
    }
  }
  @Override
  protected void actionPerformed(GuiButton b) {
    super.actionPerformed(b);

    if (b.id == 0) {
      mode = 0;
      render.reset();
      this.initGui();
    } else if (b.id == 1) {
      mode = 1;
      this.initGui();
    } else if (b.id == 2) {
      render.incrementStepY();
      this.initGui();
    } else if (b.id == 3) {
      render.decrementStepY();
      this.initGui();
    } else if (b.id == 4) {
      mode = 2;
      this.initGui();
    }
  }
  @Override
  public final void drawScreen(int mx, int my, float f) {
    super.drawScreen(mx, my, f);

    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;

    tick++;

    // FilledBlockArray arr = page.getStructure().getStructureForDisplay();

    switch (mode) {
      case 0:
        this.draw3d(j, k, f);
        break;
      case 1:
        this.drawSlice(j, k);
        break;
      case 2:
        this.drawTally(j, k);
        break;
    }
  }