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