Files
MinecraftForge/patches/minecraft/net/minecraft/creativetab/CreativeTabs.java.patch
T

98 lines
2.4 KiB
Diff

--- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java
+++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java
@@ -140,8 +140,22 @@
private ItemStack field_151245_t;
private static final String __OBFID = "CL_00000005";
+ public CreativeTabs(String lable)
+ {
+ this(getNextID(), lable);
+ }
+
public CreativeTabs(int par1, String par2Str)
{
+ if (par1 >= creativeTabArray.length)
+ {
+ CreativeTabs[] tmp = new CreativeTabs[par1 + 1];
+ for (int x = 0; x < creativeTabArray.length; x++)
+ {
+ tmp[x] = creativeTabArray[x];
+ }
+ creativeTabArray = tmp;
+ }
this.tabIndex = par1;
this.tabLabel = par2Str;
creativeTabArray[par1] = this;
@@ -226,6 +240,10 @@
@SideOnly(Side.CLIENT)
public int getTabColumn()
{
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) % 10) % 5;
+ }
return this.tabIndex % 6;
}
@@ -233,6 +251,10 @@
@SideOnly(Side.CLIENT)
public boolean isTabInFirstRow()
{
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) % 10) < 5;
+ }
return this.tabIndex < 6;
}
@@ -284,10 +306,18 @@
{
Item item = (Item)iterator.next();
- if (item != null && item.getCreativeTab() == this)
+ if (item == null)
{
- item.func_150895_a(item, this, par1List);
+ continue;
}
+
+ for (CreativeTabs tab : item.getCreativeTabs())
+ {
+ if (tab == this)
+ {
+ item.func_150895_a(item, this, par1List);
+ }
+ }
}
if (this.func_111225_m() != null)
@@ -326,4 +356,28 @@
}
}
}
+
+ public int getTabPage()
+ {
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) / 10) + 1;
+ }
+ return 0;
+ }
+
+ public static int getNextID()
+ {
+ return creativeTabArray.length;
+ }
+
+ /**
+ * Determines if the search bar should be shown for this tab.
+ *
+ * @return True to show the bar
+ */
+ public boolean hasSearchBar()
+ {
+ return tabIndex == CreativeTabs.tabAllSearch.tabIndex;
+ }
}