Ejemplo n.º 1
0
 public Region(IBlockContainer parent, int xPos, int zPos, DefaultLayers layers)
 {
     _parent = parent;
     X       = xPos;
     Z       = zPos;
     _layers = layers;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="parent">The parent block container</param>
        /// <param name="xpos">The X-coordinate within the region</param>
        /// <param name="zpos">The Z-coordinate within the region</param>
        /// <param name="layers">The default layers. Can be 'null'</param>
        public Chunk(IBlockContainer parent, int xpos, int zpos, DefaultLayers layers)
        {
            Parent = parent;
            _xPos  = xpos;
            _zPos  = zpos;

            // Set default blocks
            if (layers == null)
            {
                return;
            }
            // Iterate layers
            for (int y = 0; y < World.MaxHeight; y++)
            {
                Block material = layers.GetLayer(y);
                if (material == null)
                {
                    continue;
                }
                // Iterate area
                for (int x = 0; x < BlocksPerChunkSide; x++)
                {
                    for (int z = 0; z < BlocksPerChunkSide; z++)
                    {
                        // Set Block
                        SetBlock(new Position(x, y, z), material);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 public World(Level level, DefaultLayers layers)
 {
     _level  = level;
     _layers = layers;
 }