API reference Obsidian.API.Client
IClientWorld interface
Read-only access to the dimension the client is viewing. It contains only what the server sent, including local block prediction; queries never load chunks. Obtain it from IClientConnection.World or ClientBlockEntityExtensions.GetClientWorld.
public interface IClientWorld
In Obsidian.API.Client.
Remarks
Block, chunk and synced block entity data queries may run on any thread. Each observes the state at that call; several calls are not an atomic world snapshot. Entity queries and live block entity access require the game's thread (ticks, key bindings and screens), and throw InvalidOperationException elsewhere. Do not retain the view across disconnects; obtain the current connection's view again.
Methods
GetBlock(Vector)
IBlock GetBlock(Vector position);The block state at the position, or air for an unloaded chunk or outside the dimension's height.
GetBlockEntity(Vector)
BlockEntity GetBlockEntity(Vector position);The live client instance of a mod's block entity, or null before its first tick or after removal. Game thread only: use your mod's class and never access or retain this mutable instance from another thread. A packet update is applied to it on the next client tick; synced NBT may already be newer.
GetBlockEntityData(Vector)
NbtCompound GetBlockEntityData(Vector position);A deep copy of the block entity's synced NBT, or null when none is present. Changing the result cannot change the client's published data. This is update data, not the server's complete saved data.
GetEntities(BoundingBox)
IReadOnlyList<IClientEntity> GetEntities(BoundingBox bounds);Detached snapshots of entities whose current positions are inside the box, including its boundary. Tests positions, not collision boxes. Game thread only; result order is unspecified.
GetEntity(int)
IClientEntity GetEntity(int id);A detached snapshot of a tracked entity, or null if absent or removed. Game thread only.
IsChunkLoaded(int, int)
bool IsChunkLoaded(int chunkX, int chunkZ);Whether the client has a chunk column, using chunk coordinates (block coordinates shifted by 4).
TryGetChunkAttachment<TValue>(int, int, AttachmentType<TValue>, TValue)
bool TryGetChunkAttachment<TValue>(int chunkX, int chunkZ, AttachmentType<TValue> type, out TValue value);Reads a detached synced attachment of a loaded chunk column. Game thread only.
TryGetEntityAttachment<TValue>(int, AttachmentType<TValue>, TValue)
bool TryGetEntityAttachment<TValue>(int entityId, AttachmentType<TValue> type, out TValue value);Reads a detached synced attachment of a tracked entity. Game thread only.
TryGetPlayerAttachment<TValue>(AttachmentType<TValue>, TValue)
bool TryGetPlayerAttachment<TValue>(AttachmentType<TValue> type, out TValue value);Reads a detached synced attachment of the local player. Game thread only.