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


Java Items.potato方法代碼示例

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


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

示例1: hasEnoughItems

import net.minecraft.init.Items; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:28,代碼來源:EntityVillager.java

示例2: isFarmItemInInventory

import net.minecraft.init.Items; //導入方法依賴的package包/類
/**
 * 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))
        {
            return true;
        }
    }

    return false;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:EntityVillager.java

示例3: getIsWillingToMate

import net.minecraft.init.Items; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:39,代碼來源:EntityVillager.java

示例4: canVillagerPickupItem

import net.minecraft.init.Items; //導入方法依賴的package包/類
private boolean canVillagerPickupItem(Item itemIn)
{
    return itemIn == Items.bread || itemIn == Items.potato || itemIn == Items.carrot || itemIn == Items.wheat || itemIn == Items.wheat_seeds;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:EntityVillager.java

示例5: getSeed

import net.minecraft.init.Items; //導入方法依賴的package包/類
protected Item getSeed()
{
    return Items.potato;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:BlockPotato.java

示例6: getCrop

import net.minecraft.init.Items; //導入方法依賴的package包/類
protected Item getCrop()
{
    return Items.potato;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:BlockPotato.java

示例7: updateTask

import net.minecraft.init.Items; //導入方法依賴的package包/類
/**
 * 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.field_179501_f == 0 && block instanceof BlockCrops && ((Integer)iblockstate.getValue(BlockCrops.AGE)).intValue() == 7)
        {
            world.destroyBlock(blockpos, true);
        }
        else if (this.field_179501_f == 1 && block == Blocks.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;
                    }
                }

                if (flag)
                {
                    --itemstack.stackSize;

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

                    break;
                }
            }
        }

        this.field_179501_f = -1;
        this.runDelay = 10;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:66,代碼來源:EntityAIHarvestFarmland.java


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