示例#1
0
 static void LoadBlocksMCRFormat(ChunkData chunk, CompoundContainer nbtCompound)
 {
     byte[] blocks = nbtCompound.Get <byte[]>("Blocks");
     byte[] add;             //TODO: include "Add" bits in ID (from modded worlds)
     if (nbtCompound.Contains("Add"))
     {
         add = nbtCompound.Get <byte[]>("Add");
     }
     byte[] meta = nbtCompound.Get <byte[]>("Data");            //TODO: also include meta in block lookup
     for (int x = 0; x < 16; x++)
     {
         for (int z = 0; z < 16; z++)
         {
             for (int y = 0; y < 128; y++)
             {
                 byte id    = blocks[(x * 16 + z) * 128 + y];
                 var  block = BlockList.FindByNumeric(new NumericID(id, 0));
                 if (block != null)
                 {
                     chunk.SetBlockAt(x, y, z, new BlockState(block));
                 }
             }
         }
     }
 }