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


Java Items.WHEAT屬性代碼示例

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


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

示例1: hasEnoughItems

/**
 * 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;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:27,代碼來源:EntityVillager.java

示例2: hasEnoughItems

/**
 * 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;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:27,代碼來源:EntityVillager.java

示例3: func_190678_b

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;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:62,代碼來源:EntityLlama.java

示例4: isBreedingItem

/**
 * 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;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:8,代碼來源:EntityAnimal.java

示例5: canVillagerPickupItem

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;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:4,代碼來源:EntityVillager.java

示例6: getCrop

protected Item getCrop()
{
    return Items.WHEAT;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:4,代碼來源:BlockCrops.java

示例7: isBreedingItem

/**
 * 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;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:8,代碼來源:EntityAnimal.java


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