Files
MinecraftForge/patches/common/net/minecraft/src/CreativeTabs.java.patch
T
2012-10-19 18:56:56 -07:00

90 lines
2.3 KiB
Diff

--- ../src_base/common/net/minecraft/src/CreativeTabs.java
+++ ../src_work/common/net/minecraft/src/CreativeTabs.java
@@ -2,11 +2,13 @@
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.Arrays;
import java.util.List;
public class CreativeTabs
{
- public static final CreativeTabs[] creativeTabArray = new CreativeTabs[12];
+ public static CreativeTabs[] creativeTabArray = new CreativeTabs[12];
public static final CreativeTabs tabBlock = new CreativeTabBlock(0, "buildingBlocks");
public static final CreativeTabs tabDecorations = new CreativeTabDeco(1, "decorations");
public static final CreativeTabs tabRedstone = new CreativeTabRedstone(2, "redstone");
@@ -29,8 +31,22 @@
/** Whether to draw the title in the foreground of the creative GUI */
private boolean drawTitle = true;
+ public CreativeTabs(String label)
+ {
+ this(getNextID(), label);
+ }
+
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;
@@ -117,6 +133,10 @@
*/
public int getTabColumn()
{
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) % 10) % 5;
+ }
return this.tabIndex % 6;
}
@@ -127,6 +147,10 @@
*/
public boolean isTabInFirstRow()
{
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) % 10) < 5;
+ }
return this.tabIndex < 6;
}
@@ -150,4 +174,26 @@
}
}
}
+
+ public int getTabPage()
+ {
+ if (tabIndex > 11)
+ {
+ return ((tabIndex - 12) / 10) + 1;
+ }
+ return 0;
+ }
+
+ public static int getNextID()
+ {
+ return creativeTabArray.length;
+ }
+
+ /**
+ * Get the ItemStack that will be rendered to the tab.
+ */
+ public ItemStack getIconItemStack()
+ {
+ return new ItemStack(getTabIconItem());
+ }
}