本文整理汇总了Java中net.minecraft.init.Items.WHEAT_SEEDS属性的典型用法代码示例。如果您正苦于以下问题:Java Items.WHEAT_SEEDS属性的具体用法?Java Items.WHEAT_SEEDS怎么用?Java Items.WHEAT_SEEDS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.init.Items
的用法示例。
在下文中一共展示了Items.WHEAT_SEEDS属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: getItemDropped
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
return Items.field_190931_a;
}
else
{
BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT);
return blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.FERN ? Items.field_190931_a : (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? (rand.nextInt(8) == 0 ? Items.WHEAT_SEEDS : Items.field_190931_a) : super.getItemDropped(state, rand, fortune));
}
}
示例3: 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;
}
示例4: getItemDropped
/**
* Get the Item that this Block should drop when harvested.
*/
@Nullable
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
return null;
}
else
{
BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT);
return blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.FERN ? null : (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? (rand.nextInt(8) == 0 ? Items.WHEAT_SEEDS : null) : Item.getItemFromBlock(this));
}
}
示例5: 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;
}
}
示例6: 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;
}
示例7: getSeed
protected Item getSeed()
{
return Items.WHEAT_SEEDS;
}
示例8: getItemDropped
/**
* Get the Item that this Block should drop when harvested.
*/
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
return rand.nextInt(8) == 0 ? Items.WHEAT_SEEDS : Items.field_190931_a;
}
示例9: getStack
public ItemStack getStack(Random rand, int fortune)
{
return new ItemStack(Items.WHEAT_SEEDS, 1 + rand.nextInt(fortune * 2 + 1));
}
示例10: 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;
}
}