Prevented BOP blocks/items from appearing in all creative tabs (closes #1048)

This commit is contained in:
Forstride 2017-06-13 00:42:02 -04:00
parent 23ad88b448
commit bfb1c17ae8
3 changed files with 22 additions and 13 deletions

View File

@ -48,16 +48,19 @@ public class ItemBOPBlock extends ItemBlock
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems)
{
ImmutableSet<IBlockState> presets = BlockStateUtils.getBlockPresets(this.block);
if (presets.isEmpty())
if (this.func_194125_a(tab))
{
subItems.add(new ItemStack(this.block, 1, 0));
}
else
{
for (IBlockState state : presets)
ImmutableSet<IBlockState> presets = BlockStateUtils.getBlockPresets(this.block);
if (presets.isEmpty())
{
subItems.add(new ItemStack(this.block, 1, this.block.getMetaFromState(state)));
subItems.add(new ItemStack(this.block, 1, 0));
}
else
{
for (IBlockState state : presets)
{
subItems.add(new ItemStack(this.block, 1, this.block.getMetaFromState(state)));
}
}
}
}

View File

@ -32,10 +32,13 @@ public class ItemGem extends Item
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems)
{
for (BOPGems gemType : BOPGems.values())
if (this.func_194125_a(tab))
{
subItems.add(new ItemStack(this, 1, gemType.ordinal()));
}
for (BOPGems gemType : BOPGems.values())
{
subItems.add(new ItemStack(this, 1, gemType.ordinal()));
}
}
}
// default behavior in Item is to return 0, but the meta value is important here because it determines which gem to use

View File

@ -59,9 +59,12 @@ public class ItemJarFilled extends Item
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems)
{
for (JarContents contents : JarContents.values())
if (this.func_194125_a(tab))
{
subItems.add(new ItemStack(this, 1, contents.ordinal()));
for (JarContents contents : JarContents.values())
{
subItems.add(new ItemStack(this, 1, contents.ordinal()));
}
}
}