net.minecraft.creativetab.CreativeTabs Java Examples

The following examples show how to use net.minecraft.creativetab.CreativeTabs. 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 File: ItemHelper.java    From customstuff4 with 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 #2
Source File: ItemHelperTests.java    From customstuff4 with 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 #3
Source File: ItemArmorCyberware.java    From Cyberware with 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 #4
Source File: ItemBlockEUStorage.java    From Production-Line with 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 #5
Source File: Forbidden.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
@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 #6
Source File: StoneBlock.java    From GregTech with 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 #7
Source File: MoCItemWeapon.java    From mocreaturesdev with 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 #8
Source File: BlockFluidPipe.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 #9
Source File: MoCBlockGrass.java    From mocreaturesdev with 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 #10
Source File: BW_TileEntityContainer_Multiple.java    From bartworks with 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 #11
Source File: CategoryConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 #12
Source File: CategoryConverter.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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 #13
Source File: ItemPack.java    From SimplyJetpacks with 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 #14
Source File: GT_Rockcutter_Item.java    From bartworks with 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 #15
Source File: ItemNanoWing.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@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()));
    }
}
 
Example #16
Source File: ItemDrone.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item par1, CreativeTabs tab, List subItems){
    subItems.add(new ItemStack(this));
    ItemStack chargedStack = new ItemStack(this);
    addAir(chargedStack, (int)(PneumaticValues.DRONE_VOLUME * PneumaticValues.DRONE_MAX_PRESSURE));
    subItems.add(chargedStack);
}
 
Example #17
Source File: BlockThinLogFence.java    From GardenCollection with 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 #18
Source File: BlockMultiblockGlass.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
	for(int i = 0; i < subBlocks.length; i++) {
		par3List.add(new ItemStack(this, 1, i));
	}
}
 
Example #19
Source File: NEICreativeGuiHandler.java    From NotEnoughItems with MIT License 5 votes vote down vote up
@Override
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility)
{
    if(!(gui instanceof GuiContainerCreative))
        return currentVisibility;
    
    if(((GuiContainerCreative)gui).getSelectedTabIndex() != CreativeTabs.tabInventory.getTabIndex())
        currentVisibility.showItemSection = currentVisibility.enableDeleteMode = false;

    return currentVisibility;
}
 
Example #20
Source File: BW_Meta_Items.java    From bartworks with MIT License 5 votes vote down vote up
private BW_GT_MetaGen_Item_Hook(String aUnlocalized) {
    super(aUnlocalized);

    this.setCreativeTab(new CreativeTabs("bw.MetaItems.0") {
        @Override
        public Item getTabIconItem() {
            return ItemRegistry.TAB;
        }
    });
    this.setHasSubtypes(true);
    this.setMaxDamage(0);
    BW_Meta_Items.BW_GT_MetaGen_Item_Hook.sInstances.add(this);
}
 
Example #21
Source File: ItemStaffTeleport.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public ItemStaffTeleport(int i)
{
	super(i);
	maxStackSize = 1;
	setMaxDamage(128);
	this.setCreativeTab(CreativeTabs.tabTools);

}
 
Example #22
Source File: GTItemEnergyPack.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
	if (this.isInCreativeTab(tab)) {
		ItemStack empty = new ItemStack(this);
		ItemStack full = new ItemStack(this);
		ElectricItem.manager.discharge(empty, 2.147483647E9D, 2147483647, true, false, false);
		ElectricItem.manager.charge(full, 2.147483647E9D, 2147483647, true, false);
		subItems.add(empty);
		subItems.add(full);
	}
}
 
Example #23
Source File: AliquoItemOre.java    From Ex-Aliquo with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@Override
public void getSubItems(int id, CreativeTabs tabs, List subItems)
{
	for (int i = 0; i < 3; i++) {
		subItems.add(new ItemStack(id, 1, i));
	}
}
 
Example #24
Source File: ChunkLoaderProxy.java    From ChickenChunks with MIT License 5 votes vote down vote up
public void init()
{
    blockChunkLoader = new BlockChunkLoader();
    blockChunkLoader.setBlockName("chickenChunkLoader").setCreativeTab(CreativeTabs.tabMisc);
    GameRegistry.registerBlock(blockChunkLoader, ItemChunkLoader.class, "chickenChunkLoader");
    
    GameRegistry.registerTileEntity(TileChunkLoader.class, "ChickenChunkLoader");
    GameRegistry.registerTileEntity(TileSpotLoader.class, "ChickenSpotLoader");
    
    PacketCustom.assignHandler(ChunkLoaderSPH.channel, new ChunkLoaderSPH());
    ChunkLoaderManager.initConfig(config);
    
    MinecraftForge.EVENT_BUS.register(new ChunkLoaderEventHandler());
    FMLCommonHandler.instance().bus().register(new ChunkLoaderEventHandler());
    ChunkLoaderManager.registerMod(instance);
    
    GameRegistry.addRecipe(new ItemStack(blockChunkLoader, 1, 0), 
        " p ",
        "ggg",
        "gEg",
        'p', Items.ender_pearl,
        'g', Items.gold_ingot,
        'd', Items.diamond,
        'E', Blocks.enchanting_table
    );
    
    GameRegistry.addRecipe(new ItemStack(blockChunkLoader, 10, 1), 
            "ppp",
            "pcp",
            "ppp",
            'p', Items.ender_pearl,
            'c', new ItemStack(blockChunkLoader, 1, 0)
    );
}
 
Example #25
Source File: ItemGunAmmo.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
    super.getSubItems(item, tab, list);
    List<ItemStack> potions = new ArrayList<ItemStack>();
    Items.potionitem.getSubItems(Items.potionitem, tab, potions);
    for(ItemStack potion : potions) {
        ItemStack ammo = new ItemStack(item);
        setPotion(ammo, potion);
        list.add(ammo);
    }
}
 
Example #26
Source File: ItemWithSubtypesMixin.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems)
{
    if (isInCreativeTab(creativeTab))
    {
        subItems.addAll(ItemHelper.createSubItems(this, creativeTab, getContent().creativeTab, getContent().subtypes));
    }
}
 
Example #27
Source File: ItemOmnitoolIron.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@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()));
    }
}
 
Example #28
Source File: CarvableHelper.java    From Chisel with GNU General Public License v2.0 5 votes vote down vote up
public void registerSubBlocks(Block block, CreativeTabs tabs, List list)
{
    for(CarvableVariation variation : variations)
    {
        list.add(new ItemStack(block, 1, variation.metadata));
    }
}
 
Example #29
Source File: ItemElectricGoggles.java    From Electro-Magic-Tools with GNU General Public License v3.0 5 votes vote down vote up
@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()));
    }
}
 
Example #30
Source File: ItemStorageComponent.java    From ExtraCells1 with MIT License 5 votes vote down vote up
@SuppressWarnings({ "unchecked", "rawtypes" })
@SideOnly(Side.CLIENT)
public void getSubItems(int itemID, CreativeTabs creativeTab, List itemList)
{
	for (int j = 0; j < suffixes.length; ++j)
	{
		itemList.add(new ItemStack(itemID, 1, j));
	}
}