Перейти к основному содержанию

TileEntity

TileEntity is a powerful mechanism that allows for creation of interactive blocks such as chests, furnaces, etc.

Index

Variables

consttileEntityCacheMap
since: 2.2.1b106internal

tileEntityCacheMap: {}

Type declaration

consttileEntityList
internal

tileEntityList: TileEntity[]

consttileEntityPrototypes
internal

tileEntityPrototypes: {}

Type declaration

Functions

addTileEntity

  • If the block on the specified coordinates is a TileEntity block and is not initialized, initializes it and returns created TileEntity object.


    Parameters

    Returns Nullable<TileEntity>

    Tile if one was created, null otherwise.

addUpdatableAsTileEntity

  • addUpdatableAsTileEntity(updatable: Updatable): void
  • Adding attached to block updatable, which is working like ordinary tile entity, except the fact that it registers in any case.


    Parameters

    Returns void

checkTileEntityForIndex

  • checkTileEntityForIndex(index: number): void
  • internal

    Parameters

    • index: number

    Returns void

createTileEntityForPrototype

destroyTileEntity

  • destroyTileEntity(tileEntity: TileEntity): boolean
  • destroyTileEntity(tileEntity: TileEntity, fromDestroyBlock: boolean): boolean
  • destroyTileEntity(tileEntity: TileEntity, fromDestroyBlock: boolean, isDropAllowed: boolean): boolean
  • Destroys TileEntity, dropping it's container.


    Parameters

    Returns boolean

    true if the it was destroyed successfully, false otherwise.

destroyTileEntityAtCoords

  • destroyTileEntityAtCoords(x: number, y: number, z: number, region?: BlockSource, isDropAllowed?: boolean): boolean
  • If the block on the specified coordinates is a TileEntity, destroys it, dropping it's container.


    Parameters

    • x: number
    • y: number
    • z: number
    • optionalregion: BlockSource
    • optionalisDropAllowed: boolean

    Returns boolean

    true if the it was destroyed successfully, false otherwise.

getPrototype

getTileEntity

isTileEntityBlock

  • isTileEntityBlock(blockID: number): boolean
  • Parameters

    • blockID: number

      numeric block ID

    Returns boolean

    true if the specified numeric block ID is a TileEntity block ID, false otherwise.

isTileEntityLoaded

  • isTileEntityLoaded(tileEntity: TileEntity): boolean
  • Checks whether the TileEntity is in the loaded chunk or not.

    More about capabilities

    The following chunks are verified:

    + +
    #
    + +

    Where "#" is the chunk containing the current TileEntity and "+" are the chunks that are also verified.


    Parameters

    Returns boolean

    true if the chunk with TileEntity and some of the surrounding chunks are loaded, false otherwise.

registerPrototype

  • Registers block as a ticking tile entity.


    Parameters

    • blockID: number

      numeric block ID to be used

    • customPrototype: TileEntityPrototype

      a set of defining parameters behavior

    Returns void

resetEngine

  • resetEngine(): void
  • internal

    Clears active game tile list, maintaining updatable states.


    Returns void