Java Code Examples for net.minecraft.creativetab.CreativeTabs

The following examples show how to use net.minecraft.creativetab.CreativeTabs. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: customstuff4   Source File: ItemHelperTests.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Test
public void test_createSubItems_differentTabs()
{
    HashMap<Integer, String> map = Maps.newHashMap();
    map.put(0, "tools");
    map.put(1, "redstone");

    Attribute<String> tabLabels = Attribute.map(map);
    int[] subtypes = new int[] {0, 1};

    Item item = new Item();
    item.setHasSubtypes(true);

    NonNullList<ItemStack> subItems = ItemHelper.createSubItems(item, CreativeTabs.TOOLS, tabLabels, subtypes);

    assertSame(1, subItems.size());
    assertSame(0, subItems.get(0).getItemDamage());
}
 
Example 2
Source Project: Production-Line   Source File: ItemBlockEUStorage.java    License: MIT License 6 votes vote down vote up
/**
 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
 */
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(@Nonnull Item item, @Nonnull CreativeTabs creativeTabs, @Nonnull List<ItemStack> list) {
    super.getSubItems(item, creativeTabs, list);
    ItemStack itemStack;
    NBTTagCompound nbt;

    itemStack = PLBlocks.evsu.copy();
    nbt = StackUtil.getOrCreateNbtData(itemStack);
    nbt.setInteger("energy", (int) 1E8);
    list.add(itemStack);

    itemStack = PLBlocks.cseu.copy();
    nbt = StackUtil.getOrCreateNbtData(itemStack);
    nbt.setInteger("energy", (int) 720E3);
    list.add(itemStack);

    itemStack = PLBlocks.parallelSpaceSU.copy();
    nbt = StackUtil.getOrCreateNbtData(itemStack);
    nbt.setInteger("energy", (int) 2E8);
    list.add(itemStack);
}
 
Example 3
@EventHandler
public void prelude(FMLPreInitializationEvent event) {
    instance = this;
    Config.configurate(event.getSuggestedConfigurationFile());
    if (Config.wrathCage)
        crysTab = new CreativeTabs("mobcrystal"){
            @Override
            public Item getTabIconItem() {
                return ForbiddenItems.mobCrystal;
            }
        };
    Compat.initiate();
    DarkAspects.initAspects();
    Config.spawnilify();
    ForbiddenItems.addItems();
    ForbiddenBlocks.addBlocks();
    DarkEnchantments.hex();
    if(Compat.bm)
        DarkPotions.alchemize();
    proxy.registerRenderInfo();
}
 
Example 4
Source Project: Cyberware   Source File: ItemArmorCyberware.java    License: MIT License 6 votes vote down vote up
@Override
public void getSubItems(Item item, CreativeTabs tab, List list)
{
	if (this.getArmorMaterial() == CyberwareContent.trenchMat)
	{
		super.getSubItems(item, tab, list);
		ItemStack brown = new ItemStack(this);
		this.setColor(brown, 0x664028);
		list.add(brown);
		ItemStack white = new ItemStack(this);
		this.setColor(white, 0xEAEAEA);
		list.add(white);
	}
	else
	{
		super.getSubItems(item, tab, list);
	}
}
 
Example 5
Source Project: customstuff4   Source File: ItemHelper.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static NonNullList<ItemStack> createSubItems(Item item, CreativeTabs creativeTab, Attribute<String> tabLabels, int[] subtypes)
{
    NonNullList<ItemStack> list = NonNullList.create();

    if (item.getHasSubtypes())
    {
        for (int meta : subtypes)
        {
            tabLabels.get(meta)
                     .ifPresent(tabLabel ->
                                {
                                    if (creativeTab == null || creativeTab == CreativeTabs.SEARCH || Objects.equals(tabLabel, getTabLabel(creativeTab)))
                                    {
                                        list.add(new ItemStack(item, 1, meta));
                                    }
                                });
        }
    } else
    {
        list.add(new ItemStack(item, 1, 0));
    }

    return list;
}
 
