Java Code Examples for net.minecraft.init.Items.bread()

The following are Jave code examples for showing how to use bread() of the net.minecraft.init.Items class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: EntityVillager.java   View Source Code Vote up 6 votes
/**
 * 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;
}
 
Example 2
Project: DecompiledMinecraft   File: EntityVillager.java   View Source Code Vote up 6 votes
/**
 * 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;
}
 
Example 3
Project: BaseClient   File: EntityVillager.java   View Source Code Vote up 6 votes
/**
 * 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;
}
 
Example 4
Project: BaseClient   File: EntityVillager.java   View Source Code Vote up 6 votes
/**
 * 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;
}
 
Example 5
Project: DecompiledMinecraft   File: EntityVillager.java   View Source Code Vote up 5 votes
/**
 * 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;
}
 
Example 6
Project: DecompiledMinecraft   File: EntityVillager.java   View Source Code Vote up 5 votes
/**
 * 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;
}
 
Example 7
Project: BaseClient   File: EntityVillager.java   View Source Code Vote up 5 votes
/**
 * 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;
}
 
Example 8
Project: BaseClient   File: EntityVillager.java   View Source Code Vote up 5 votes
/**
 * 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;
}
 
Example 9
Project: DecompiledMinecraft   File: EntityVillager.java   View Source Code Vote up 4 votes
private boolean canVillagerPickupItem(Item itemIn)
{
    return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds;
}
 
Example 10
Project: DecompiledMinecraft   File: SlotCrafting.java   View Source Code Vote up 4 votes
/**
 * 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);
    }
}
 
Example 11
Project: DecompiledMinecraft   File: EntityVillager.java   View Source Code Vote up 4 votes
private boolean canVillagerPickupItem(Item itemIn)
{
    return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds;
}
 
Example 12
Project: DecompiledMinecraft   File: SlotCrafting.java   View Source Code Vote up 4 votes
/**
 * 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);
    }
}
 
Example 13
Project: BaseClient   File: EntityVillager.java   View Source Code Vote up 4 votes
private boolean canVillagerPickupItem(Item itemIn)
{
    return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds;
}
 
Example 14
Project: BaseClient   File: SlotCrafting.java   View Source Code Vote up 4 votes
/**
 * 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);
    }
}
 
Example 15
Project: BaseClient   File: EntityVillager.java   View Source Code Vote up 4 votes
private boolean canVillagerPickupItem(Item itemIn)
{
    return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds;
}
 
Example 16
Project: BaseClient   File: SlotCrafting.java   View Source Code Vote up 4 votes
/**
 * 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);
    }
}