Beispiel #1
0
    private void CreateDecorationAt(int blockX, int blockY, int blockZ, MCRandom random)
    {
        int trunkLength = random.RandomRange(6, 10);

        // Trunk
        for (int z = blockZ + 1; z <= blockZ + trunkLength; z++)
        {
            CreateTrunkAt(blockX, blockY, z);
        }

        // Leaves
        CreateSphereAt(blockX, blockY, blockZ + trunkLength, random.RandomRange(3, 4));
    }
Beispiel #2
0
    /// <summary>
    /// Determines if a tree decoration even wants to be at this location.
    /// </summary>
    /// <param name="blockX"></param>
    /// <param name="blockY"></param>
    /// <param name="blockZ"></param>
    /// <param name="random"></param>
    /// <returns></returns>
    private bool IsAValidLocationforDecoration(int blockX, int blockY, int blockZ, MCRandom random)
    {
        // We don't want TOO many trees...make it a 1% chance to be drawn there.
        if (random.RandomRange(1, 100) < 99)
        {
            return(false);
        }

        // Trees don't like to grow too high
        if (blockZ >= m_WorldData.DepthInBlocks - 20)
        {
            return(false);
        }

        // Trees like to have a minimum amount of space to grow in.
        return(SpaceAboveIsEmpty(blockX, blockY, blockZ, 8, 2, 2));
    }