Example 6
Source Project: mocreaturesdev   Source File: MoCBlockDirt.java    License: GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(int par1, CreativeTabs tab, List subItems) 
{
    for (int ix = 0; ix < MoCreatures.multiBlockNames.size(); ix++) 
    {
        subItems.add(new ItemStack(this, 1, ix));
    }
}
 
Example 7
Source Project: SimplyJetpacks   Source File: ItemPack.java    License: MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void getSubItems(Item item, CreativeTabs tab, List list) {
    for (Entry<Integer, T> e : this.packs.entrySet()) {
        e.getValue().addSubItems(this, e.getKey(), list);
    }
}
 
Example 8
Source Project: Sakura_mod   Source File: ItemHaori.java    License: MIT License 5 votes vote down vote up
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
	if(this.isInCreativeTab(tab)){
     for(String name : KimonoIDs){
         ItemStack kimono = KimonoLoader.getCustomKimono(name);
         if(!kimono.isEmpty()) items.add(kimono);
     }
	}
	super.getSubItems(tab, items);
}
 
Example 9
@SideOnly(Side.CLIENT)
@SuppressWarnings({"unchecked", "rawtypes"})
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
    for (int i = 0; i <= 4; i++) {
        list.add(new ItemStack(id, 1, i));
    }
}
 
Example 10
Source Project: Sakura_mod   Source File: BlockVanillaCrop.java    License: MIT License 5 votes vote down vote up
public BlockVanillaCrop() {
	super(Material.WOOD,false);
	this.setDefaultState(this.blockState.getBaseState().withProperty(this.getAgeProperty(), Integer.valueOf(0)));
	this.setTickRandomly(true);
	this.setCreativeTab((CreativeTabs) null);
	this.setHardness(2.0F);
	this.setSoundType(SoundType.WOOD);
}
 
Example 11
Source Project: Sakura_mod   Source File: BlockGrapeVine.java    License: MIT License 5 votes vote down vote up
public BlockGrapeVine() {
	super(Material.WOOD,false);
	this.setDefaultState(this.blockState.getBaseState().withProperty(this.getAgeProperty(), Integer.valueOf(0)));
	this.setTickRandomly(true);
	this.setCreativeTab((CreativeTabs) null);
	this.setHardness(2.0F);
	this.setSoundType(SoundType.WOOD);
}
 
Example 12
Source Project: Sakura_mod   Source File: BlockGrapeLeaves.java    License: MIT License 5 votes vote down vote up
public BlockGrapeLeaves() {
	super(Material.WOOD,false);
	this.setDefaultState(this.blockState.getBaseState().withProperty(this.getAgeProperty(), Integer.valueOf(0)));
	this.setTickRandomly(true);
	this.setCreativeTab((CreativeTabs) null);
	this.setHardness(2.0F);
	this.setSoundType(SoundType.WOOD);
}
 
Example 13
Source Project: GardenCollection   Source File: BlockHeavyChain.java    License: MIT License 5 votes vote down vote up
@Override
public void getSubBlocks (Item item, CreativeTabs creativeTabs, List list) {
    list.add(new ItemStack(item, 1, 0));
    list.add(new ItemStack(item, 1, 1));
    //list.add(new ItemStack(item, 1, 2));
    list.add(new ItemStack(item, 1, 3));
    list.add(new ItemStack(item, 1, 4));
    list.add(new ItemStack(item, 1, 5));
}
 
Example 14
Source Project: GardenCollection   Source File: BlockThinLogFence.java    License: MIT License 5 votes vote down vote up
@Override
public void getSubBlocks (Item item, CreativeTabs creativeTabs, List blockList) {
    for (int i = 0; i < 6; i++)
        blockList.add(new ItemStack(item, 1, i));

    for (Map.Entry<UniqueMetaIdentifier, Block> entry : WoodRegistry.instance().registeredTypes()) {
        if (entry.getValue() == Blocks.log || entry.getValue() == Blocks.log2)
            continue;

        int id = TileEntityWoodProxy.composeMetadata(entry.getValue(), entry.getKey().meta);
        blockList.add(new ItemStack(item, 1, id));
    }
}
 
