本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例5: getSeed
import net.minecraft.init.Items; //导入方法依赖的package包/类
protected Item getSeed()
{
return Items.potato;
}
示例6: getCrop
import net.minecraft.init.Items; //导入方法依赖的package包/类
protected Item getCrop()
{
return Items.potato;
}
示例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;
}
}