ForgePatch/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch

107 lines
2.7 KiB
Diff

--- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java
+++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java
@@ -138,8 +138,22 @@
private ItemStack field_151245_t;
private static final String __OBFID = "CL_00000005";
+ public CreativeTabs(String lable)
+ {
+ this(getNextID(), lable);
+ }
+
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;
@@ -222,12 +236,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,18 @@
{
Item item = (Item)iterator.next();
- if (item != null && item.func_77640_w() == this)
+ if (item == null)
{
- item.func_150895_a(item, this, p_78018_1_);
+ continue;
}
+
+ for (CreativeTabs tab : item.getCreativeTabs())
+ {
+ if (tab == this)
+ {
+ item.func_150895_a(item, this, p_78018_1_);
+ }
+ }
}
if (this.func_111225_m() != null)
@@ -319,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;
+ }
}