private void drawTally(int j, int k) {
   ItemHashMap<Integer> map = array.tally();
   int i = 0;
   int n = 8;
   for (ItemStack is : map.keySet()) {
     int dx = j + 10 + (i / n) * 50;
     int dy = k + 30 + (i % n) * 22;
     ItemStack is2 = is.copy();
     if (ChromaBlocks.CHROMA.match(is)) {
       is2 = ChromaItems.BUCKET.getStackOfMetadata(0);
     } else if (ChromaBlocks.RUNE.match(is)) {
       is2 = ChromaBlocks.RUNE.getStackOfMetadata(getElementByTick());
     } else if (page == ChromaResearch.PORTALSTRUCT
         && Block.getBlockFromItem(is.getItem()) == Blocks.bedrock) {
       is2 = ChromaItems.ENDERCRYSTAL.getStackOfMetadata(1);
     } else if (page == ChromaResearch.TREE
         && Block.getBlockFromItem(is.getItem()) == ChromaBlocks.PYLON.getBlockInstance()) {
       is2 = ChromaTiles.POWERTREE.getCraftedProduct();
     } else if (page == ChromaResearch.CLOAKTOWER
         && Block.getBlockFromItem(is.getItem())
             == ChromaBlocks.TILEMODELLED2.getBlockInstance()) {
       is2 = ChromaTiles.CLOAKING.getCraftedProduct();
     }
     api.drawItemStackWithTooltip(itemRender, fontRendererObj, is2, dx, dy);
     fontRendererObj.drawString(String.valueOf(map.get(is)), dx + 20, dy + 5, 0xffffff);
     i++;
   }
 }
  public GuiStructure(EntityPlayer ep, ChromaResearch r) {
    super(ep, r, 256, 220, false);

    array = page.getStructure().getStructureForDisplay();
    if (page.name().toLowerCase().contains("casting")) {
      array.setBlock(
          array.getMidX(),
          array.getMinY() + 1,
          array.getMidZ(),
          ChromaTiles.TABLE.getBlock(),
          ChromaTiles.TABLE.getBlockMetadata());
    }
    if (page == ChromaResearch.TREE) {
      array.setBlock(
          array.getMinX() + 1,
          array.getMinY() + 12,
          array.getMinZ() + 2,
          ChromaTiles.POWERTREE.getBlock(),
          ChromaTiles.POWERTREE.getBlockMetadata());
    }
    if (page == ChromaResearch.INFUSION) {
      array.setBlock(
          array.getMidX(),
          array.getMinY() + 2,
          array.getMidZ(),
          ChromaTiles.INFUSER.getBlock(),
          ChromaTiles.INFUSER.getBlockMetadata());
    }
    if (page == ChromaResearch.MINIPYLON) {
      array.setBlock(
          array.getMidX(),
          array.getMinY() + 6,
          array.getMidZ(),
          ChromaTiles.PERSONAL.getBlock(),
          ChromaTiles.PERSONAL.getBlockMetadata());
    }
    if (page == ChromaResearch.PYLON) {
      array.setBlock(
          array.getMidX(),
          array.getMinY() + 9,
          array.getMidZ(),
          ChromaTiles.PYLON.getBlock(),
          ChromaTiles.PYLON.getBlockMetadata());
    }
    if (page == ChromaResearch.CLOAKTOWER) {
      array.setBlock(
          array.getMidX(),
          array.getMinY() + 5,
          array.getMidZ(),
          ChromaTiles.CLOAKING.getBlock(),
          ChromaTiles.CLOAKING.getBlockMetadata());
    }
    render = new StructureRenderer(array);
    if (page == ChromaResearch.PYLON) {
      render.addOverride(
          array.getMidX(),
          array.getMinY() + 9,
          array.getMidZ(),
          ChromaTiles.PYLON.getCraftedProduct());
    } else if (page == ChromaResearch.MINIPYLON) {
      render.addOverride(
          array.getMidX(),
          array.getMinY() + 6,
          array.getMidZ(),
          ChromaTiles.PERSONAL.getCraftedProduct());
    } else if (page == ChromaResearch.CLOAKTOWER) {
      render.addOverride(
          array.getMidX(),
          array.getMinY() + 5,
          array.getMidZ(),
          ChromaTiles.CLOAKING.getCraftedProduct());
    } else if (page == ChromaResearch.TREE) {
      render.addOverride(
          array.getMinX() + 1,
          array.getMinY() + 12,
          array.getMinZ() + 2,
          ChromaTiles.POWERTREE.getCraftedProduct());
      render.addBlockHook(ChromaTiles.POWERTREE.getBlock(), new LumenTreeHook()); // Unused
    } else if (page == ChromaResearch.PORTALSTRUCT) {
      render.addBlockHook(Blocks.bedrock, new EnderCrystalHook());

      render.addEntityRender(-5, -1, -9, createCrystalRender());
      render.addEntityRender(-9, -1, -5, createCrystalRender());
      render.addEntityRender(5, -1, -9, createCrystalRender());
      render.addEntityRender(9, -1, -5, createCrystalRender());
      render.addEntityRender(-5, -1, 9, createCrystalRender());
      render.addEntityRender(-9, -1, 5, createCrystalRender());
      render.addEntityRender(5, -1, 9, createCrystalRender());
      render.addEntityRender(9, -1, 5, createCrystalRender());
    }
    render.addBlockHook(ChromaBlocks.RUNE.getBlockInstance(), new RuneRenderHook());
    render.addRenderHook(ChromaTiles.PYLON.getCraftedProduct(), new PylonRenderHook());
  }