Exemple #1
0
        /// <summary>
        /// Sets block at given relative position.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="z"></param>
        /// <param name="block"></param>
        public void FastSetBlockAt(byte x, byte y, byte z, Block block)
        {
            switch (block.Exists)
            {
            case false:
                if (this.LowestEmptyBlockOffset > y && y > 0)
                {
                    this.LowestEmptyBlockOffset = (byte)(y - 1);
                }
                break;

            case true:
                if (y > this.HighestSolidBlockOffset && y < MaxHeightIndexInBlocks)
                {
                    this.HighestSolidBlockOffset = (byte)(y + 1);
                }
                break;
            }

            BlockStorage.FastSetBlockAt(this.WorldPosition.X + x, y, this.WorldPosition.Z + z, block);
            this.ChunkState = ChunkState.AwaitingRelighting;
        }