GuiList

class GuiList<T>(collection: List<T>) : AbstractGuiList<T, List<T>> (source)

Wraps a normal list into a format which can be used by specific gui components - the most prominent one being net.silkmc.silk.igui.GuiCompound. This gui list is immutable.

Constructors

Link copied to clipboard
constructor(collection: List<T>)

Functions

Link copied to clipboard
fun invokeListeners(): Job

Invokes all listeners, causing all open guis using this list to update.

Link copied to clipboard
inline suspend fun <R> lookup(block: (List<T>) -> R): R

Provides access to the internal collection in an immutable form. Please do only use the collection inside the block lambda, as only there thread-safety can be guaranteed.

Link copied to clipboard
fun onChange(block: suspend (List<T>) -> Unit)

Registers an onChangeListener, which will be called if the content of this list is mutated.

Link copied to clipboard
fun removeOnChangeListener(block: suspend (List<T>) -> Unit)

Unregisters an already registered onChangeListener.