當前位置: 首頁>>代碼示例>>Java>>正文


Java Item.getCreativeTab方法代碼示例

本文整理匯總了Java中net.minecraft.item.Item.getCreativeTab方法的典型用法代碼示例。如果您正苦於以下問題:Java Item.getCreativeTab方法的具體用法?Java Item.getCreativeTab怎麽用?Java Item.getCreativeTab使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.item.Item的用法示例。


在下文中一共展示了Item.getCreativeTab方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSearchEntries

import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
 * Lazy cache.
 * @return
 */
private Stream<SearchEntry> getSearchEntries(){
    if(cachedSearchEntries == null){
        NonNullList<ItemStack> itemList = NonNullList.create();

        for(Item item : Item.REGISTRY){
            if (item != null && item.getCreativeTab() != null) {
                item.getSubItems(item.getCreativeTab(), itemList);
            }
        }

        for (Enchantment enchantment : Enchantment.REGISTRY) {
            if (enchantment != null && enchantment.type != null) {
                getAllEnchantedBooks(enchantment, itemList);
            }
        }

        cachedSearchEntries = itemList.stream().map(SearchEntry::new).collect(Collectors.toList());
    }
    return cachedSearchEntries.stream();
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:25,代碼來源:GuiSearcher.java

示例2: displayAllReleventItems

import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
 * only shows items which have tabToDisplayOn == this
 */
public void displayAllReleventItems(List<ItemStack> p_78018_1_)
{
    for (Item item : Item.itemRegistry)
    {
        if (item != null && item.getCreativeTab() == this)
        {
            item.getSubItems(item, this, p_78018_1_);
        }
    }

    if (this.getRelevantEnchantmentTypes() != null)
    {
        this.addEnchantmentBooksToList(p_78018_1_, this.getRelevantEnchantmentTypes());
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:CreativeTabs.java

示例3: displayAllRelevantItems

import net.minecraft.item.Item; //導入方法依賴的package包/類
/**
 * only shows items which have tabToDisplayOn == this
 */
public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_)
{
    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() == this)
        {
            item.getSubItems(item, this, p_78018_1_);
        }
    }

    if (this.getRelevantEnchantmentTypes() != null)
    {
        this.addEnchantmentBooksToList(p_78018_1_, this.getRelevantEnchantmentTypes());
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:CreativeTabs.java

示例4: updateCreativeSearch

import net.minecraft.item.Item; //導入方法依賴的package包/類
private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    CreativeTabs tab = CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex];
    if (tab.hasSearchBar() && tab != CreativeTabs.SEARCH)
    {
        tab.displayAllRelevantItems(guicontainercreative$containercreative.itemList);
        updateFilteredItems(guicontainercreative$containercreative);
        return;
    }

    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }
    updateFilteredItems(guicontainercreative$containercreative);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:GuiContainerCreative.java

示例5: initialize

import net.minecraft.item.Item; //導入方法依賴的package包/類
public static void initialize() {
    NonNullList<ItemStack> stacks = NonNullList.create();
    for (Item i : ForgeRegistries.ITEMS) {
        CreativeTabs tab = i.getCreativeTab();
        if(tab != null) {
            i.getSubItems(tab, stacks);
        }
    }
    List<ItemStack> out = new LinkedList<>();
    for (ItemStack stack : stacks) {
        int burn = TileEntityFurnace.getItemBurnTime(stack); //Respects vanilla values.
        if(burn > 0) {
            out.add(stack);
        }
    }
    knownFuelStacks = ImmutableList.copyOf(out);
}
 
開發者ID:HellFirePvP,項目名稱:ModularMachinery,代碼行數:18,代碼來源:FuelItemHelper.java

示例6: updateCreativeSearch

import net.minecraft.item.Item; //導入方法依賴的package包/類
private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    for (Item item : Item.itemRegistry)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }

    for (Enchantment enchantment : Enchantment.enchantmentsBookList)
    {
        if (enchantment != null && enchantment.type != null)
        {
            Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList);
        }
    }

    Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
    String s1 = this.searchField.getText().toLowerCase();

    while (iterator.hasNext())
    {
        ItemStack itemstack = (ItemStack)iterator.next();
        boolean flag = false;

        for (String s : itemstack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips))
        {
            if (EnumChatFormatting.getTextWithoutFormattingCodes(s).toLowerCase().contains(s1))
            {
                flag = true;
                break;
            }
        }

        if (!flag)
        {
            iterator.remove();
        }
    }

    this.currentScroll = 0.0F;
    guicontainercreative$containercreative.scrollTo(0.0F);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:48,代碼來源:GuiContainerCreative.java

示例7: updateCreativeSearch

import net.minecraft.item.Item; //導入方法依賴的package包/類
private void updateCreativeSearch()
{
    GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
    guicontainercreative$containercreative.itemList.clear();

    for (Item item : Item.REGISTRY)
    {
        if (item != null && item.getCreativeTab() != null)
        {
            item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
        }
    }

    for (Enchantment enchantment : Enchantment.REGISTRY)
    {
        if (enchantment != null && enchantment.type != null)
        {
            Items.ENCHANTED_BOOK.getAll(enchantment, guicontainercreative$containercreative.itemList);
        }
    }

    Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
    String s1 = this.searchField.getText().toLowerCase(Locale.ROOT);

    while (iterator.hasNext())
    {
        ItemStack itemstack = (ItemStack)iterator.next();
        boolean flag = false;

        for (String s : itemstack.getTooltip(this.mc.player, this.mc.gameSettings.advancedItemTooltips))
        {
            if (TextFormatting.getTextWithoutFormattingCodes(s).toLowerCase(Locale.ROOT).contains(s1))
            {
                flag = true;
                break;
            }
        }

        if (!flag)
        {
            iterator.remove();
        }
    }

    this.currentScroll = 0.0F;
    guicontainercreative$containercreative.scrollTo(0.0F);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:48,代碼來源:GuiContainerCreative.java


注:本文中的net.minecraft.item.Item.getCreativeTab方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。