--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java
+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java
@@ -49,6 +49,8 @@
     private boolean field_147057_D;
     private CreativeCrafting field_147059_E;
     private static final String __OBFID = "CL_00000752";
+    private static int tabPage = 0;
+    private int maxPages = 0;
 
     public GuiContainerCreative(EntityPlayer p_i1088_1_)
     {
@@ -187,7 +189,7 @@
                         return;
                     }
 
-                    if (itemstack1 != null && itemstack2 != null && itemstack1.func_77969_a(itemstack2))
+                    if (itemstack1 != null && itemstack2 != null && itemstack1.func_77969_a(itemstack2) && ItemStack.func_77970_a(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770
                     {
                         if (p_146984_3_ == 0)
                         {
@@ -262,6 +264,13 @@
             this.func_147050_b(CreativeTabs.field_78032_a[i]);
             this.field_147059_E = new CreativeCrafting(this.field_146297_k);
             this.field_146297_k.field_71439_g.field_71069_bz.func_75132_a(this.field_147059_E);
+            int tabCount = CreativeTabs.field_78032_a.length;
+            if (tabCount > 12)
+            {
+                field_146292_n.add(new GuiButton(101, field_147003_i,              field_147009_r - 50, 20, 20, "<"));
+                field_146292_n.add(new GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">"));
+                maxPages = ((tabCount - 12) / 10) + 1;
+            }
         }
         else
         {
@@ -283,7 +292,7 @@
 
     protected void func_73869_a(char p_73869_1_, int p_73869_2_) throws IOException
     {
-        if (field_147058_w != CreativeTabs.field_78027_g.func_78021_a())
+        if (!CreativeTabs.field_78032_a[field_147058_w].hasSearchBar())
         {
             if (GameSettings.func_100015_a(this.field_146297_k.field_71474_y.field_74310_D))
             {
@@ -320,6 +329,15 @@
     {
         GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
         containercreative.field_148330_a.clear();
+
+        CreativeTabs tab = CreativeTabs.field_78032_a[field_147058_w];
+        if (tab.hasSearchBar() && tab != CreativeTabs.field_78027_g)
+        {
+            tab.func_78018_a(containercreative.field_148330_a);
+            updateFilteredItems(containercreative);
+            return;
+        }
+
         Iterator iterator = Item.field_150901_e.iterator();
 
         while (iterator.hasNext())
@@ -331,10 +349,17 @@
                 item.func_150895_a(item, (CreativeTabs)null, containercreative.field_148330_a);
             }
         }
+        updateFilteredItems(containercreative);
+    }
 
+    //split from above for custom search tabs
+    private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative)
+    {
+        Iterator iterator;
         Enchantment[] aenchantment = Enchantment.field_77331_b;
         int j = aenchantment.length;
 
+        if (CreativeTabs.field_78032_a[field_147058_w] != CreativeTabs.field_78027_g) j = 0; //Forge: Don't add enchants to custom tabs.
         for (int i = 0; i < j; ++i)
         {
             Enchantment enchantment = aenchantment[i];
@@ -385,7 +410,7 @@
     {
         CreativeTabs creativetabs = CreativeTabs.field_78032_a[field_147058_w];
 
-        if (creativetabs.func_78019_g())
+        if (creativetabs != null && creativetabs.func_78019_g())
         {
             GlStateManager.func_179084_k();
             this.field_146289_q.func_78276_b(I18n.func_135052_a(creativetabs.func_78024_c(), new Object[0]), 8, 6, 4210752);
@@ -428,7 +453,7 @@
             {
                 CreativeTabs creativetabs = acreativetabs[k1];
 
-                if (this.func_147049_a(creativetabs, l, i1))
+                if (creativetabs != null && this.func_147049_a(creativetabs, l, i1))
                 {
                     this.func_147050_b(creativetabs);
                     return;
@@ -441,11 +466,13 @@
 
     private boolean func_147055_p()
     {
+        if (CreativeTabs.field_78032_a[field_147058_w] == null) return false;
         return field_147058_w != CreativeTabs.field_78036_m.func_78021_a() && CreativeTabs.field_78032_a[field_147058_w].func_78017_i() && ((GuiContainerCreative.ContainerCreative)this.field_147002_h).func_148328_e();
     }
 
     private void func_147050_b(CreativeTabs p_147050_1_)
     {
+        if (p_147050_1_ == null) return;
         int i = field_147058_w;
         field_147058_w = p_147050_1_.func_78021_a();
         GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
@@ -514,12 +541,14 @@
 
         if (this.field_147062_A != null)
         {
-            if (p_147050_1_ == CreativeTabs.field_78027_g)
+            if (p_147050_1_.hasSearchBar())
             {
                 this.field_147062_A.func_146189_e(true);
                 this.field_147062_A.func_146205_d(false);
                 this.field_147062_A.func_146195_b(true);
                 this.field_147062_A.func_146180_a("");
+                this.field_147062_A.field_146218_h = p_147050_1_.getSearchbarWidth();
+                this.field_147062_A.field_146209_f = this.field_147003_i + (82 /*default left*/ + 89 /*default width*/) - this.field_147062_A.field_146218_h;
                 this.func_147053_i();
             }
             else
@@ -590,23 +619,45 @@
 
         super.func_73863_a(p_73863_1_, p_73863_2_, p_73863_3_);
         CreativeTabs[] acreativetabs = CreativeTabs.field_78032_a;
-        int i2 = acreativetabs.length;
+        int start = tabPage * 10;
+        int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2);
+        if (tabPage != 0) start += 2;
+        boolean rendered = false;
 
-        for (int j2 = 0; j2 < i2; ++j2)
+        for (int j2 = start; j2 < i2; ++j2)
         {
             CreativeTabs creativetabs = acreativetabs[j2];
 
+            if (creativetabs == null) continue;
             if (this.func_147052_b(creativetabs, p_73863_1_, p_73863_2_))
             {
+                rendered = true;
                 break;
             }
         }
 
+        if (!rendered && func_147052_b(CreativeTabs.field_78027_g, p_73863_1_, p_73863_2_))
+        {
+            func_147052_b(CreativeTabs.field_78036_m, p_73863_1_, p_73863_2_);
+        }
+
         if (this.field_147064_C != null && field_147058_w == CreativeTabs.field_78036_m.func_78021_a() && this.func_146978_c(this.field_147064_C.field_75223_e, this.field_147064_C.field_75221_f, 16, 16, p_73863_1_, p_73863_2_))
         {
             this.func_146279_a(I18n.func_135052_a("inventory.binSlot", new Object[0]), p_73863_1_, p_73863_2_);
         }
 
+        if (maxPages != 0)
+        {
+            String page = String.format("%d / %d", tabPage + 1, maxPages + 1);
+            int width = field_146289_q.func_78256_a(page);
+            GlStateManager.func_179140_f();
+            this.field_73735_i = 300.0F;
+            field_146296_j.field_77023_b = 300.0F;
+            field_146289_q.func_78276_b(page, field_147003_i + (field_146999_f / 2) - (width / 2), field_147009_r - 44, -1);
+            this.field_73735_i = 0.0F;
+            field_146296_j.field_77023_b = 0.0F;
+        }
+
         GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
         GlStateManager.func_179140_f();
     }
@@ -675,17 +726,36 @@
         int k = acreativetabs.length;
         int l;
 
-        for (l = 0; l < k; ++l)
+        int start = tabPage * 10;
+        k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2));
+        if (tabPage != 0) start += 2;
+
+        for (l = start; l < k; ++l)
         {
             CreativeTabs creativetabs1 = acreativetabs[l];
             this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
 
+            if (creativetabs1 == null) continue;
             if (creativetabs1.func_78021_a() != field_147058_w)
             {
                 this.func_147051_a(creativetabs1);
             }
         }
 
+        if (tabPage != 0)
+        {
+            if (creativetabs != CreativeTabs.field_78027_g)
+            {
+                this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
+                func_147051_a(CreativeTabs.field_78027_g);
+            }
+            if (creativetabs != CreativeTabs.field_78036_m)
+            {
+                this.field_146297_k.func_110434_K().func_110577_a(field_147061_u);
+                func_147051_a(CreativeTabs.field_78036_m);
+            }
+        }
+
         this.field_146297_k.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.func_78015_f()));
         this.func_73729_b(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g);
         this.field_147062_A.func_146194_f();
@@ -700,6 +770,14 @@
             this.func_73729_b(i1, k + (int)((float)(l - k - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15);
         }
 
+        if (creativetabs == null || creativetabs.getTabPage() != tabPage)
+        {
+            if (creativetabs != CreativeTabs.field_78027_g && creativetabs != CreativeTabs.field_78036_m)
+            {
+                return;
+            }
+        }
+
         this.func_147051_a(creativetabs);
 
         if (creativetabs == CreativeTabs.field_78036_m)
@@ -710,6 +788,15 @@
 
     protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_)
     {
+        if (p_147049_1_.getTabPage() != tabPage)
+        {
+            if (p_147049_1_ != CreativeTabs.field_78027_g &&
+                p_147049_1_ != CreativeTabs.field_78036_m)
+            {
+                return false;
+            }
+        }
+
         int k = p_147049_1_.func_78020_k();
         int l = 28 * k;
         byte b0 = 0;
@@ -810,6 +897,8 @@
         }
 
         GlStateManager.func_179140_f();
+        GlStateManager.func_179124_c(1F, 1F, 1F); //Forge: Reset color in case Items change it.
+        GlStateManager.func_179147_l(); //Forge: Make sure blend is enabled else tabs show a white border.
         this.func_73729_b(l, i1, j, k, 28, b0);
         this.field_73735_i = 100.0F;
         this.field_146296_j.field_77023_b = 100.0F;
@@ -836,6 +925,15 @@
         {
             this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.field_71439_g.func_146107_m()));
         }
+
+        if (p_146284_1_.field_146127_k == 101)
+        {
+            tabPage = Math.max(tabPage - 1, 0);
+        }
+        else if (p_146284_1_.field_146127_k == 102)
+        {
+            tabPage = Math.min(tabPage + 1, maxPages);
+        }
     }
 
     public int func_147056_g()
