Beispiel #1
0
        /// <summary>
        /// Constructs a new Chunk object, reading header data out of a SaveReader.
        /// </summary>
        /// <param name="reader">The SaveReader to read from.</param>
        public Chunk(SaveIO.SaveReader reader, ChunkOffset offset)
        {
            long baseAddress = (long)offset;

            reader.Seek(baseAddress, SeekOrigin.Begin);

            // Read header data
            _name      = reader.ReadAscii(32);
            _entrySize = reader.ReadUInt32();
            reader.Seek(baseAddress + 0x28, SeekOrigin.Begin);
            _entryCount = reader.ReadUInt32();
            reader.Seek(baseAddress + 0x34, SeekOrigin.Begin);
            _firstDeleted  = reader.ReadUInt32();
            _nextFree      = reader.ReadUInt32();
            _activeEntries = reader.ReadUInt32();
            reader.Seek(baseAddress + 0x50, SeekOrigin.Begin);
            int entryListSize = reader.ReadInt32() - 0x54;

            _entryListStart = baseAddress + 0x54;
        }
Beispiel #2
0
 Vector3 GetDirVector(ChunkOffset offset)
 {
     return(new Vector3(offset.X, 0, offset.Z));
 }
Beispiel #3
0
    Vector3 GetNextPos(Vector3 current_pos, ChunkOffset offset)
    {
        var direction = GetDirVector(offset);

        return(current_pos + direction * ChunkSize);
    }
Beispiel #4
0
 public ChunkHolder GetHolder(ChunkHolder current, ChunkOffset dir)
 {
     return(AllHolders[Random.Range(0, AllHolders.Count)]);
 }
        public IBlock GetBlock(ChunkOffset chunkOffset, BlockOffset blockOffset)
        {
            Chunk chunk = FindChunk(chunkOffset);

            return(chunk?.GetBlock(blockOffset));
        }
        public void SetBlock(ChunkOffset chunkOffset, BlockOffset blockOffset, IBlock block)
        {
            Chunk chunk = FindChunk(chunkOffset);

            chunk?.SetBlock(blockOffset, block);
        }