Example #1
0
        internal void Plant(int x, int y, int z, int trunksize)
        {
            // trunk
            for (int dy = 0; dy < trunksize; dy++)
            {
                Pointer.ReplaceBlock(x, y + dy, z, BlockRepository.Air.Id, BlockRepository.Wood.Id);
            }
            // top
            int topsize = trunksize;

            for (int dx = -topsize / 2; dx <= topsize / 2; dx++)
            {
                for (int dy = 0; dy <= topsize; dy++)
                {
                    for (int dz = -topsize / 2; dz <= topsize / 2; dz++)
                    {
                        if (dx * dx + dy * dy + dz * dz > (topsize * topsize / 3) + 1)
                        {
                            continue;
                        }
                        Pointer.ReplaceBlock(x + dx, y + trunksize / 2 + dy, z + dz, BlockRepository.Air.Id, BlockRepository.Leaf.Id);
                    }
                }
            }
        }
Example #2
0
 internal void Plant(int x, int y, int z, int bushsize)
 {
     for (int dx = -bushsize / 2; dx <= bushsize / 2; dx++)
     {
         for (int dy = 0; dy <= bushsize; dy++)
         {
             for (int dz = -bushsize / 2; dz <= bushsize / 2; dz++)
             {
                 if (dx * dx + dy * dy + dz * dz > (bushsize * bushsize / 3))
                 {
                     continue;
                 }
                 Pointer.ReplaceBlock(x + dx, y + dy, z + dz, BlockRepository.Air.Id, BlockRepository.Leaf.Id);
             }
         }
     }
 }