Files
2019-02-24 22:29:41 +08:00

87 lines
2.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java
+++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java
@@ -131,8 +131,22 @@
private EnumEnchantmentType[] enchantmentTypes = new EnumEnchantmentType[0];
private ItemStack iconItemStack;
+ public CreativeTabs(String label)
+ {
+ this(getNextID(), label);
+ }
+
public CreativeTabs(int index, String label)
{
+ if (index >= CREATIVE_TAB_ARRAY.length)
+ {
+ CreativeTabs[] tmp = new CreativeTabs[index + 1];
+ for (int x = 0; x < CREATIVE_TAB_ARRAY.length; x++)
+ {
+ tmp[x] = CREATIVE_TAB_ARRAY[x];
+ }
+ CREATIVE_TAB_ARRAY = tmp;
+ }
this.tabIndex = index;
this.tabLabel = label;
this.iconItemStack = ItemStack.EMPTY;
@@ -210,12 +224,20 @@
@SideOnly(Side.CLIENT)
public int getTabColumn()
{
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) % 10) % 5;
+ }
return this.tabIndex % 6;
}
@SideOnly(Side.CLIENT)
public boolean isTabInFirstRow()
{
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) % 10) < 5;
+ }
return this.tabIndex < 6;
}
@@ -260,4 +282,39 @@
item.getSubItems(this, p_78018_1_);
}
}
+
+ public int getTabPage()
+ {
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) / 10) + 1;
+ }
+ return 0;
+ }
+
+ public static int getNextID()
+ {
+ return CREATIVE_TAB_ARRAY.length;
+ }
+
+ /**
+ * Determines if the search bar should be shown for this tab.
+ *
+ * @return True to show the bar
+ */
+ public boolean hasSearchBar()
+ {
+ return tabIndex == CreativeTabs.SEARCH.tabIndex;
+ }
+
+ /**
+ * 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;
+ }
}