Class WorldData
Owns loaded chunks and metadata for a single world instance.
public sealed class WorldData
- Inheritance
-
WorldData
- Inherited Members
Constructors
WorldData(WorldMetadata)
Creates a world-data container for the supplied metadata.
public WorldData(WorldMetadata metadata)
Parameters
metadataWorldMetadataThe metadata associated with the world instance.
Properties
LoadedChunkCount
Gets the number of chunks currently loaded in memory.
public int LoadedChunkCount { get; }
Property Value
Metadata
Gets the persistent metadata associated with this world.
public WorldMetadata Metadata { get; }
Property Value
Methods
EnumerateLoadedChunks()
Enumerates all chunks currently loaded in memory.
public IEnumerable<Chunk> EnumerateLoadedChunks()
Returns
- IEnumerable<Chunk>
The currently loaded chunks.
GetOrCreateChunk(ChunkCoord)
Resolves a chunk from memory or creates a new empty loaded chunk when one is not present.
public Chunk GetOrCreateChunk(ChunkCoord coord)
Parameters
coordChunkCoordThe chunk coordinate to resolve.
Returns
- Chunk
The existing or newly created chunk.
HasChunk(ChunkCoord)
Returns whether a chunk is currently loaded at the supplied coordinate.
public bool HasChunk(ChunkCoord coord)
Parameters
coordChunkCoordThe chunk coordinate to inspect.
Returns
RemoveChunk(ChunkCoord)
Removes a loaded chunk from memory when present.
public bool RemoveChunk(ChunkCoord coord)
Parameters
coordChunkCoordThe chunk coordinate to remove.
Returns
SetChunk(Chunk)
Stores or replaces a loaded chunk at its coordinate.
public void SetChunk(Chunk chunk)
Parameters
chunkChunkThe chunk to store.
TryGetChunk(ChunkCoord, out Chunk)
Attempts to resolve a loaded chunk by coordinate.
public bool TryGetChunk(ChunkCoord coord, out Chunk chunk)
Parameters
coordChunkCoordThe chunk coordinate to resolve.
chunkChunkThe loaded chunk when present.
Returns
UpdateMetadata(WorldMetadata)
Replaces the persistent metadata associated with this world.
public void UpdateMetadata(WorldMetadata metadata)
Parameters
metadataWorldMetadataThe metadata to store.