DataHolder

abstract class DataHolder

Inheritors

Functions

Link copied to clipboard

Checks whether there is data stored under the given key, regardless of whether it is persistent or not.

Link copied to clipboard
fun removeData(key: String)

Removes the data stored under the given key, regardless of whether it is persistent or not.

Link copied to clipboard
inline fun <T> retrieveData(key: String, defaultValue: () -> T): T

Retrieves data from the data Compound of this TileEntity. If it can't find anything under the given key, the result of the defaultValue lambda is returned.

inline fun <T> retrieveData(type: KType, key: String, defaultValue: () -> T): T

Retrieves data of the specified type or invokes the defaultValue lambda if there is no data stored under the given key.

Link copied to clipboard
inline fun <T> retrieveDataOrNull(key: String): T?

Retrieves data of type T or returns null if there is no data stored under the given key.

fun <T> retrieveDataOrNull(type: KType, key: String): T?

Retrieves data of the specified type or returns null if there is no data stored under the given key.

Link copied to clipboard
inline fun <T> storeData(key: String, value: T?, persistent: Boolean = false)

Stores value as the reified type T under the given key.

fun <T> storeData(type: KType, key: String, value: T?, persistent: Boolean = false)

Stores value as the given type under the given key.

Link copied to clipboard
inline fun <T : Any> storedValue(key: String, persistent: Boolean = false): MutableProvider<T?>
inline fun <T : Any> storedValue(key: String, noinline defaultValue: () -> T): MutableProvider<T>
inline fun <T : Any> storedValue(key: String, persistent: Boolean, noinline defaultValue: () -> T): MutableProvider<T>

Creates a MutableProvider to which properties can delegate.