Java Code Examples for net.minecraft.creativetab.CreativeTabs#SEARCH

The following examples show how to use net.minecraft.creativetab.CreativeTabs#SEARCH . 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: ItemAgriSeed.java    From AgriCraft with MIT License 6 votes vote down vote up
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
    if (tab == this.getCreativeTab() || tab == CreativeTabs.SEARCH) {
        final PlantStats baseStat = new PlantStats();
        for (IAgriPlant plant : AgriApi.getPlantRegistry().all()) {
            if (plant.getSeedItems().stream().anyMatch(s -> s.isItemEqual(this))) {
                ItemStack stack = new ItemStack(this);
                NBTTagCompound tag = new NBTTagCompound();
                tag.setString(AgriNBT.SEED, plant.getId());
                baseStat.writeToNBT(tag);
                stack.setTagCompound(tag);
                list.add(stack);
            }
        }
    }
}
 
Example 2
Source File: MaterialMetaItem.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
    super.getSubItems(tab, subItems);
    if (tab == GregTechAPI.TAB_GREGTECH_MATERIALS || tab == CreativeTabs.SEARCH) {
        for (short metadata : generatedItems) {
            subItems.add(new ItemStack(this, 1, metadata));
        }
    }
}
 
Example 3
Source File: DefaultSubItemHandler.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
    subItems.add(itemStack.copy());
    IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null);
    if (electricItem != null) {
        electricItem.charge(Long.MAX_VALUE, Integer.MAX_VALUE, true, false);
        subItems.add(itemStack);
    }
    if (creativeTab == CreativeTabs.SEARCH) {
        if (itemStack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
            addFluidContainerVariants(itemStack, subItems);
        }
    }
}
 
Example 4
Source File: MetaItem.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> subItems) {
    if (tab != GregTechAPI.TAB_GREGTECH && tab != CreativeTabs.SEARCH) {
        return;
    }
    for (T enabledItem : metaItems.valueCollection()) {
        if (!enabledItem.isVisible())
            continue;
        ItemStack itemStack = enabledItem.getStackForm();
        enabledItem.getSubItemHandler().getSubItems(itemStack, tab, subItems);
    }
}
 
Example 5
Source File: MetaTileEntityTank.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
    super.getSubItems(creativeTab, subItems);
    if (creativeTab == CreativeTabs.SEARCH) {
        DefaultSubItemHandler.addFluidContainerVariants(getStackForm(), subItems);
    }
}
 
Example 6
Source File: BlockOre.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) {
    if(tab == CreativeTabs.SEARCH) {
        blockState.getValidStates().forEach(blockState -> list.add(getItem(blockState)));
    } else if(tab == GregTechAPI.TAB_GREGTECH_ORES) {
        list.add(getItem(getDefaultState()));
    }
}
 
Example 7
Source File: FacadeItem.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void getSubItems(ItemStack itemStack, CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
    List<ItemStack> validFacades;
    if (creativeTab == CreativeTabs.SEARCH && !ConfigHolder.hideFacadesInJEI) {
        validFacades = FacadeHelper.getValidFacadeItems();
    } else {
        validFacades = ImmutableList.of(new ItemStack(Blocks.STONE));
    }
    for (ItemStack facadeStack : validFacades) {
        ItemStack resultStack = itemStack.copy();
        setFacadeStack(resultStack, facadeStack);
        subItems.add(resultStack);
    }
}
 
Example 8
Source File: ItemNugget.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> varients) {
    if (tab == this.getCreativeTab() || tab == CreativeTabs.SEARCH) {
        for (AgriNuggetType type : AgriNuggetType.values()) {
            ItemStack stack = new ItemStack(this, 1, type.ordinal());
            varients.add(stack);
        }
    }
}
 
Example 9
Source File: ItemBlockCustomWood.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
    if (tab == this.getCreativeTab() || tab == CreativeTabs.SEARCH) {
        this.getSubItems(list);
    }
}
 
Example 10
Source File: ItemRake.java    From AgriCraft with MIT License 5 votes vote down vote up
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list) {
    if (tab == this.getCreativeTab() || tab == CreativeTabs.SEARCH) {
        list.add(new ItemStack(this, 1, WOOD_VARIANT_META));
        list.add(new ItemStack(this, 1, IRON_VARIANT_META));
    }
}
 
Example 11
Source File: OreItemBlock.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public CreativeTabs[] getCreativeTabs() {
    return new CreativeTabs[] {CreativeTabs.SEARCH, GregTechAPI.TAB_GREGTECH_ORES};
}