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

TileEntity.TileEntityPrototype

Interface passed to TileEntity.registerPrototype function.

Hierarchy

Index

Properties

optionalclick

click?: (id: number, count: number, data: number, coords: ItemUseCoordinates, player: number, extra: ItemExtraData) => 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. Return true if you don't want the user interface to be opened.


Type declaration

optionalclient

Client tile entity prototype copy.

optionalcontainerEvents

containerEvents?: {}

Events of the container on the server side.


Type declaration

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

    Example of the server container event function.

optionalcreated

created?: () => void

Called when a TileEntity is created.


Type declaration

    • (): void
    • Returns void

optionaldefaultValues

defaultValues?: Scriptable

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

optionaldestroy

destroy?: (fromDestroyBlock: boolean, isDropAllowed: boolean) => boolean | void

Occurs when the TileEntity is being destroyed.

@returns

true to prevent it. 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

    • (fromDestroyBlock: boolean, isDropAllowed: boolean): boolean | void
    • Parameters

      • fromDestroyBlock: boolean
      • isDropAllowed: boolean

      Returns boolean | void

optionaldestroyBlock

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

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


Type declaration

optionalevents

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.

optionalgetGuiScreen

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.

That feature is obsolete

Client-side method only.


Type declaration

optionalgetScreenByName

getScreenByName?: (screenName?: string, container?: ItemContainer) => IWindow

Called on client side, returns the window to open.


Type declaration

optionalgetScreenName

getScreenName?: (player: number, coords: ItemUseCoordinates) => string

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


Type declaration

optionalinit

init?: () => void

Called when a TileEntity is initialized in the world.


Type declaration

    • (): void
    • Returns void

optionalload
since: 2.0.2b29

load?: () => void

Called when the client copy is created.


Type declaration

    • (): void
    • Returns void

optionalonCheckerTick
since: 2.0.2b29

onCheckerTick?: (isInitialized: boolean, isLoaded: boolean, wasLoaded: boolean) => void

Called before every tile ticking to remove them.


Type declaration

    • (isInitialized: boolean, isLoaded: boolean, wasLoaded: boolean): void
    • Parameters

      • isInitialized: boolean
      • isLoaded: boolean
      • wasLoaded: boolean

      Returns void

optionalonConnectionPlayer
since: 2.3.1b116-3

onConnectionPlayer?: (client: NetworkClient) => void

Called when player connects to server.


Type declaration

optionalonDisconnectionPlayer
since: 2.3.1b116-3

onDisconnectionPlayer?: (client: NetworkClient) => void

Called when player disconnects from server.


Type declaration

optionalprojectileHit

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

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


Type declaration

optionalredstone

redstone?: (params: RedstoneSignalParams) => void

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


Type declaration

optionalrequireMoreLiquid

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

optionaltick

tick?: () => void

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


Type declaration

    • (): void
    • Returns void

optionalunload
since: 2.0.2b29

unload?: () => void

Called on destroying the client copy.


Type declaration

    • (): void
    • Returns void

optionaluseNetworkItemContainer

useNetworkItemContainer?: boolean

Use ItemContainer that supports multiplayer.