コード例 #1
0
ファイル: FlatlandGeneratorr.cs プロジェクト: wqd1019dqw/Alex
        public IChunkColumn GenerateChunkColumn(ChunkCoordinates chunkCoordinates)
        {
            ChunkColumn column = new ChunkColumn();

            column.X = chunkCoordinates.X;
            column.Z = chunkCoordinates.Z;

            for (int x = 0; x < 16; x++)
            {
                for (int z = 0; z < 16; z++)
                {
                    column.SetBlockState(x, 0, z, Bedrock);
                    column.SetBlockState(x, 1, z, Dirt);
                    column.SetBlockState(x, 2, z, Dirt);
                    column.SetBlockState(x, 3, z, Grass);

                    column.SetSkyLight(x, 0, z, 15);
                    column.SetSkyLight(x, 1, z, 15);
                    column.SetSkyLight(x, 2, z, 15);
                    column.SetSkyLight(x, 3, z, 15);
                    column.SetSkyLight(x, 4, z, 15);
                }
            }

            return(column);
        }
コード例 #2
0
        public ChunkColumn GenerateChunkColumn(ChunkCoordinates chunkCoordinates)
        {
            int cc = 0;

            ChunkColumn chunk = new ChunkColumn();

            chunk.X = chunkCoordinates.X;
            chunk.Z = chunkCoordinates.Z;

            for (int x = 0; x < 16; ++x)
            {
                for (int z = 0; z < 16; ++z)
                {
                    int rx = chunkCoordinates.X * 16 + x;
                    int rz = chunkCoordinates.Z * 16 + z;

                    BlockState iblockstate = GetBlockStateFor(rx, rz);

                    if (iblockstate != null)
                    {
                        chunk.SetBlockState(x, 70, z, iblockstate);
                        chunk.Height[((z << 4) + (x))] = 70;
                    }

                    chunk.SetSkyLight(x, 70, z, 15);
                    chunk.SetSkyLight(x, 71, z, 15);
                    chunk.SetSkyLight(x, 69, z, 15);
                }
            }

            chunk.CalculateHeight();
            return(chunk);
        }
コード例 #3
0
ファイル: DebugWorldGenerator.cs プロジェクト: lvyitian1/Alex
        public ChunkColumn GenerateChunkColumn(ChunkCoordinates chunkCoordinates)
        {
            return(_cache.GetOrAdd(
                       chunkCoordinates, (cc) =>
            {
                ChunkColumn chunk = new ChunkColumn(chunkCoordinates.X, chunkCoordinates.Z);
                for (int x = 0; x < 16; x++)
                {
                    for (int z = 0; z < 16; z++)
                    {
                        int rx = (chunkCoordinates.X * 16) + x;
                        int rz = (chunkCoordinates.Z * 16) + z;

                        BlockState iblockstate = GetBlockStateFor(rx, rz);

                        if (iblockstate != null)
                        {
                            chunk.SetBlockState(x, 1, z, iblockstate);
                            //chunk.Height[((z << 4) + (x))] = 70;
                        }

                        chunk.SetSkyLight(x, 2, z, 15);
                        //  chunk.SetSkyLight(x, 71, z, 15);
                        //  chunk.SetSkyLight(x, 69, z, 15);
                    }
                }

                //chunk.CalculateHeight();
                return chunk;
            }));
        }
コード例 #4
0
ファイル: DemoGenerator.cs プロジェクト: astroffnet/Alex
        public ChunkColumn GenerateChunkColumn(ChunkCoordinates chunkCoordinates)
        {
            //  IBlockState stone = BlockFactory.GetBlockState("minecraft:stone");
            //  IBlockState grass = BlockFactory.GetBlockState("minecraft:grass");


            ChunkColumn column = new ChunkColumn();

            for (int x = 0; x < 16; x++)
            {
                var rx = (chunkCoordinates.X * 16) + x;
                for (int z = 0; z < 16; z++)
                {
                    var rz = (chunkCoordinates.Z * 16) + z;

                    int height = GetHeight(rx, rz);

                    bool placeWater = false;
                    //if (height <= 3)
                    {
                        //placeWater = SimplexNoise.Evaluate(rz / 8f, rx / 8f) > 0f;
                        //height = 3;
                    }

                    for (int y = 0; y < Height; y++)
                    {
                        if (y > height - 1 && y <= 5)
                        {
                            column.SetBlockState(x, y, z, LiquidBlock);
                        }
                        else if (y < height)
                        {
                            column.SetBlockState(x, y, z, MainBlock);
                        }
                    }
                }
            }

            column.X = chunkCoordinates.X;
            column.Z = chunkCoordinates.Z;

            return(column);
        }
コード例 #5
0
        public IChunkColumn GenerateChunkColumn(ChunkCoordinates chunkCoordinates)
        {
            IChunkColumn c = new ChunkColumn()
            {
                X = chunkCoordinates.X,
                Z = chunkCoordinates.Z
            };

            for (int x = 0; x < ChunkColumn.ChunkWidth; x++)
            {
                for (int z = 0; z < ChunkColumn.ChunkDepth; z++)
                {
                    for (int y = 0; y < ChunkColumn.ChunkHeight; y++)
                    {
                        if (c.X == 0 && c.Z == 0)
                        {
                            IBlockState block;
                            switch (y >> 4)
                            {
                            case 0:
                                block = _dirt;
                                break;

                            case 1:
                                block = _stone;
                                break;

                            case 2:
                                block = _cobble;
                                break;

                            case 3:
                                block = _grass;
                                break;

                            //case 4:
                            //    break;
                            default:
                                continue;
                            }

                            c.SetBlockState(x, y, z, block);
                        }
                        else
                        {
                            //c.SetBlockState(x, y, z, _air);
                        }

                        c.SetSkyLight(x, y, z, 15);
                    }
                    c.SetHeight(x, z, 0);
                }
            }
            return(c);
        }
コード例 #6
0
        public ChunkColumn GenerateChunkColumn(ChunkCoordinates chunkCoordinates)
        {
            ChunkColumn column = new ChunkColumn();

            column.X = chunkCoordinates.X;
            column.Z = chunkCoordinates.Z;

            for (int x = 0; x < 16; x++)
            {
                for (int z = 0; z < 16; z++)
                {
                    column.SetBlockState(x, 0, z, Bedrock);
                    if (column.X == 1 && column.Z == 1)
                    {
                        for (int y = 1; y < 2; y++)
                        {
                            column.SetBlockState(x, y, z, Water.WithProperty("level", "8"));
                        }
                        column.SetBlockState(x, 3, z, Water.WithProperty("level", "3"));
                    }
                    else
                    {
                        column.SetBlockState(x, 1, z, Dirt);
                        column.SetBlockState(x, 2, z, Dirt);
                        column.SetBlockState(x, 3, z, Grass);

                        if (x == 8 && z == 8)
                        {
                            column.SetBlockState(x, 5, z, Slab.WithProperty("type", "bottom"));
                        }
                        else if (x == 8 && z == 7)
                        {
                            column.SetBlockState(x, 5, z, Slab.WithProperty("type", "top"));
                        }
                    }

                    column.SetSkyLight(x, 0, z, 15);
                    column.SetSkyLight(x, 1, z, 15);
                    column.SetSkyLight(x, 2, z, 15);
                    column.SetSkyLight(x, 3, z, 15);
                    column.SetSkyLight(x, 4, z, 15);
                }
            }

            return(column);
        }