package ljfa.advbackport.handlers;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class TooltipHandler {
    @SubscribeEvent
    public void onTooltip(ItemTooltipEvent event) {
        NBTTagCompound tag = event.itemStack.getTagCompound();
        if(tag != null && tag.hasKey("CanDestroy", 9)) {
            NBTTagList canDestrList = tag.getTagList("CanDestroy", 8);
            event.toolTip.add("Can break:");
            for(int i = 0; i < canDestrList.tagCount(); i++) {
                String str = canDestrList.getStringTagAt(i);
                event.toolTip.add(EnumChatFormatting.DARK_GRAY + str);
            }
        }
    }
}

@@ -29,16 +29,74 @@
 dlers;%0A%0A
+import java.util.List;%0A%0Aimport net.minecraft.block.Block;%0A
 import n
@@ -128,16 +128,16 @@
 mpound;%0A
-
 import n
@@ -624,12 +624,27 @@
 null
- && 
+) %7B%0A            if(
 tag.
@@ -686,34 +686,113 @@
     
-NBTTagList canDestr
+    event.toolTip.add(%22%22);%0A                event.toolTip.add(%22Can break:%22);%0A                addBlock
 List
- = 
+(
 tag.
@@ -818,18 +818,142 @@
 roy%22, 8)
-;%0A
+, event.toolTip);%0A            %7D%0A            else if(tag.hasKey(%22CanPlaceOn%22, 9)) %7B%0A                event.toolTip.add(%22%22);%0A    
         
@@ -972,36 +972,43 @@
 olTip.add(%22Can b
-reak
+e placed on
 :%22);%0A           
@@ -992,32 +992,217 @@
 aced on:%22);%0A    
+            addBlockList(tag.getTagList(%22CanPlaceOn%22, 8), event.toolTip);%0A            %7D%0A        %7D%0A    %7D%0A    %0A    private void addBlockList(NBTTagList blockList, List%3CString%3E toolTip) %7B%0A
         for(int 
@@ -1212,24 +1212,21 @@
  0; i %3C 
-canDestr
+block
 List.tag
@@ -1253,20 +1253,16 @@
         
-    
 String s
@@ -1270,16 +1270,13 @@
 r = 
-canDestr
+block
 List
@@ -1303,34 +1303,153 @@
             
-    event.
+Block block = Block.getBlockFromName(str);%0A            String name = block != null ? block.getLocalizedName() : str;%0A            
 toolTip.add(
@@ -1483,27 +1483,14 @@
 Y + 
-str);%0A            %7D
+name);
 %0A   

Add CanPlaceOn tooltip