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


Java Enchantment.enchantmentsBookList方法代碼示例

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


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

示例1: addEnchantmentBooksToList

import net.minecraft.enchantment.Enchantment; //導入方法依賴的package包/類
/**
 * Adds the enchantment books from the supplied EnumEnchantmentType to the given list.
 */
public void addEnchantmentBooksToList(List<ItemStack> itemList, EnumEnchantmentType... enchantmentType)
{
    for (Enchantment enchantment : Enchantment.enchantmentsBookList)
    {
        if (enchantment != null && enchantment.type != null)
        {
            boolean flag = false;

            for (int i = 0; i < enchantmentType.length && !flag; ++i)
            {
                if (enchantment.type == enchantmentType[i])
                {
                    flag = true;
                }
            }

            if (flag)
            {
                itemList.add(Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, enchantment.getMaxLevel())));
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:27,代碼來源:CreativeTabs.java

示例2: modifyMerchantRecipeList

import net.minecraft.enchantment.Enchantment; //導入方法依賴的package包/類
public void modifyMerchantRecipeList(MerchantRecipeList recipeList, Random random)
{
    Enchantment enchantment = Enchantment.enchantmentsBookList[random.nextInt(Enchantment.enchantmentsBookList.length)];
    int i = MathHelper.getRandomIntegerInRange(random, enchantment.getMinLevel(), enchantment.getMaxLevel());
    ItemStack itemstack = Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(enchantment, i));
    int j = 2 + random.nextInt(5 + i * 10) + 3 * i;

    if (j > 64)
    {
        j = 64;
    }

    recipeList.add(new MerchantRecipe(new ItemStack(Items.book), new ItemStack(Items.emerald, j), itemstack));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:15,代碼來源:EntityVillager.java

示例3: updateCreativeSearch

import net.minecraft.enchantment.Enchantment; //導入方法依賴的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


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