Java Code Examples for net.minecraft.init.Items#BEETROOT_SEEDS
The following examples show how to use
net.minecraft.init.Items#BEETROOT_SEEDS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityTofunian.java From TofuCraftReload with MIT License | 5 votes |
public boolean isFarmItemInInventory() { for (int i = 0; i < this.getVillagerInventory().getSizeInventory(); ++i) { ItemStack itemstack = this.getVillagerInventory().getStackInSlot(i); if (!itemstack.isEmpty() && (itemstack.getItem() == Items.WHEAT_SEEDS || itemstack.getItem() == Items.POTATO || itemstack.getItem() == Items.CARROT || itemstack.getItem() == Items.BEETROOT_SEEDS || itemstack.getItem() == ItemLoader.soybeans)) { return true; } } return false; }
Example 2
Source File: PlantHelper.java From EmergingTechnology with MIT License | 5 votes |
public static IBlockState getBlockStateFromItemStackForPlanting(ItemStack itemStack, World world, BlockPos pos) { if (itemStack.getItem() == Items.WHEAT_SEEDS) { return Blocks.WHEAT.getDefaultState(); } if (itemStack.getItem() == Items.POTATO) { return Blocks.POTATOES.getDefaultState(); } if (itemStack.getItem() == Items.CARROT) { return Blocks.CARROTS.getDefaultState(); } if (itemStack.getItem() == Items.BEETROOT_SEEDS) { return Blocks.BEETROOTS.getDefaultState(); } if (itemStack.getItem() == Items.REEDS) { return Blocks.REEDS.getDefaultState(); } if (itemStack.getItem() == Items.PUMPKIN_SEEDS) { return Blocks.PUMPKIN_STEM.getDefaultState(); } if (itemStack.getItem() == Items.MELON_SEEDS) { return Blocks.MELON_STEM.getDefaultState(); } if (itemStack.getItem() instanceof IPlantable) { return ((IPlantable) itemStack.getItem()).getPlant(world, pos); } return null; }
Example 3
Source File: AutoFarmHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
private boolean canBeReplanted(BlockPos pos) { Item item = plants.get(pos); if(item == Items.WHEAT_SEEDS || item == Items.CARROT || item == Items.POTATO || item == Items.BEETROOT_SEEDS || item == Items.PUMPKIN_SEEDS || item == Items.MELON_SEEDS) return BlockUtils.getBlock(pos.down()) instanceof BlockFarmland; if(item == Items.NETHER_WART) return BlockUtils.getBlock(pos.down()) instanceof BlockSoulSand; return false; }
Example 4
Source File: EntityAIHarvestTofuFarmland.java From TofuCraftReload with MIT License | 4 votes |
/** * Keep ticking a continuous task that has already been started */ public void updateTask() { super.updateTask(); this.villager.getLookHelper().setLookPosition((double)this.destinationBlock.getX() + 0.5D, (double)(this.destinationBlock.getY() + 1), (double)this.destinationBlock.getZ() + 0.5D, 10.0F, (float)this.villager.getVerticalFaceSpeed()); if (this.getIsAboveDestination()) { World world = this.villager.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.villager.getVillagerInventory(); for (int i = 0; i < inventorybasic.getSizeInventory(); ++i) { ItemStack itemstack = inventorybasic.getStackInSlot(i); boolean flag = false; if (!itemstack.isEmpty()) { 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; } else if (itemstack.getItem() instanceof net.minecraftforge.common.IPlantable) { if(((net.minecraftforge.common.IPlantable)itemstack.getItem()).getPlantType(world,blockpos) == net.minecraftforge.common.EnumPlantType.Crop) { world.setBlockState(blockpos, ((net.minecraftforge.common.IPlantable)itemstack.getItem()).getPlant(world,blockpos),3); flag = true; } } } if (flag) { itemstack.shrink(1); if (itemstack.isEmpty()) { inventorybasic.setInventorySlotContents(i, ItemStack.EMPTY); } break; } } } this.currentTask = -1; this.runDelay = 10; } }
Example 5
Source File: EntityDabSquirrel.java From CommunityMod with GNU Lesser General Public License v2.1 | 4 votes |
@Override public boolean isBreedingItem(ItemStack stack) { return stack.getItem() == Items.WHEAT_SEEDS || stack.getItem() == Items.BEETROOT_SEEDS || stack.getItem() == Items.MELON_SEEDS || stack.getItem() == Items.PUMPKIN_SEEDS; }