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


Java Items.bread方法代碼示例

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


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

示例1: hasEnoughItems

import net.minecraft.init.Items; //導入方法依賴的package包/類
/**
 * Returns true if villager has enough items in inventory
 */
private boolean hasEnoughItems(int multiplier)
{
    boolean flag = this.getProfession() == 0;

    for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)
    {
        ItemStack itemstack = this.villagerInventory.getStackInSlot(i);

        if (itemstack != null)
        {
            if (itemstack.getItem() == Items.bread && itemstack.stackSize >= 3 * multiplier || itemstack.getItem() == Items.potato && itemstack.stackSize >= 12 * multiplier || itemstack.getItem() == Items.carrot && itemstack.stackSize >= 12 * multiplier)
            {
                return true;
            }

            if (flag && itemstack.getItem() == Items.wheat && itemstack.stackSize >= 9 * multiplier)
            {
                return true;
            }
        }
    }

    return false;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:28,代碼來源:EntityVillager.java

示例2: getIsWillingToMate

import net.minecraft.init.Items; //導入方法依賴的package包/類
/**
 * Returns current or updated value of {@link #isWillingToMate}
 */
public boolean getIsWillingToMate(boolean updateFirst)
{
    if (!this.isWillingToMate && updateFirst && this.func_175553_cp())
    {
        boolean flag = false;

        for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)
        {
            ItemStack itemstack = this.villagerInventory.getStackInSlot(i);

            if (itemstack != null)
            {
                if (itemstack.getItem() == Items.bread && itemstack.stackSize >= 3)
                {
                    flag = true;
                    this.villagerInventory.decrStackSize(i, 3);
                }
                else if ((itemstack.getItem() == Items.potato || itemstack.getItem() == Items.carrot) && itemstack.stackSize >= 12)
                {
                    flag = true;
                    this.villagerInventory.decrStackSize(i, 12);
                }
            }

            if (flag)
            {
                this.worldObj.setEntityState(this, (byte)18);
                this.isWillingToMate = true;
                break;
            }
        }
    }

    return this.isWillingToMate;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:39,代碼來源:EntityVillager.java

示例3: canVillagerPickupItem

import net.minecraft.init.Items; //導入方法依賴的package包/類
private boolean canVillagerPickupItem(Item itemIn)
{
    return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:EntityVillager.java

示例4: onCrafting

import net.minecraft.init.Items; //導入方法依賴的package包/類
/**
 * the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
 */
protected void onCrafting(ItemStack stack)
{
    if (this.amountCrafted > 0)
    {
        stack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
    }

    this.amountCrafted = 0;

    if (stack.getItem() == Item.getItemFromBlock(Blocks.crafting_table))
    {
        this.thePlayer.triggerAchievement(AchievementList.buildWorkBench);
    }

    if (stack.getItem() instanceof ItemPickaxe)
    {
        this.thePlayer.triggerAchievement(AchievementList.buildPickaxe);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.furnace))
    {
        this.thePlayer.triggerAchievement(AchievementList.buildFurnace);
    }

    if (stack.getItem() instanceof ItemHoe)
    {
        this.thePlayer.triggerAchievement(AchievementList.buildHoe);
    }

    if (stack.getItem() == Items.bread)
    {
        this.thePlayer.triggerAchievement(AchievementList.makeBread);
    }

    if (stack.getItem() == Items.cake)
    {
        this.thePlayer.triggerAchievement(AchievementList.bakeCake);
    }

    if (stack.getItem() instanceof ItemPickaxe && ((ItemPickaxe)stack.getItem()).getToolMaterial() != Item.ToolMaterial.WOOD)
    {
        this.thePlayer.triggerAchievement(AchievementList.buildBetterPickaxe);
    }

    if (stack.getItem() instanceof ItemSword)
    {
        this.thePlayer.triggerAchievement(AchievementList.buildSword);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.enchanting_table))
    {
        this.thePlayer.triggerAchievement(AchievementList.enchantments);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.bookshelf))
    {
        this.thePlayer.triggerAchievement(AchievementList.bookcase);
    }

    if (stack.getItem() == Items.golden_apple && stack.getMetadata() == 1)
    {
        this.thePlayer.triggerAchievement(AchievementList.overpowered);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:68,代碼來源:SlotCrafting.java


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