Ejemplo n.º 1
0
        public override void Generate(IWorld world, IGrainFactory grainFactory, ChunkColumnStorage chunk, Biome biome, Random random, BlockWorldPos pos)
        {
            int           height   = random.Next(3) + _minCactiHeight;
            BlockChunkPos chunkPos = pos.ToBlockChunkPos();

            // 不超出世界边界
            if (pos.Y >= 1 && pos.Y + height + 1 <= 256)
            {
                if (CanCactiGrow(world, grainFactory, chunk, biome, random, pos, height))
                {
                    BlockState state = chunk[chunkPos.X, chunkPos.Y - 1, chunkPos.Z];
                    if (CanSustainCacti(state))
                    {
                        for (int y = 0; y < height; ++y)
                        {
                            chunk[chunkPos.X, chunkPos.Y + y, chunkPos.Z] = BlockStates.Cactus(CactusType.Interval15);
                        }
                    }
                }
            }
        }