Skip to content

API reference Obsidian.API

IRegion interface

public interface IRegion : IAsyncDisposable

In Obsidian.API.

Properties

Entities

IReadOnlyDictionary<int, IEntity> Entities { get; }

The entities in the region's chunks, by entity id. Read-only: the level adds and removes entities (see ILevel.TryAddEntity and ILevel.DestroyEntityAsync), keeping its other records of them in step.

int LoadedChunkCount { get; }string RegionFolder { get; }int X { get; }int Z { get; }

Methods

Task BeginTickAsync(CancellationToken cts = null);Task FlushAsync(CancellationToken cts = null);IEnumerable<IChunk> GeneratedChunks();ValueTask<IChunk> GetChunkAsync(int x, int z);

GetOrAddChunkAsync(int, int, Func<IChunk>)

ValueTask<IChunk> GetOrAddChunkAsync(int x, int z, Func<IChunk> create);

Gets the chunk at (x, z) in this region, loading it from disk or storing the one create makes when there's none. Every caller gets the same instance.

Task<bool> InitAsync();void SetChunk(IChunk chunk);Task UnloadChunk(int x, int z);

On this page