Java Code Examples for net.minecraft.init.Items.WHEAT

The following are Jave code examples for showing how to use WHEAT 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: Backmemed   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.func_190926_b())
        {
            if (itemstack.getItem() == Items.BREAD && itemstack.func_190916_E() >= 3 * multiplier || itemstack.getItem() == Items.POTATO && itemstack.func_190916_E() >= 12 * multiplier || itemstack.getItem() == Items.CARROT && itemstack.func_190916_E() >= 12 * multiplier || itemstack.getItem() == Items.BEETROOT && itemstack.func_190916_E() >= 12 * multiplier)
            {
                return true;
            }

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

    return false;
}
 
Example 2
Project: CustomWorldGen   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 || itemstack.getItem() == Items.BEETROOT && itemstack.stackSize >= 12 * multiplier)
            {
                return true;
            }

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

    return false;
}
 
Example 3
Project: Backmemed   File: EntityLlama.java   View Source Code Vote up 4 votes
protected boolean func_190678_b(EntityPlayer p_190678_1_, ItemStack p_190678_2_)
{
    int i = 0;
    int j = 0;
    float f = 0.0F;
    boolean flag = false;
    Item item = p_190678_2_.getItem();

    if (item == Items.WHEAT)
    {
        i = 10;
        j = 3;
        f = 2.0F;
    }
    else if (item == Item.getItemFromBlock(Blocks.HAY_BLOCK))
    {
        i = 90;
        j = 6;
        f = 10.0F;

        if (this.isTame() && this.getGrowingAge() == 0)
        {
            flag = true;
            this.setInLove(p_190678_1_);
        }
    }

    if (this.getHealth() < this.getMaxHealth() && f > 0.0F)
    {
        this.heal(f);
        flag = true;
    }

    if (this.isChild() && i > 0)
    {
        this.world.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, 0.0D, 0.0D, 0.0D, new int[0]);

        if (!this.world.isRemote)
        {
            this.addGrowth(i);
        }

        flag = true;
    }

    if (j > 0 && (flag || !this.isTame()) && this.getTemper() < this.func_190676_dC())
    {
        flag = true;

        if (!this.world.isRemote)
        {
            this.increaseTemper(j);
        }
    }

    if (flag && !this.isSilent())
    {
        this.world.playSound((EntityPlayer)null, this.posX, this.posY, this.posZ, SoundEvents.field_191253_dD, this.getSoundCategory(), 1.0F, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F);
    }

    return flag;
}
 
Example 4
Project: Backmemed   File: EntityAnimal.java   View Source Code Vote up 4 votes
/**
 * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
 * the animal type)
 */
public boolean isBreedingItem(ItemStack stack)
{
    return stack.getItem() == Items.WHEAT;
}
 
Example 5
Project: Backmemed   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 || itemIn == Items.BEETROOT || itemIn == Items.BEETROOT_SEEDS;
}
 
Example 6
Project: Backmemed   File: BlockCrops.java   View Source Code Vote up 4 votes
protected Item getCrop()
{
    return Items.WHEAT;
}
 
Example 7
Project: CustomWorldGen   File: EntityAnimal.java   View Source Code Vote up 4 votes
/**
 * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on
 * the animal type)
 */
public boolean isBreedingItem(@Nullable ItemStack stack)
{
    return stack == null ? false : stack.getItem() == Items.WHEAT;
}
 
Example 8
Project: CustomWorldGen   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 || itemIn == Items.BEETROOT || itemIn == Items.BEETROOT_SEEDS;
}
 
Example 9
Project: CustomWorldGen   File: BlockCrops.java   View Source Code Vote up 4 votes
protected Item getCrop()
{
    return Items.WHEAT;
}