private void OnGUI()
    {
        save = EditorGUILayout.TextField("save", save);

        pos = EditorGUILayout.Vector3IntField("pos", pos);
        GUILayout.Label("type=" + type);
        GUILayout.Label("data=" + blockdata);
        GUILayout.Label("biome=" + biomeType);
        GUILayout.Label("skyLight=" + skyLight);
        if (GUILayout.Button("Update"))
        {
            int chunkX = Mathf.FloorToInt(pos.x / 16f);
            int chunkY = Mathf.FloorToInt(pos.y / 16f);
            int chunkZ = Mathf.FloorToInt(pos.z / 16f);

            int xInChunk = pos.x - chunkX * 16;
            int yInChunk = pos.y - chunkY * 16;
            int zInChunk = pos.z - chunkZ * 16;

            TagNodeCompound Chunk = null;

            int regionX = NBTHelper.GetRegionCoordinate(chunkX);
            int regionZ = NBTHelper.GetRegionCoordinate(chunkZ);

            string path = Environment.ExpandEnvironmentVariables("%APPDATA%");
            if (!Directory.Exists(path))
            {
                path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            }

            path = Path.Combine(path, ".minecraft");
            path = Path.Combine(path, "saves");
            path = Path.Combine(path, save);
            path = Path.Combine(path, "region");
            path = Path.Combine(path, "r." + regionX + "." + regionZ + ".mca");
            RegionFile region = new RegionFile(path);

            if (region != null)
            {
                int _x = chunkX - regionX * 32;
                int _z = chunkZ - regionZ * 32;
                if (region.HasChunk(_x, _z))
                {
                    NbtTree _tree = new NbtTree();
                    using (Stream stream = region.GetChunkDataInputStream(_x, _z))
                    {
                        _tree.ReadFrom(stream);
                    }
                    Chunk = _tree.Root;
                }
            }
            if (Chunk != null)
            {
                TagNodeCompound Level = Chunk["Level"] as TagNodeCompound;

                TagNodeList Sections = Level["Sections"] as TagNodeList;
                if (chunkY < Sections.Count)
                {
                    TagNodeCompound section = Sections[chunkY] as TagNodeCompound;

                    TagNodeByteArray Blocks = section["Blocks"] as TagNodeByteArray;
                    byte[]           blocks = new byte[4096];
                    Buffer.BlockCopy(Blocks, 0, blocks, 0, 4096);

                    int blockPos = yInChunk * 16 * 16 + zInChunk * 16 + xInChunk;
                    type = blocks[blockPos];

                    TagNodeByteArray Data = section["Data"] as TagNodeByteArray;
                    blockdata = NBTHelper.GetNibble(Data.Data, blockPos);

                    TagNodeByteArray SkyLight = section["SkyLight"] as TagNodeByteArray;
                    skyLight = NBTHelper.GetNibble(SkyLight.Data, blockPos);
                }

                TagNodeByteArray Biomes = Level["Biomes"] as TagNodeByteArray;
                biomeType = Biomes[xInChunk * 16 + zInChunk];
            }

            Biome biome;
            if (biomeType < 6)
            {
                biome = gBiomes[biomeType];
            }
            else
            {
                biome = gBiomes[0];
                Debug.Log("no biome,type=" + biomeType);
            }
            float temp = biome.temp - Mathf.Max(pos.y - 64, 0) * 0.0016f;
            AdjTemp     = Mathf.Clamp01(temp);
            AdjRainfall = Mathf.Clamp01(biome.rainfall) * AdjTemp;

            Vector2   uv    = new Vector2(AdjTemp, AdjRainfall);
            Texture2D grass = Resources.Load <Texture2D>("GUI/grass");
            c = grass.GetPixelBilinear(1 - AdjTemp, AdjRainfall);
        }
        GUILayout.Label("temp=" + AdjTemp);
        GUILayout.Label("rainfall=" + AdjRainfall);
        EditorGUILayout.ColorField(c, GUILayout.Height(30));
    }