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


Java Items.BEETROOT_SEEDS屬性代碼示例

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


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

示例1: isFarmItemInInventory

/**
 * Returns true if villager has seeds, potatoes or carrots in inventory
 */
public boolean isFarmItemInInventory()
{
    for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)
    {
        ItemStack itemstack = this.villagerInventory.getStackInSlot(i);

        if (!itemstack.func_190926_b() && (itemstack.getItem() == Items.WHEAT_SEEDS || itemstack.getItem() == Items.POTATO || itemstack.getItem() == Items.CARROT || itemstack.getItem() == Items.BEETROOT_SEEDS))
        {
            return true;
        }
    }

    return false;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:17,代碼來源:EntityVillager.java

示例2: isFarmItemInInventory

/**
 * Returns true if villager has seeds, potatoes or carrots in inventory
 */
public boolean isFarmItemInInventory()
{
    for (int i = 0; i < this.villagerInventory.getSizeInventory(); ++i)
    {
        ItemStack itemstack = this.villagerInventory.getStackInSlot(i);

        if (itemstack != null && (itemstack.getItem() == Items.WHEAT_SEEDS || itemstack.getItem() == Items.POTATO || itemstack.getItem() == Items.CARROT || itemstack.getItem() == Items.BEETROOT_SEEDS))
        {
            return true;
        }
    }

    return false;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:EntityVillager.java

示例3: getSeed

protected Item getSeed() {
 return Items.BEETROOT_SEEDS;
}
 
開發者ID:MinecraftModDevelopmentMods,項目名稱:BaseFoods,代碼行數:3,代碼來源:BlockCorn.java

示例4: updateTask

/**
 * Updates the task
 */
public void updateTask()
{
    super.updateTask();
    this.theVillager.getLookHelper().setLookPosition((double)this.destinationBlock.getX() + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)this.destinationBlock.getZ() + 0.5D, 10.0F, (float)this.theVillager.getVerticalFaceSpeed());

    if (this.getIsAboveDestination())
    {
        World world = this.theVillager.world;
        BlockPos blockpos = this.destinationBlock.up();
        IBlockState iblockstate = world.getBlockState(blockpos);
        Block block = iblockstate.getBlock();

        if (this.currentTask == 0 && block instanceof BlockCrops && ((BlockCrops)block).isMaxAge(iblockstate))
        {
            world.destroyBlock(blockpos, true);
        }
        else if (this.currentTask == 1 && iblockstate.getMaterial() == Material.AIR)
        {
            InventoryBasic inventorybasic = this.theVillager.getVillagerInventory();

            for (int i = 0; i < inventorybasic.getSizeInventory(); ++i)
            {
                ItemStack itemstack = inventorybasic.getStackInSlot(i);
                boolean flag = false;

                if (!itemstack.func_190926_b())
                {
                    if (itemstack.getItem() == Items.WHEAT_SEEDS)
                    {
                        world.setBlockState(blockpos, Blocks.WHEAT.getDefaultState(), 3);
                        flag = true;
                    }
                    else if (itemstack.getItem() == Items.POTATO)
                    {
                        world.setBlockState(blockpos, Blocks.POTATOES.getDefaultState(), 3);
                        flag = true;
                    }
                    else if (itemstack.getItem() == Items.CARROT)
                    {
                        world.setBlockState(blockpos, Blocks.CARROTS.getDefaultState(), 3);
                        flag = true;
                    }
                    else if (itemstack.getItem() == Items.BEETROOT_SEEDS)
                    {
                        world.setBlockState(blockpos, Blocks.BEETROOTS.getDefaultState(), 3);
                        flag = true;
                    }
                }

                if (flag)
                {
                    itemstack.func_190918_g(1);

                    if (itemstack.func_190926_b())
                    {
                        inventorybasic.setInventorySlotContents(i, ItemStack.field_190927_a);
                    }

                    break;
                }
            }
        }

        this.currentTask = -1;
        this.runDelay = 10;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:70,代碼來源:EntityAIHarvestFarmland.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: getSeed

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

示例7: updateTask

/**
 * Updates the task
 */
public void updateTask()
{
    super.updateTask();
    this.theVillager.getLookHelper().setLookPosition((double)this.destinationBlock.getX() + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)this.destinationBlock.getZ() + 0.5D, 10.0F, (float)this.theVillager.getVerticalFaceSpeed());

    if (this.getIsAboveDestination())
    {
        World world = this.theVillager.worldObj;
        BlockPos blockpos = this.destinationBlock.up();
        IBlockState iblockstate = world.getBlockState(blockpos);
        Block block = iblockstate.getBlock();

        if (this.currentTask == 0 && block instanceof BlockCrops && ((BlockCrops)block).isMaxAge(iblockstate))
        {
            world.destroyBlock(blockpos, true);
        }
        else if (this.currentTask == 1 && iblockstate.getMaterial() == Material.AIR)
        {
            InventoryBasic inventorybasic = this.theVillager.getVillagerInventory();

            for (int i = 0; i < inventorybasic.getSizeInventory(); ++i)
            {
                ItemStack itemstack = inventorybasic.getStackInSlot(i);
                boolean flag = false;

                if (itemstack != null)
                {
                    if (itemstack.getItem() == Items.WHEAT_SEEDS)
                    {
                        world.setBlockState(blockpos, Blocks.WHEAT.getDefaultState(), 3);
                        flag = true;
                    }
                    else if (itemstack.getItem() == Items.POTATO)
                    {
                        world.setBlockState(blockpos, Blocks.POTATOES.getDefaultState(), 3);
                        flag = true;
                    }
                    else if (itemstack.getItem() == Items.CARROT)
                    {
                        world.setBlockState(blockpos, Blocks.CARROTS.getDefaultState(), 3);
                        flag = true;
                    }
                    else if (itemstack.getItem() == Items.BEETROOT_SEEDS)
                    {
                        world.setBlockState(blockpos, Blocks.BEETROOTS.getDefaultState(), 3);
                        flag = true;
                    }
                }

                if (flag)
                {
                    --itemstack.stackSize;

                    if (itemstack.stackSize <= 0)
                    {
                        inventorybasic.setInventorySlotContents(i, (ItemStack)null);
                    }

                    break;
                }
            }
        }

        this.currentTask = -1;
        this.runDelay = 10;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:70,代碼來源:EntityAIHarvestFarmland.java


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