private void plantAll(List<EntityItem> items, World world, BlockPos pos, int amplifier) { int box = 1 + (int) ((float) amplifier / 2F); BlockPos posI = pos.add(box, 1, box); BlockPos posF = pos.add(-box, -1, -box); Iterable<BlockPos> spots = BlockPos.getAllInBox(posI, posF); for (EntityItem item : items) { ItemStack stack = item.getItem(); for (BlockPos spot : spots) { if (stack.isEmpty()) { item.setDead(); break; } IBlockState state = world.getBlockState(spot); IPlantable seed = (IPlantable) stack.getItem(); if (world.isAirBlock(spot.up()) && state.getBlock().canSustainPlant(state, world, spot, EnumFacing.UP, seed)) { world.setBlockState(spot.up(), seed.getPlant(world, spot.up())); stack.shrink(1); } } } }
private void replant(BlockPos pos) { IMeeCreep entity = helper.getMeeCreep(); World world = entity.getWorld(); Block block = needToReplant.get(pos); needToReplant.remove(pos); for (ItemStack stack : entity.getInventory()) { if (stack.getItem() instanceof IPlantable) { IBlockState plant = ((IPlantable) stack.getItem()).getPlant(world, pos); if (plant.getBlock() == block) { // This is a valid seed stack.splitStack(1); world.setBlockState(pos, plant); break; } } } }
private BlockPos hasSuitableSeed() { IMeeCreep entity = helper.getMeeCreep(); World world = entity.getWorld(); for (Map.Entry<BlockPos, Block> entry : needToReplant.entrySet()) { BlockPos pos = entry.getKey(); Block block = entry.getValue(); for (ItemStack stack : entity.getInventory()) { if (stack.getItem() instanceof IPlantable) { IBlockState plant = ((IPlantable) stack.getItem()).getPlant(world, pos); if (plant.getBlock() == block) { // This is a valid seed return pos; } } } } return null; }
@Override public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack heldItem = playerIn.getHeldItem(hand); if (heldItem.isEmpty()) { return super.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ); } System.out.println(this.getSaplingState()); if (facing == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(facing), facing, heldItem) && worldIn.isAirBlock(pos.up()) && worldIn.getBlockState(pos).getBlock().canSustainPlant(worldIn.getBlockState(pos), worldIn, pos, facing, (IPlantable) this.getSaplingState().getBlock())) { worldIn.setBlockState(pos.up(), this.getSaplingState()); worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.BLOCK_GRASS_BREAK, SoundCategory.NEUTRAL, 1F, 1F); heldItem.shrink(1); return EnumActionResult.SUCCESS; } else { if (playerIn.canPlayerEdit(pos.offset(facing), facing, heldItem) && worldIn.isAirBlock(pos.up()) && worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) { worldIn.setBlockState(pos, this.getSaplingState()); worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.BLOCK_GRASS_BREAK, SoundCategory.NEUTRAL, 1F, 1F); heldItem.shrink(1); return EnumActionResult.SUCCESS; } return EnumActionResult.FAIL; } }
private boolean tryBlockClient(int x, int y, int z) { BlockVec3 bv = new BlockVec3(x, y, z); if (this.laserBlocks.contains(bv)) return false; //Add minable blocks to the laser fx list Block b = this.worldObj.getBlock(x, y, z); if (b.getMaterial() == Material.air) return false; if (noMineList.contains(b)) return true; if (b instanceof BlockLiquid) return false; if (b instanceof IFluidBlock) return false; if (b instanceof IPlantable) return true; int meta = this.worldObj.getBlockMetadata(x, y, z); if (b.hasTileEntity(meta) || b.getBlockHardness(this.worldObj, x, y, z) < 0) return true; if (this.tryBlockLimit == 0) return false; this.tryBlockLimit--; this.laserBlocks.add(bv); this.laserTimes.add(this.ticksExisted); return false; }
public static boolean isSeed(ItemStack stack, boolean ignoreCrops){ if(ItemStackTools.isNullStack(stack))return false; if(!ignoreCrops){ Block bi = Block.getBlockFromItem(stack.getItem()); if(bi !=null){ if ((getCrops(CropType.NORMAL).contains(bi.getUnlocalizedName() + stack.getItemDamage())) || (getCrops(CropType.CLICKABLE).contains(bi.getUnlocalizedName() + stack.getItemDamage())) || (getCrops(CropType.STACKED).contains(bi.getUnlocalizedName() + stack.getItemDamage()))) { return true; } } } boolean found = false; for (int a = 0; a < 16; a++) { if ((seeds.contains(stack.getItem().getRegistryName().toString() + "|" + a))) { found = true; break; } } if((stack.getItem() instanceof IPlantable) || found || (seeds.contains(stack.getItem().getRegistryName().toString() + "|" + stack.getItemDamage()))){ return true; } return false; }
@Override public boolean canPlant(World world, BlockPos pos) { if (ItemStackUtil.isEmpty(this.stack)) { return false; } Item item = this.stack.getItem(); Object rawPlantable = (item instanceof ItemBlock) ? ((ItemBlock) item).getBlock() : item; IPlantable plantable = (rawPlantable instanceof IPlantable) ? (IPlantable)rawPlantable : null; if (plantable == null) { return false; } IBlockState down = world.getBlockState(pos.down()); return down.getBlock().canSustainPlant(down, world, pos.down(), EnumFacing.UP, plantable); }
@SubscribeEvent public void poisonousPotatoRightClick(RightClickBlock event) { EntityPlayer player = event.getEntityPlayer(); World world = event.getWorld(); if((event.getEntityPlayer().getHeldItemMainhand()!=null) &&(player.getHeldItemMainhand().getItem()==Items.POISONOUS_POTATO) &&(event.getFace()==EnumFacing.UP) &&world.getBlockState(event.getPos()).getBlock().canSustainPlant(world.getBlockState(event.getPos()), world, event.getPos(), EnumFacing.UP, (IPlantable) Items.POTATO)) { if(!world.isRemote) { if(!player.capabilities.isCreativeMode) { player.inventory.clearMatchingItems(Items.POISONOUS_POTATO, -1, 1, null); } if(world.getBlockState(event.getPos().up(+1)).getBlock()==Blocks.AIR) { world.setBlockState(event.getPos().up(+1),Blocks.POTATOES.getDefaultState()); } } } }
@Override public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { IBlockState plant = plantable.getPlant(world, pos.offset(direction)); net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); switch (plantType) { case Crop: case Plains: return true; case Desert: case Nether: case Cave: case Water: case Beach: default: return false; } }
/******************************************************************************* * 1. Content *******************************************************************************/ @Override public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { if(world.isRemote) return; if(!(world.getBlockState(pos.up()).getBlock() instanceof IPlantable)) { if(!isFertile(world, pos) && rand.nextInt(100) == 0) { world.setBlockState(pos, TFCBlocks.Dirt.getDefaultState().withProperty(META_PROPERTY, state.getValue(META_PROPERTY))); } } }
@Override public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { IBlockState plant = plantable.getPlant(world, pos.offset(direction)); net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); if(plantType == EnumPlantType.Crop) return true; if(plantType == EnumPlantType.Plains) return true; if(plantable == TFCBlocks.Sapling) return true; return false; }
@Override public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { IBlockState plant = plantable.getPlant(world, pos.offset(direction)); EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); VegType veg = (VegType)state.getValue(META_PROPERTY); if(plant.getBlock() == this) { if(veg == VegType.DoubleGrassBottom && plant.getValue(META_PROPERTY) == VegType.DoubleGrassTop) return true; if(veg == VegType.DoubleGrassBottomLush && plant.getValue(META_PROPERTY) == VegType.DoubleGrassTopLush) return true; } return false; }
@Override public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, IPlantable plantable) { IBlockState plant = plantable.getPlant(world, pos.offset(direction)); net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction)); if(plant.getBlock() == Blocks.SAPLING) return false;//This may break some cross mod compatability but for now its needed to prevent vanilla and some pam trees from generating if(plantType == EnumPlantType.Plains) return true; if(plant.getBlock() == TFCBlocks.VegDesert) return true; return false; }
static EnumActionResult useSeedBag(EntityPlayer player, World world, BlockPos pos, EnumHand hand, @Nonnull ItemStack heldStack, EnumFacing facing) { if (player.isSneaking()) return EnumActionResult.PASS; SeedBagInventory seedBagInventory = new SeedBagInventory(heldStack); ItemStack seedStack = seedBagInventory.getStackInSlot(0); if (!seedStack.isEmpty() && seedStack.getItem() instanceof IPlantable) { IPlantable plantable = (IPlantable) seedStack.getItem(); IBlockState state = world.getBlockState(pos); if (state.getBlock().canSustainPlant(state, world, pos, EnumFacing.UP, plantable) && world.isAirBlock(pos.up())) { seedBagInventory.decrStackSize(0, 1); ItemStack before = heldStack.copy(); player.setHeldItem(hand, seedStack); seedStack.onItemUse(player, world, pos, hand, facing, 0, 0, 0); player.setHeldItem(hand, before); return EnumActionResult.SUCCESS; } } return EnumActionResult.PASS; }
@Override public void placeBlock(World world, int x, int y, int z, ForgeDirection direction, EntityPlayer player, ItemStack placing, IToggleController controller) { Block soil = world.getBlock(x, y - 1, z); if (placing.getItem() instanceof IPlantable) { IPlantable plantable = (IPlantable) placing.getItem(); ForgeDirection up = ForgeDirection.UP; ItemStack hoeStack = controller.getStorageHandler().getToolFromStorage("hoe"); if (hoeStack != null && (soil == Blocks.dirt || soil == Blocks.grass) && Blocks.farmland.canSustainPlant(world, x, y - 1, z, up, plantable)) { world.setBlock(x, y - 1, z, Blocks.farmland); hoeStack.setItemDamage(hoeStack.getItemDamage() + 1); } super.placeBlock(world, x, y, z, direction, player, placing, controller); } }
@Override public boolean canPlaceBlock(World world, int x, int y, int z, ItemStack placing, IToggleController controller) { System.out.println("Can place?"); Block soil = world.getBlock(x, y - 1, z); if (placing.getItem() instanceof IPlantable) { System.out.println("Item is plantable!"); IPlantable plantable = (IPlantable) placing.getItem(); ForgeDirection up = ForgeDirection.UP; if (soil.canSustainPlant(world, x, y - 1, z, up, plantable)) { System.out.println("Soil can sustain the plant"); return true; } else if ( controller.getStorageHandler().getToolFromStorage("hoe") != null && (soil == Blocks.dirt || soil == Blocks.grass) && Blocks.farmland.canSustainPlant(world, x, y - 1, z, up, plantable)) { System.out.println("Soil can't sustain plant, but farmland can!"); return true; } } return false; }
public static ItemStack tryPlantSeed(World world, BlockPos posForPlant, ItemStack stack) { BlockPos posSoil = posForPlant.down(); if (stack != null && stack.getItem() instanceof IPlantable) { IPlantable seed = (IPlantable) stack.getItem(); IBlockState crop = seed.getPlant(world, posForPlant); if (crop != null) { // mimic exactly what onItemUse.onItemUse is doing IBlockState state = world.getBlockState(posSoil); boolean canSustainPlant = state.getBlock().canSustainPlant(state, world, posSoil, EnumFacing.UP, seed); if (canSustainPlant) { if (world.isAirBlock(posForPlant)) { world.setBlockState(posForPlant, crop); stack.shrink(1); return stack; } else { return stack;// ie, dont do super } } } } return null; }
@Override public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) { Block block = plantable.getPlant(world, x, y + 1, z); int blockMeta = plantable.getPlantMetadata(world, x, y + 1, z); // EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z); if (plantable instanceof SubBlockBush) { return ((SubBlockBush) plantable).canPlaceOn(block, blockMeta, 0); } return super.canSustainPlant(world, x, y, z, direction, plantable); }
@Override public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) { Block plant = plantable.getPlant(world, x, y + 1, z); EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z); switch (plantType) { case Desert: return false; case Nether: return false; case Crop: return true; case Cave: return false; case Plains: return false; case Water: return false; case Beach: return false; } return false; }
private boolean func_149822_e(World p_149822_1_, int p_149822_2_, int p_149822_3_, int p_149822_4_) { byte b0 = 0; for (int l = p_149822_2_ - b0; l <= p_149822_2_ + b0; ++l) { for (int i1 = p_149822_4_ - b0; i1 <= p_149822_4_ + b0; ++i1) { Block block = p_149822_1_.getBlock(l, p_149822_3_ + 1, i1); if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable)block)) { return true; } } } return false; }
public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) { Block plant = plantable.getPlant(world, x, y + 1, z); EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z); switch (plantType) { case Beach: break; case Cave: break; case Crop: break; case Desert: break; case Nether: break; case Plains: break; case Water: break; default: break; } return false; }
/** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS */ public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { if (p_77648_7_ != 1) { return false; } else if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_)) { if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_).canSustainPlant(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, ForgeDirection.UP, (IPlantable) this) && p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_)) { p_77648_3_.setBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_, this.field_150925_a); --p_77648_1_.stackSize; return true; } else { return false; } } else { return false; } }
@Override /** * Determines if this block can support the passed in plant, allowing it to be planted and grow. * Some examples: * @param world The current world * @param x X Position * @param y Y Position * @param z Z position * @param direction The direction relative to the given position the plant wants to be, typically its UP * @param plant The plant that wants to check * @return True to allow the plant to be planted/stay. */ public boolean canSustainPlant(IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) { return true; }
private void init () { registerCompostMaterial(new ItemStack(Blocks.melon_block), defaultMaterial); registerCompostMaterial(new ItemStack(Blocks.pumpkin), defaultMaterial); registerCompostMaterial(new ItemStack(Blocks.hay_block), defaultMaterial); registerCompostMaterial(new ItemStack(Items.string), new StandardCompostMaterial(100, 0.0625f)); registerCompostMaterial(new ItemStack(Items.wheat), new StandardCompostMaterial(100, 0.125f)); registerCompostMaterial(new ItemStack(Items.reeds), new StandardCompostMaterial(150, 0.125f)); registerCompostMaterial(new ItemStack(Items.feather), new StandardCompostMaterial(50, 0.0625f)); registerCompostMaterial(new ItemStack(Items.rotten_flesh), new StandardCompostMaterial(150, 0.125f)); registerCompostMaterial(new ItemStack(Items.leather), new StandardCompostMaterial(150, 0.125f)); registerCompostMaterial("treeWood", new StandardCompostMaterial(300, 0.25f)); registerCompostMaterial("logWood", new StandardCompostMaterial(300, 0.25f)); registerCompostMaterial("treeLeaves", defaultMaterial); registerCompostMaterial("treeSapling", defaultMaterial); registerCompostMaterial("stickWood", defaultMaterial); registerCompostMaterial(IPlantable.class, defaultMaterial); registerCompostMaterial(IGrowable.class, defaultMaterial); registerCompostMaterial(BlockLeavesBase.class, defaultMaterial); registerCompostMaterial(BlockVine.class, defaultMaterial); registerCompostMaterial(ItemFood.class, defaultMaterial); }
public static PlantItem getForItem (IBlockAccess blockAccess, ItemStack itemStack) { if (itemStack == null || itemStack.getItem() == null) return null; IPlantable plantable = PlantRegistry.getPlantable(itemStack); if (plantable == null) return getForItem(itemStack); Block block = plantable.getPlant(blockAccess, 0, -1, 0); if (block == null) return getForItem(itemStack); int meta = plantable.getPlantMetadata(blockAccess, 0, -1, 0); if (meta == 0) meta = itemStack.getItemDamage(); return new PlantItem(itemStack, block, meta); }
/** * returns true if there is at least one cropblock nearby (x-1 to x+1, y+1, z-1 to z+1) */ private boolean isCropsNearby(World par1World, int par2, int par3, int par4) { byte b0 = 0; for (int l = par2 - b0; l <= par2 + b0; ++l) { for (int i1 = par4 - b0; i1 <= par4 + b0; ++i1) { int j1 = par1World.getBlockId(l, par3 + 1, i1); Block plant = blocksList[j1]; if (plant instanceof IPlantable && canSustainPlant(par1World, par2, par3, par4, ForgeDirection.UP, (IPlantable)plant)) { return true; } } } return false; }
@Override public void updateEntity() { if (worldObj.isRemote) { BalanceEnergy(); int range = 1; for (int i = -range; i <= range; i++) { for (int j = -range; j <= range; j++) { Block block = worldObj.getBlock(xCoord + i, yCoord, zCoord + j); if (this.energy >= 1) { if (block instanceof IPlantable) { { this.energy -= 1; block.updateTick(worldObj, xCoord + i, yCoord, zCoord + j, worldObj.rand); } } } } } } }
private boolean func_149822_e(World p_149822_1_, int p_149822_2_, int p_149822_3_, int p_149822_4_) { byte b0 = 0; for (int l = p_149822_2_ - b0; l <= p_149822_2_ + b0; ++l) { for (int i1 = p_149822_4_ - b0; i1 <= p_149822_4_ + b0; ++i1) { Block block = p_149822_1_.getBlock(l, p_149822_3_ + 1, i1); if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable) block)) { return true; } } } return false; }
@Override public boolean canSustainPlant (IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plantable) { TileEntityLargePot te = getTileEntity(world, x, y, z); if (te == null || te.getSubstrate() == null) return false; EnumPlantType plantType = plantable.getPlantType(world, x, y + 1, z); Block plant = plantable.getPlant(world, x, y + 1, z); Block substrate = Block.getBlockFromItem(te.getSubstrate()); ItemStack plantItem = new ItemStack(plant, 1, plantable.getPlantMetadata(world, x, y, z)); if (PlantRegistry.instance().isBlacklisted(plantItem)) return false; if (plant == Blocks.cactus) return substrate == Blocks.sand; return plantType == EnumPlantType.Crop && substrate == Blocks.farmland; }
protected void applyPlantable (World world, int x, int y, int z, TileEntityLargePot tile, EntityPlayer player, IPlantable plantable) { ItemStack itemStack = player.inventory.getCurrentItem(); // TODO: Non-compliant IPlantable, use config Block itemBlock = plantable.getPlant(world, x, y, z); int itemMeta = itemStack.getItemDamage(); if (itemBlock == null && plantable instanceof Block) { itemBlock = (Block) plantable; } else { int plantMeta = plantable.getPlantMetadata(world, x, y, z); if (plantMeta != world.getBlockMetadata(x, y, z)) itemMeta = plantMeta; } world.setBlock(x, y + 1, z, ModBlocks.largePotPlantProxy, itemMeta, 3); if (itemBlock instanceof BlockDoublePlant || itemBlock.getRenderType() == 40) world.setBlock(x, y + 2, z, ModBlocks.largePotPlantProxy, itemMeta | 8, 3); tile.setItem(itemStack.getItem(), itemMeta); tile.markDirty(); if (!player.capabilities.isCreativeMode && --itemStack.stackSize <= 0) player.inventory.setInventorySlotContents(player.inventory.currentItem, null); }
/** * Build the properties for the given block and store them into the internal map */ private BlockProperties(Block block){ // Lava is considered to NOT be a liquid, and is therefore not wallable. This is so we can build cities on the lava surface. isWater = block.getMaterial() == Material.water || block == Blocks.ice; isStair = block instanceof BlockStairs; isTree = block instanceof BlockLog || block instanceof IShearable || block instanceof BlockSnow; isFlowing = isWater || block.getMaterial() == Material.lava || block instanceof BlockDynamicLiquid || block instanceof BlockFalling; isWallable = isWater || block instanceof BlockAir || isTree || block instanceof BlockWeb || block instanceof BlockPumpkin || block instanceof BlockMelon || block instanceof BlockHugeMushroom || block instanceof IPlantable; isOre = block instanceof BlockClay || block instanceof BlockRedstoneOre || block instanceof BlockOre; isGround = block == Blocks.stone || block instanceof BlockDirt || block instanceof BlockGrass || block instanceof BlockGravel || block instanceof BlockSand || block instanceof BlockNetherrack || block instanceof BlockSoulSand || block instanceof BlockMycelium; // Define by what it is not. Not IS_WALLABLE and not a naturally occurring solid block (obsidian/bedrock are exceptions) isArtificial = !(isWallable || isOre || isGround); isDelayed = isStair || isFlowing || block instanceof BlockTorch || block instanceof BlockGlowstone || block instanceof BlockDoor || block instanceof BlockLever || block instanceof BlockSign || block instanceof BlockFire || block instanceof BlockButton || block instanceof BlockVine || block instanceof BlockRedstoneWire || block instanceof BlockDispenser || block instanceof BlockFurnace; // Define by what it is not. isLoaded = !(isWallable || isFlowing || block instanceof BlockTorch || block instanceof BlockLadder); props.put(block, this); }
private void spawnTree(World world, Random rand, int x, int z) { genLoop: for(int i = 0; i < rand.nextInt(5) - 2; i++) { int tries = 0; do { int posX = x + rand.nextInt(16); int posZ = z + rand.nextInt(16); int top = getTopBlockCoord(world, posX, posZ); Block soil = getTopBlock(world, posX, posZ); if(soil == null) { tries++; continue; } if(soil.canSustainPlant(world, posX, top, posZ, ForgeDirection.UP, (IPlantable)NCblock.saplingOrange)) { (new NCtreeGen(5, 5)).generateTree(NCblock.saplingOrange, NCblock.orangeWood, NCblock.orangeLeaves, world, rand, posX, top + 1, posZ); break genLoop; } else { tries++; continue; } } while(tries < 16); } }
@Override public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant) { final int metadata = world.getBlockMetadata(x, y, z); if (metadata < 5 && metadata > 13) { return false; } plant.getPlantID(world, x, y + 1, z); if (plant instanceof BlockFlower) { return true; } return false; }