• Public
  • Public/Protected
  • All

Namespace TileEntity

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


[key: string]: any

Any other user-defined methods and properties




blockSource: BlockSource

BlockSource object to manipulate TileEntity's position in world

Optional click

click: (id: number, count: number, data: number, coords: ItemUseCoordinates, player: number, extra: ItemExtraData) => boolean | void

Called when player uses some item on a TileEntity


true if the event is handled and should not be propagated to the next handlers. E.g. return true if you don't want the user interface to be opened

Type declaration

Optional client

client: { containerEvents?: {}; events?: {}; load?: () => void; tick?: () => void; unload?: () => void }

Client TileEntity prototype copy

Type declaration

  • Optional containerEvents?: {}

    Events of the container's client copy

  • Optional events?: {}

    Events that receive packets on the client side

    • [packetName: string]: (packetData: any, packetExtra: any) => void

      Example of the client packet event function

        • (packetData: any, packetExtra: any): void
        • Parameters

          • packetData: any
          • packetExtra: any

          Returns void

  • Optional load?: () => void

    Called when the client copy is created

      • (): void
      • Returns void

  • Optional tick?: () => void

    Called every tick on client thread

      • (): void
      • Returns void

  • Optional unload?: () => void

    Called on destroying the client copy

      • (): void
      • Returns void


TileEntity's item container

Optional containerEvents

containerEvents: {}

Events of the container on the server side

Type declaration

Optional created

created: () => void

Called when a TileEntity is created

Type declaration

    • (): void
    • Returns void


data: {}

TileEntity data values object

Type declaration

  • [key: string]: any

Optional defaultValues

defaultValues: {}

Default data values, will be initially added to TileEntity.data field

Type declaration

  • [key: string]: any

Optional destroy

destroy: () => boolean | void

Occurs when the TileEntity is being destroyed


true to prevent TileEntity object from destroying (but if the block was destroyed, returning true from this function doesn't replace the missing block with a new one)

Type declaration

    • (): boolean | void
    • Returns boolean | void

Optional destroyBlock

destroyBlock: (coords: ItemUseCoordinates, player: number) => void

Occurs when a block of the TileEntity is being destroyed. See Callback.DestroyBlockFunction for details

Type declaration

Readonly dimension

dimension: number

dimension where the TileEntity is located

Optional events

events: {}

Events that receive packets on the server side

Type declaration

  • [packetName: string]: (packetData: any, packetExtra: any, connectedClient: NetworkClient) => void

    Example of the server packet event function. 'this.sendResponse' method is only available here.

      • (packetData: any, packetExtra: any, connectedClient: NetworkClient): void
      • Parameters

        • packetData: any
        • packetExtra: any
        • connectedClient: NetworkClient

        Returns void

Optional getGuiScreen

getGuiScreen: () => IWindow

Called to get the UI.IWindow object for the current TileEntity. The window is then opened within TileEntity.container when the player clicks it


Don't use in multiplayer

Type declaration

Optional getScreenByName

getScreenByName: (screenName?: string) => Window | StandartWindow | StandardWindow | TabbedWindow

Called on client side, returns the window to open

Type declaration

Optional getScreenName

getScreenName: (player: number, coords: Vector) => string

Called on server side and returns UI name to open on click

Type declaration

    • (player: number, coords: Vector): string
    • Parameters

      • player: number
      • coords: Vector

      Returns string

Optional init

init: () => void

Called when a TileEntity is initialised in the world

Type declaration

    • (): void
    • Returns void


isLoaded: boolean

True if TileEntity is loaded in the world


liquidStorage: Storage

TileEntity's liquid storage


networkData: SyncedNetworkData

SyncedNetworkData object of the TileEntity


networkEntity: NetworkEntity

NetworkEntity object of the TileEntity

Optional projectileHit

projectileHit: (coords: ItemUseCoordinates, target: ProjectileHitTarget) => void

Occurs when a projectile entity hits the TileEntity. See Callback.ProjectileHitFunction for details

Type declaration

Optional redstone

redstone: (params: { onLoad: boolean; power: number; signal: number }) => void

Occurs when the TileEntity should handle redstone signal. See Callback.RedstoneSignalFunction for details

Type declaration

    • (params: { onLoad: boolean; power: number; signal: number }): void
    • Parameters

      • params: { onLoad: boolean; power: number; signal: number }
        • onLoad: boolean
        • power: number
        • signal: number

      Returns void


remove: boolean

True if TileEntity was destroyed

Optional requireMoreLiquid

requireMoreLiquid: (liquid: string, amount: number) => void

Called when more liquid is required

Type declaration

    • (liquid: string, amount: number): void
    • Parameters

      • liquid: string
      • amount: number

      Returns void


selfDestroy: () => void

Destroys the TileEntity prototype

Type declaration

    • (): void
    • Returns void


sendPacket: (name: string, data: object) => void

Sends the packet from server to all clients

Type declaration

    • (name: string, data: object): void
    • Parameters

      • name: string
      • data: object

      Returns void


sendResponse: (packetName: string, someData: object) => void

Sends packet to specified client. AVAILABLE ONLY IN SERVER EVENT FUNCTIONS!

Type declaration

    • (packetName: string, someData: object): void
    • Parameters

      • packetName: string
      • someData: object

      Returns void

Optional tick

tick: () => void

Called every tick and should be used for all the updates of the TileEntity

Type declaration

    • (): void
    • Returns void

Optional useNetworkItemContainer

useNetworkItemContainer: boolean

Use ItemContainer that supports multiplayer

Readonly x

x: number

X coord of the TileEntity in its dimension

Readonly y

y: number

Y coord of the TileEntity in its dimension

Readonly z

z: number

Z coord of the TileEntity in its dimension




  • destroyTileEntity(tileEntity: TileEntity): boolean


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


    • x: number
    • y: number
    • z: number
    • Optional region: BlockSource

    Returns boolean

    true if the TileEntity was destroyed successfully, false otherwise




  • 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(tileEntity: TileEntity): boolean
  • Checks whether the TileEntity is in the loaded chunk or not


    Returns boolean

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

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


Generated using TypeDoc