observe

abstract fun observe(observer: () -> Unit): AutoCloseable(source)

Registers the sole retained-node observer for synchronized content changes.

The callback runs synchronously on the owner thread from MinecraftUiPlatform.refresh and may invalidate the retained node.

Return

idempotent owner-thread subscription release.

Parameters

observer

callback invoked only when the item snapshot changes.

Throws

when called from another thread, after platform close, or while another observer is active.