Ejemplo n.º 1
0
 public Chunk(Coordinates2D coordinates)
     : this()
 {
     X = coordinates.X;
     Z = coordinates.Z;
     const int size = Width * Height * Depth;
     Blocks = new byte[size];
     Metadata = new NibbleArray(size);
     BlockLight = new NibbleArray(size);
     SkyLight = new NibbleArray(size);
 }
Ejemplo n.º 2
0
 public ReadOnlyNibbleArray(NibbleArray array)
 {
     NibbleArray = array;
 }
Ejemplo n.º 3
0
        public void Deserialize(NbtTag value)
        {
            var chunk = new Chunk();
            var tag = (NbtCompound)value;

            Biomes = chunk.Biomes;
            HeightMap = chunk.HeightMap;
            LastUpdate = chunk.LastUpdate;
            TerrainPopulated = chunk.TerrainPopulated;
            X = tag["X"].IntValue;
            Z = tag["Z"].IntValue;
            Blocks = tag["Blocks"].ByteArrayValue;
            Metadata = new NibbleArray();
            Metadata.Data = tag["Data"].ByteArrayValue;
            BlockLight = new NibbleArray();
            BlockLight.Data = tag["BlockLight"].ByteArrayValue;
            SkyLight = new NibbleArray();
            SkyLight.Data = tag["SkyLight"].ByteArrayValue;

            if (tag.Contains("TileEntities"))
            {
                foreach (var entity in tag["TileEntities"] as NbtList)
                {
                    TileEntities[new Coordinates3D(entity["coordinates"][0].IntValue,
                        entity["coordinates"][1].IntValue,
                        entity["coordinates"][2].IntValue)] = entity["value"][0] as NbtCompound;
                }
            }

            // TODO: Entities
        }
Ejemplo n.º 4
0
        public void Deserialize(NbtTag value)
        {
            var tag = (NbtCompound)value;

            X = tag["X"].IntValue;
            Z = tag["Z"].IntValue;
            if (tag.Contains("TerrainPopulated"))
                TerrainPopulated = tag["TerrainPopulated"].ByteValue > 0;
            if (tag.Contains("LightPopulated"))
                LightPopulated = tag["LightPopulated"].ByteValue > 0;
            Blocks = tag["Blocks"].ByteArrayValue;
            Metadata = new NibbleArray();
            Metadata.Data = tag["Data"].ByteArrayValue;
            BlockLight = new NibbleArray();
            BlockLight.Data = tag["BlockLight"].ByteArrayValue;
            SkyLight = new NibbleArray();
            SkyLight.Data = tag["SkyLight"].ByteArrayValue;
            
            if (tag.Contains("TileEntities"))
            {
                foreach (var entity in tag["TileEntities"] as NbtList)
                {
                    TileEntities[new Coordinates3D(entity["coordinates"][0].IntValue,
                        entity["coordinates"][1].IntValue,
                        entity["coordinates"][2].IntValue)] = entity["value"][0] as NbtCompound;
                }
            }
            UpdateHeightMap();

            // TODO: Entities
        }
Ejemplo n.º 5
0
 public ReadOnlyNibbleArray(NibbleArray array)
 {
     NibbleArray = array;
 }