Example 15
Source Project: Artifacts   Source File: ItemArtifact.java    License: MIT License 5 votes vote down vote up
/**
 * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
 */
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(Item item, CreativeTabs tabs, List list)
{
	list.add(new ItemStack(instance));
    for (int i = 0; i < 8; ++i)
    {
        list.add(ArtifactsAPI.artifacts.generateRandomArtifact());
    }
}
 
Example 16
Source Project: Sakura_mod   Source File: BlockShoji.java    License: MIT License 5 votes vote down vote up
@Override
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
    items.add(getItemStackWithType(0));
    items.add(getItemStackWithType(1));
    items.add(getItemStackWithType(2));
    items.add(getItemStackWithType(3));
    items.add(getItemStackWithType(4));
    items.add(getItemStackWithType(5));
}
 
Example 17
Source Project: GardenCollection   Source File: BlockLantern.java    License: MIT License 5 votes vote down vote up
@Override
public void getSubBlocks (Item item, CreativeTabs tab, List list) {
    list.add(new ItemStack(item, 1, 0));

    NBTTagCompound glassTag = new NBTTagCompound();
    glassTag.setBoolean("glass", true);

    for (int i = 0; i < 16; i++) {
        ItemStack entry = new ItemStack(item, 1, i);
        entry.setTagCompound(glassTag);
        list.add(entry);
    }
}
 
Example 18
@Override
public Category toNova(CreativeTabs creativeTab) {
	switch (creativeTab.getTabLabel()) {
		case "buildingBlocks":
			return Category.BUILDING_BLOCKS;
		case "decorations":
			return Category.DECORATIONS;
		case "redstone":
			return Category.TECHNOLOGY;
		case "transportation":
			return Category.TRANSPORTATION;
		case "food":
			return Category.FOOD;
		case "tools":
			return Category.TOOLS;
		case "combat":
			return Category.COMBAT;
		case "brewing":
			return Category.ALCHEMY;
		case "materials":
			return Category.MATERIALS;
		case "misc":
			return Category.MISCELLANEOUS;
		default:
			return new Category(creativeTab.getTabLabel(), ItemConverter.instance().toNova(creativeTab.getIconItemStack()));
	}
}
 
Example 19
Source Project: Et-Futurum   Source File: ItemGeneric.java    License: The Unlicense 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
public void getSubItems(Item item, CreativeTabs tabs, List list) {
	for (int i = 0; i < types.length; i++)
		list.add(new ItemStack(item, 1, i));
}
 
Example 20
Source Project: NewHorizonsCoreMod   Source File: OvenGlove.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void getSubItems( Item item, CreativeTabs tab, List list )
{
  for( int i = 0; i < 2; i++ )
  {
    list.add( new ItemStack( item, 1, i ) );
  }
}
 
Example 21
@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
    super.getSubItems(creativeTab, subItems);
    if (creativeTab == CreativeTabs.SEARCH) {
        DefaultSubItemHandler.addFluidContainerVariants(getStackForm(), subItems);
    }
}
 
Example 22
@Override
public Category toNova(CreativeTabs creativeTab) {
	switch (creativeTab.getTabLabel()) {
		case "buildingBlocks":
			return Category.BUILDING_BLOCKS;
		case "decorations":
			return Category.DECORATIONS;
		case "redstone":
			return Category.TECHNOLOGY;
		case "transportation":
			return Category.TRANSPORTATION;
		case "food":
			return Category.FOOD;
		case "tools":
			return Category.TOOLS;
		case "combat":
			return Category.COMBAT;
		case "brewing":
			return Category.ALCHEMY;
		case "materials":
			return Category.MATERIALS;
		case "misc":
			return Category.MISCELLANEOUS;
		default:
			return new Category(creativeTab.getTabLabel(), ItemConverter.instance().toNova(creativeTab.getIconItemStack()));
	}
}
 
