content: package net.minecraft.world.gen.feature;
  
  import net.minecraft.block.Block;
  import net.minecraft.block.material.Material;
  import net.minecraft.block.state.IBlockState;
  import net.minecraft.init.Blocks;
  import net.minecraft.util.BlockPos;
  import net.minecraft.world.World;
  
  import java.util.Random;
  
  public class WorldGenShrub extends WorldGenTrees {
      private final IBlockState leavesMetadata;
      private final IBlockState woodMetadata;
  
      public WorldGenShrub(IBlockState p_i46450_1_, IBlockState p_i46450_2_) {
          super(false);
          this.woodMetadata = p_i46450_1_;
          this.leavesMetadata = p_i46450_2_;
      }
  
      public boolean generate(World worldIn, Random rand, BlockPos position) {
          Block block;
  
          while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0) {
              position = position.down();
          }
  
          Block block1 = worldIn.getBlockState(position).getBlock();
  
          if (block1 == Blocks.dirt || block1 == Blocks.grass) {
              position = position.up();
              this.setBlockAndNotifyAdequately(worldIn, position, this.woodMetadata);
  
              for (int i = position.getY(); i <= position.getY() + 2; ++i) {
                  int j = i - position.getY();
                  int k = 2 - j;
  
                  for (int l = position.getX() - k; l <= position.getX() + k; ++l) {
                      int i1 = l - position.getX();
  
                      for (int j1 = position.getZ() - k; j1 <= position.getZ() + k; ++j1) {
                          int k1 = j1 - position.getZ();
  
                          if (Math.abs(i1) != k || Math.abs(k1) != k || rand.nextInt(2) != 0) {
                              BlockPos blockpos = new BlockPos(l, i, j1);
  
                              if (!worldIn.getBlockState(blockpos).getBlock().isFullBlock()) {
                                  this.setBlockAndNotifyAdequately(worldIn, blockpos, this.leavesMetadata);
                              }
                          }
                      }
                  }
              }
          }
  
          return true;
      }
  }
  