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++;
   }
 }
 protected void drawAuxGraphics(int posX, int posY) {
   ItemHashMap<Integer> items = this.getItemCounts();
   ArrayList<ItemStack> li = new ArrayList(items.keySet());
   Collections.sort(li, new AlphabeticItemComparator());
   for (int i = recipeTextOffset; i < li.size(); i++) {
     ItemStack is = li.get(i);
     int num = items.get(is);
     String s0 = is.getDisplayName();
     String s = String.format(": x%d", num);
     FontRenderer fr =
         s0.contains(FontType.OBFUSCATED.id) ? FontType.OBFUSCATED.renderer : fontRendererObj;
     s0 = DelegateFontRenderer.stripFlags(s0);
     fr.drawString(
         s0,
         posX + descX + 3,
         posY + descY + (fr.FONT_HEIGHT + 2) * (i - recipeTextOffset),
         0xffffff);
     fontRendererObj.drawString(
         s,
         posX + descX + 3 + fr.getStringWidth(s0),
         posY + descY + (fr.FONT_HEIGHT + 2) * (i - recipeTextOffset),
         0xffffff);
     if (i - recipeTextOffset > 9) break;
   }
 }
  @Override
  protected void writeSyncTag(NBTTagCompound NBT) {
    super.writeSyncTag(NBT);

    NBT.setBoolean("dig", digging);
    NBT.setBoolean("dig2", digReady);
    NBT.setInteger("index", index);
    NBT.setBoolean("finish", finishedDigging);

    NBTTagList li = new NBTTagList();
    for (ItemStack is : found.keySet()) {
      NBTTagCompound tag = new NBTTagCompound();
      tag.setInteger("id", Item.getIdFromItem(is.getItem()));
      tag.setInteger("meta", is.getItemDamage());
      tag.setInteger("count", found.get(is));
      li.appendTag(tag);
    }
    NBT.setTag("count", li);

    NBT.setBoolean("dropped", dropFlag);
  }