Example 23
Source Project: GregTech   Source File: StoneBlock.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
    for (T variant : VALUES) {
        for (ChiselingVariant chiselingVariant : ChiselingVariant.values()) {
            list.add(getItemVariant(variant, chiselingVariant));
        }
    }
}
 
Example 24
Source Project: mocreaturesdev   Source File: MoCItemWeapon.java    License: GNU General Public License v3.0 5 votes vote down vote up
public MoCItemWeapon(int par1, EnumToolMaterial par2EnumToolMaterial)
{
    super(par1);
    this.toolMaterial = par2EnumToolMaterial;
    this.maxStackSize = 1;
    this.setMaxDamage(par2EnumToolMaterial.getMaxUses());
    this.setCreativeTab(CreativeTabs.tabCombat);
    this.weaponDamage = 4 + par2EnumToolMaterial.getDamageVsEntity();
}
 
Example 25
@Override
public void getSubBlocks(CreativeTabs itemIn, NonNullList<ItemStack> items) {
    for (Material material : enabledMaterials.keySet()) {
        for (FluidPipeType fluidPipeType : FluidPipeType.values()) {
            items.add(getItem(fluidPipeType, material));
        }
    }
}
 
Example 26
Source Project: mocreaturesdev   Source File: MoCBlockGrass.java    License: GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs tab, List subItems) 
   {
	for (int ix = 0; ix < MoCreatures.multiBlockNames.size(); ix++) {
		subItems.add(new ItemStack(this, 1, ix));
	}
}
 
Example 27
Source Project: bartworks   Source File: BW_TileEntityContainer_Multiple.java    License: MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
    for (int i = 0; i < this.textureNames.length; i++) {
        list.add(new ItemStack(item, 1, i));
    }
}
 
Example 28
@Override
public Category toNova(CreativeTabs creativeTab) {
	switch (creativeTab.getTabLabel()) {
		case "buildingBlocks":
			return Category.BUILDING_BLOCKS;
		case "decorations":
			return Category.DECORATIONS;
		case "redstone":
			return Category.TECHNOLOGY;
		case "transportation":
			return Category.TRANSPORTATION;
		case "food":
			return Category.FOOD;
		case "tools":
			return Category.TOOLS;
		case "combat":
			return Category.COMBAT;
		case "brewing":
			return Category.ALCHEMY;
		case "materials":
			return Category.MATERIALS;
		case "misc":
			return Category.MISCELLANEOUS;
		default:
			return new Category(creativeTab.getTabLabel(), ItemConverter.instance().toNova(creativeTab.getIconItemStack()));
	}
}
 
Example 29
Source Project: bartworks   Source File: GT_Rockcutter_Item.java    License: MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void getSubItems(Item p_150895_1_, CreativeTabs p_150895_2_, List itemList) {
    ItemStack itemStack = new ItemStack(this, 1);
    if (this.getChargedItem(itemStack) == this) {
        ItemStack charged = new ItemStack(this, 1);
        ElectricItem.manager.charge(charged, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false);
        itemList.add(charged);
    }
    if (this.getEmptyItem(itemStack) == this) {
        itemList.add(new ItemStack(this, 1, this.getMaxDamage()));
    }
}
 
Example 30
@SuppressWarnings({"rawtypes", "unchecked"})
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
    ItemStack itemStack = new ItemStack(this, 1);
    if (getChargedItem(itemStack) == this) {
        ItemStack charged = new ItemStack(this, 1);
        ElectricItem.manager.charge(charged, 2147483647, 2147483647, true, false);
        itemList.add(charged);
    }
    if (getEmptyItem(itemStack) == this) {
        itemList.add(new ItemStack(this, 1, getMaxDamage()));
    }
}