TileEntity

abstract class TileEntity(val pos: BlockPos, blockState: NovaBlockState, data: Compound) : DataHolder

A custom tile entity.

Inheritors

Constructors

Link copied to clipboard
constructor(pos: BlockPos, blockState: NovaBlockState, data: Compound)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
abstract inner class GlobalTileEntityMenu(texture: GuiTexture? = null) : TileEntity.TileEntityMenu

A menu for a TileEntity that uses the same instance for all players.

Link copied to clipboard
abstract inner class IndividualTileEntityMenu(player: Player, texture: GuiTexture? = null) : TileEntity.TileEntityMenu

A menu for a TileEntity that uses a separate instance for each player.

Link copied to clipboard
abstract inner class TileEntityMenu

A menu for a TileEntity.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
lateinit var coroutineSupervisor: Job

The supervisor Job for coroutines of this TileEntity.

Link copied to clipboard

The FakeItemDisplay(s) used to display the model of this TileEntity, if it is entity-backed.

Link copied to clipboard

Whether this TileEntity is enabled.

Link copied to clipboard

The MenuContainer for this TileEntity's gui. May stay uninitialized if the TileEntity has no gui.

Link copied to clipboard
var owner: OfflinePlayer?

The OfflinePlayer that placed this TileEntity, may be null if it wasn't placed by a player.

Link copied to clipboard

The UUID of the Player that placed this TileEntity, may be null if it wasn't placed by a player.

Link copied to clipboard
Link copied to clipboard
val uuid: UUID

The UUID of this TileEntity.

Functions

Link copied to clipboard
fun dropProvider(provider: () -> Collection<ItemStack>)

Registers a new drop provider that will be called during TileEntity.getDrops when this TileEntity is destroyed.

Link copied to clipboard
open fun getDrops(includeSelf: Boolean): List<ItemStack>

Gets a list of ItemStacks to be dropped when this TileEntity is destroyed.

Link copied to clipboard
open fun getExp(): Int

Gets the amount of exp to be dropped when this TileEntity is destroyed.

Link copied to clipboard
fun getViewers(): List<Player>

Gets a List of all players that this TileEntity is visible for.

Link copied to clipboard

Called when this TileEntity is destroyed.

Link copied to clipboard
open fun handleDisable()

Called when this TileEntity is disabled.

Link copied to clipboard

Called when this TileEntity stops ticking.

Link copied to clipboard
open fun handleEnable()

Called when this TileEntity is enabled.

Link copied to clipboard

Called when this TileEntity starts ticking.

Link copied to clipboard

Called when this TileEntity is placed.

Link copied to clipboard
Link copied to clipboard
open fun handleTick()

Called every tick for every TileEntity that is in a loaded chunk.

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
open fun saveData()

Called to save all data using the storeData method.

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
fun storedFluidContainer(name: String, allowedTypes: Set<FluidType>, capacity: Provider<Long>, persistent: Boolean = false, updateHandler: () -> Unit? = null): FluidContainer

Retrieves a FluidContainer stored under name or creates an empty new one. The values allowedTypes and capacity are not serialized and will be applied every time. Then registers the specified updateHandler.

Link copied to clipboard
fun storedInventory(name: String, size: Int, preUpdateHandler: (ItemPreUpdateEvent) -> Unit? = null, postUpdateHandler: (ItemPostUpdateEvent) -> Unit? = null): VirtualInventory

Retrieves a VirtualInventory stored under name or creates a new one using the specified size. Then registers the specified postUpdateHandler and preUpdateHandler.

fun storedInventory(name: String, size: Int, persistent: Boolean = false, maxStackSizes: IntArray = IntArray(size) { 64 }, preUpdateHandler: (ItemPreUpdateEvent) -> Unit? = null, postUpdateHandler: (ItemPostUpdateEvent) -> Unit? = null): VirtualInventory

Retrieves a VirtualInventory stored under name or creates a new one using the specified size, maxStackSizes and persistent properties. Then registers the specified postUpdateHandler and preUpdateHandler.

Link copied to clipboard
fun storedRegion(name: String, minSize: Provider<Int>, maxSize: Provider<Int>, defaultSize: Int, createRegion: (Int) -> Region): DynamicRegion

Creates a DynamicRegion with the size stored under name or defaultSize if it doesn't exist, using createRegion. The minSize and maxSize properties are not serialized and will be applied every time.

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.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Changes the block state of this TileEntity to blockState.