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

TileEntity

Interface passed to TileEntity.registerPrototype function.

Hierarchy

Index

Properties

readonlyblockID

blockID: number

Block ID of tile.

blockSource

blockSource: BlockSource

BlockSource object to manipulate tile position in world.

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.

@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.

container

Tile item container.

optionalcontainerEvents

containerEvents?: {}

Events of the container on the server side.


Type declaration

created

created: () => void

Called when a TileEntity is created.


Type declaration

    • (): void
    • Returns void

data

Tile data values object.

defaultValues

defaultValues: Scriptable

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

destroy

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

destroyBlock

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

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


Type declaration

readonlydimension

dimension: number

Dimension where the tile is located.

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.

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

Client-side method only.


Type declaration

getScreenByName

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

Called on client side, returns the window to open.


Type declaration

optionalgetScreenName

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

      Returns string

init

init: () => void

Called when a TileEntity is initialized in the world.


Type declaration

    • (): void
    • Returns void

isLoaded

isLoaded: boolean

true if tile is loaded in the world.

liquidStorage

liquidStorage: Storage

Tile liquid storage.

load

load: () => void

Called when the client copy is created.

@since

2.0.2b29


Type declaration

    • (): void
    • Returns void

readonlynetworkData

networkData: SyncedNetworkData

SyncedNetworkData object of the tile.

readonlynetworkEntity

networkEntity: NetworkEntity

Instance of TileEntity.networkEntityType for the tile.

readonlynetworkEntityType

networkEntityType: NetworkEntityType

NetworkEntityType object of the tile.

readonlynetworkEntityTypeName

networkEntityTypeName: string
@since

2.2.1b92

noupdate

noupdate: boolean

true if tile cannot tick, update functions will not work in that case.

onCheckerTick

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

Called before every tile ticking to remove them.

@since

2.0.2b29


Type declaration

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

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

      Returns void

optionalonConnectionPlayer

onConnectionPlayer?: (client: NetworkClient) => void

Called when player connects to server.

@since

2.3.1b116-3


Type declaration

optionalonDisconnectionPlayer

onDisconnectionPlayer?: (client: NetworkClient) => void

Called when player disconnects from server.

@since

2.3.1b116-3


Type declaration

onItemClick

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

Emulates click on this tile, calling TileEntity.TileEntityPrototype.click or opening screen otherwise if window has present.

@returns

true if clicked or screen opened success, false otherwise


Type declaration

projectileHit

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

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


Type declaration

redstone

redstone: (params: RedstoneSignalParams) => void

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


Type declaration

remove

remove: boolean

true if tile has been destroyed.

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 tile 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.

@remarks

Availabled only in server-side methods!


Type declaration

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

      • packetName: string
      • someData: object

      Returns void

optionaltick

tick?: () => void

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


Type declaration

    • (): void
    • Returns void

unload

unload: () => void

Called on destroying the client copy.

@since

2.0.2b29


Type declaration

    • (): void
    • Returns void

update

update: () => void

Called every tick to TileEntity.TileEntityPrototype.tick each tile if TileEntity.noupdate not active.


Type declaration

    • (): void
    • Returns void

optionaluseNetworkItemContainer

useNetworkItemContainer?: boolean

Use ItemContainer that supports multiplayer.

readonlyx

x: number

X coord of the tile in it's dimension.

readonlyy

y: number

Y coord of the tile in it's dimension.

readonlyz

z: number

Z coord of the tile in it's dimension.