Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace TileEntity

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

Indexable

[key: string]: any

Any other user-defined methods and properties

Index

Properties

blockSource

blockSource: BlockSource

BlockSource object to manipulate TileEntity's position in world

Optional click

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

Called when player uses some item on a TileEntity

returns

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

    • (id: number, count: number, data: number, coords: ItemUseCoordinates, player: number): boolean | void
    • Parameters

      Returns boolean | void

Optional client

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

Client TileEntity prototype copy

Type declaration

  • 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

container

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

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

returns

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: (block: Tile, player: number) => void

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

Type declaration

    • (block: Tile, player: number): void
    • Parameters

      • block: Tile
      • player: number

      Returns void

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: Client) => void

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

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

        • packetData: any
        • packetExtra: any
        • connectedClient: Client

        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

deprecated

Don't use in multiplayer

Type declaration

Optional getScreenByName

getScreenByName: (screenName?: string) => Window | StandartWindow | 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

liquidStorage

liquidStorage: any

TileEntity's liquid storage

networkData

networkData: SyncedNetworkData

SyncedNetworkData object of the TileEntity

networkEntity

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

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

selfDestroy: () => void

Destroys the TileEntity prototype

Type declaration

    • (): void
    • Returns void

sendPacket

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

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

Functions

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

    Parameters

    Returns boolean

    true if the chunk with TileEntity and some of the surrounging 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

registerPrototype

Generated using TypeDoc