New hook to allow items to be on multiple creative tabs PR 176

This commit is contained in:
LexManos 2012-10-28 05:52:49 -07:00
parent d7de1e8be2
commit 1a7e580f01
2 changed files with 34 additions and 5 deletions

View file

@ -60,10 +60,27 @@
return this.tabIndex < 6;
}
@@ -150,4 +174,26 @@
@@ -144,10 +168,40 @@
{
Item var5 = var2[var4];
- if (var5 != null && var5.getCreativeTab() == this)
+ if (var5 == null)
{
- var5.getSubItems(var5.shiftedIndex, this, par1List);
+ continue;
}
}
}
- }
+
+ for(CreativeTabs tab : var5.getCreativeTabs())
+ {
+ if (tab == this)
+ {
+ var5.getSubItems(var5.shiftedIndex, this, par1List);
+ }
+ }
+ }
+ }
+
+ public int getTabPage()
+ {
@ -85,5 +102,5 @@
+ public ItemStack getIconItemStack()
+ {
+ return new ItemStack(getTabIconItem());
+ }
}
}

View file

@ -37,7 +37,7 @@
Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3);
}
@@ -674,4 +686,240 @@
@@ -674,4 +686,252 @@
{
StatList.initStats();
}
@ -276,5 +276,17 @@
+ public Entity createEntity(World world, Entity location, ItemStack itemstack)
+ {
+ return null;
+ }
+
+ /**
+ * Gets a list of tabs that items belonging to this class can display on,
+ * combined properly with getSubItems allows for a single item to span
+ * many sub-items across many tabs.
+ *
+ * @return A list of all tabs that this item could possibly be one.
+ */
+ public CreativeTabs[] getCreativeTabs()
+ {
+ return new CreativeTabs[]{ getCreativeTab() };
+ }
}