Class WorldStorage
Provides file-system access for world metadata and chunk payloads.
public sealed class WorldStorage
- Inheritance
-
WorldStorage
- Inherited Members
Constructors
WorldStorage()
Creates storage services with the default metadata and chunk serializers.
public WorldStorage()
WorldStorage(WorldMetadataSerializer, ChunkSerializer)
Creates storage services with explicit serializer dependencies.
public WorldStorage(WorldMetadataSerializer worldMetadataSerializer, ChunkSerializer chunkSerializer)
Parameters
worldMetadataSerializerWorldMetadataSerializerThe serializer used for world metadata JSON.
chunkSerializerChunkSerializerThe serializer used for binary chunk payloads.
Methods
HasChunkData(string, ChunkCoord)
Returns true when chunk data exists on disk for the supplied coordinate.
public bool HasChunkData(string worldPath, ChunkCoord coord)
Parameters
worldPathstringThe root path of the world on disk.
coordChunkCoordThe chunk coordinate to inspect.
Returns
HasWorld(string)
Returns true when metadata exists for the supplied world path.
public bool HasWorld(string worldPath)
Parameters
worldPathstringThe root path of the world on disk.
Returns
LoadMetadata(string)
Loads world metadata from the supplied world path.
public WorldMetadata LoadMetadata(string worldPath)
Parameters
worldPathstringThe root path of the world on disk.
Returns
- WorldMetadata
The deserialized world metadata.
SaveChunk(string, Chunk)
Saves a chunk payload to the supplied world path.
public void SaveChunk(string worldPath, Chunk chunk)
Parameters
SaveMetadata(string, WorldMetadata)
Saves world metadata to the supplied world path.
public void SaveMetadata(string worldPath, WorldMetadata metadata)
Parameters
worldPathstringThe root path of the world on disk.
metadataWorldMetadataThe world metadata to serialize.
TryLoadChunk(string, ChunkCoord)
Attempts to load persisted chunk data for the supplied coordinate.
public Chunk TryLoadChunk(string worldPath, ChunkCoord coord)
Parameters
worldPathstringThe root path of the world on disk.
coordChunkCoordThe chunk coordinate to load.