当前位置: 首页>>代码示例>>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;未经允许,请勿转载。