package net.silentchaos512.lib.item;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.silentchaos512.lib.SilentLib;
import net.silentchaos512.lib.block.BlockSL;
import net.silentchaos512.lib.registry.IHasSubtypes;
import net.silentchaos512.lib.registry.IRegistryObject;
import net.silentchaos512.lib.util.LocalizationHelper;

public class ItemBlockSL extends ItemBlock {

  protected Block block;
  protected String blockName = "null";
  protected String unlocalizedName = "null";
  protected String modId = "null";

  public ItemBlockSL(Block block) {

    super(block);
    this.block = block;
    setMaxDamage(0);

    if (block instanceof IHasSubtypes) {
      setHasSubtypes(((IHasSubtypes) block).hasSubtypes());
    }
    if (block instanceof IRegistryObject) {
      IRegistryObject obj = (IRegistryObject) block;
      blockName = obj.getName();
      unlocalizedName = "tile." + obj.getFullName();
      modId = obj.getModId();
    }
  }

  @Override
  public int getMetadata(int meta) {

    return meta;
  }

  @Override
  public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {

    LocalizationHelper loc = SilentLib.instance.getLocalizationHelperForMod(modId);
    if (loc != null) {
      String name = getNameForStack(stack);
      list.addAll(loc.getBlockDescriptionLines(name));
    }
  }

  @Override
  public String getUnlocalizedName(ItemStack stack) {

    return unlocalizedName + (hasSubtypes ? stack.getItemDamage() : "");
  }

  public String getNameForStack(ItemStack stack) {

    return blockName + (hasSubtypes ? stack.getItemDamage() : "");
  }
}

@@ -257,53 +257,8 @@
 ib;%0A
-import net.silentchaos512.lib.block.BlockSL;%0A
 impo
@@ -468,33 +468,8 @@
  %7B%0A%0A
-  protected Block block;%0A
   pr
@@ -643,32 +643,8 @@
 k);%0A
-    this.block = block;%0A
     
@@ -1151,14 +1151,28 @@
 List
- list,
+%3CString%3E list,%0A     
  boo
@@ -1185,24 +1185,249 @@
 dvanced) %7B%0A%0A
+    // Get tooltip from block? (New method)%0A    int length = list.size();%0A    block.addInformation(stack, player, list, advanced);%0A%0A    // If block doesn't add anything, use the old method.%0A    if (length == list.size()) %7B%0A  
     Localiza
@@ -1498,24 +1498,26 @@
 modId);%0A    
+  
 if (loc != n
@@ -1529,16 +1529,18 @@
 %7B%0A      
+ 
+ 
 String n
@@ -1565,24 +1565,26 @@
 ack(stack);%0A
+  
       list.a
@@ -1622,24 +1622,32 @@
 nes(name));%0A
+      %7D%0A
     %7D%0A  %7D%0A%0A 

Allow blocks to add tooltip info