--- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java
+++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java
@@ -139,8 +139,22 @@
     private ItemStack field_151245_t;
     private static final String __OBFID = "CL_00000005";
 
+    public CreativeTabs(String label)
+    {
+        this(getNextID(), label);
+    }
+
     public CreativeTabs(int p_i1853_1_, String p_i1853_2_)
     {
+        if (p_i1853_1_ >= field_78032_a.length)
+        {
+            CreativeTabs[] tmp = new CreativeTabs[p_i1853_1_ + 1];
+            for (int x = 0; x < field_78032_a.length; x++)
+            {
+                tmp[x] = field_78032_a[x];
+            }
+            field_78032_a = tmp;
+        }
         this.field_78033_n = p_i1853_1_;
         this.field_78034_o = p_i1853_2_;
         field_78032_a[p_i1853_1_] = this;
@@ -223,12 +237,20 @@
     @SideOnly(Side.CLIENT)
     public int func_78020_k()
     {
+        if (field_78033_n > 11)
+        {
+            return ((field_78033_n - 12) % 10) % 5;
+        }
         return this.field_78033_n % 6;
     }
 
     @SideOnly(Side.CLIENT)
     public boolean func_78023_l()
     {
+        if (field_78033_n > 11)
+        {
+            return ((field_78033_n - 12) % 10) < 5;
+        }
         return this.field_78033_n < 6;
     }
 
@@ -278,10 +300,17 @@
         while (iterator.hasNext())
         {
             Item item = (Item)iterator.next();
+            if (item == null)
+            {
+                continue;
+            }
 
-            if (item != null && item.func_77640_w() == this)
+            for (CreativeTabs tab : item.getCreativeTabs())
             {
-                item.func_150895_a(item, this, p_78018_1_);
+                if (tab == this)
+                {
+                    item.func_150895_a(item, this, p_78018_1_);
+                }
             }
         }
 
@@ -320,4 +349,39 @@
             }
         }
     }
+
+    public int getTabPage()
+    {
+        if (field_78033_n > 11)
+        {
+            return ((field_78033_n - 12) / 10) + 1;
+        }
+        return 0;
+    }
+
+    public static int getNextID()
+    {
+        return field_78032_a.length;
+    }
+
+    /**
+     * Determines if the search bar should be shown for this tab.
+     *
+     * @return True to show the bar
+     */
+    public boolean hasSearchBar()
+    {
+        return field_78033_n == CreativeTabs.field_78027_g.field_78033_n;
+    }
+
+    /**
+     * Gets the width of the search bar of the creative tab, use this if your
+     * creative tab name overflows together with a custom texture.
+     *
+     * @return The width of the search bar, 89 by default
+     */
+    public int getSearchbarWidth()
+    {
+        return 89;
+    }
 }
