TileEntity
Index
Interfaces
Variables
Functions
Interfaces
LocalTileEntityPrototype
Interface passed to TileEntity.registerPrototype function
as client
property.
optionalcontainerEvents
Events of the container's client copy.
Type declaration
[eventName string]: (container: ItemContainer, window: UI.Window | UI.StandartWindow | UI.StandardWindow | UI.TabbedWindow | null, windowContent: UI.WindowContent | null, eventData: any) => void
Example of the client container event function.
optionalevents
Events that receive packets on the client side.
Type declaration
[packetName string]: (packetData: any, packetExtra: any) => void
Example of the client packet event function.
optionalload
Called when the client copy is created.
Type declaration
Returns void
optionaltick
Called every tick on client thread; you cannot set tick later if there is no function at all.
Type declaration
Returns void
optionalunload
Called on destroying the client copy.
Type declaration
Returns void
TileEntityPrototype
Interface passed to TileEntity.registerPrototype function.
optionalclick
Called when player uses some item on a TileEntity.
Type declaration
Parameters
id: number
count: number
data: number
coords: ItemUseCoordinates
player: number
extra: ItemExtraData
Returns boolean | void
optionalclient
Client tile entity prototype copy.
optionalcontainerEvents
Events of the container on the server side.
Type declaration
[eventName string]: (container: ItemContainer, window: UI.Window | UI.StandartWindow | UI.StandardWindow | UI.TabbedWindow | null, windowContent: UI.WindowContent | null, eventData: any) => void
Example of the server container event function.
optionalcreated
optionaldefaultValues
Default data values, will be initially added to TileEntity.data field.
optionaldestroy
Occurs when the TileEntity is being destroyed.
Type declaration
Parameters
fromDestroyBlock: boolean
isDropAllowed: boolean
Returns boolean | void
optionaldestroyBlock
Occurs when a block of the TileEntity is being destroyed. See Callback.DestroyBlockFunction for details.
Type declaration
Parameters
coords: ItemUseCoordinates
player: number
Returns void
optionalevents
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
Called to get the UI.IWindow object for the current TileEntity. The window is then opened within TileEntity.container when the player clicks it.
Type declaration
Returns IWindow
optionalgetScreenByName
Called on client side, returns the window to open.
Type declaration
Parameters
optionalscreenName: string
optionalcontainer: ItemContainer
Returns IWindow
optionalgetScreenName
Called on server side and returns UI name to open on click.
Type declaration
Parameters
player: number
coords: Vector
Returns string
optionalinit
optionalload
Called when the client copy is created.
Type declaration
Returns void
optionalonCheckerTick
Called before every tile ticking to remove them.
Type declaration
Parameters
isInitialized: boolean
isLoaded: boolean
wasLoaded: boolean
Returns void
optionalonConnectionPlayer
Called when player connects to server.
Type declaration
Parameters
client: NetworkClient
connected player client
Returns void
optionalonDisconnectionPlayer
Called when player disconnects from server.
Type declaration
Parameters
client: NetworkClient
disconnected player client
Returns void
optionalprojectileHit
Occurs when a projectile entity hits the TileEntity. See Callback.ProjectileHitFunction for details.
Type declaration
Parameters
coords: ItemUseCoordinates
target: ProjectileHitTarget
Returns void
optionalredstone
Occurs when the TileEntity should handle redstone signal. See Callback.RedstoneSignalFunction for details.
Type declaration
Parameters
params: RedstoneSignalParams
Returns void
optionalrequireMoreLiquid
Called when more liquid is required.
Type declaration
Parameters
liquid: string
amount: number
Returns void
optionaltick
Called every tick and should be used for all the updates of the TileEntity.
Type declaration
Returns void
optionalunload
Called on destroying the client copy.
Type declaration
Returns void
optionaluseNetworkItemContainer
Use ItemContainer that supports multiplayer.
Variables
consttileEntityCacheMapinternal
consttileEntityListinternal
consttileEntityPrototypesinternal
Type declaration
[blockId number]: TileEntityPrototype
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
x: number
y: number
z: number
optionalregion: BlockSource
Returns Nullable<TileEntity>
Tile if one was created,
null
otherwise.
addUpdatableAsTileEntity
Adding attached to block updatable, which is working like ordinary tile entity, except the fact that it registers in any case.
Parameters
updatable: Updatable
Returns void
checkTileEntityForIndex
- internal
Parameters
index: number
Returns void
createTileEntityForPrototype
- internal
Parameters
prototype: TileEntityPrototype
optionaladdToUpdate: boolean
Returns TileEntity
destroyTileEntity
Destroys TileEntity, dropping it's container.
Parameters
tileEntity: TileEntity
Returns boolean
true
if the it was destroyed successfully,false
otherwise.
destroyTileEntityAtCoords
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
Parameters
blockID: number
Returns TileEntityPrototype
Prototype by it's numeric block ID.
getTileEntity
Parameters
x: number
y: number
z: number
optionalregion: BlockSource
Returns Nullable<TileEntity>
A TileEntity on the specified coordinates or
null
if the block on the coordinates is not it.
isTileEntityBlock
Parameters
blockID: number
numeric block ID
Returns boolean
true
if the specified numeric block ID is a TileEntity block ID,false
otherwise.
isTileEntityLoaded
Checks whether the TileEntity is in the loaded chunk or not.
Parameters
tileEntity: TileEntity
to be verified
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
- internal
Clears active game tile list, maintaining updatable states.
Returns void
TileEntity is a powerful mechanism that allows for creation of interactive blocks such as chests, furnaces, etc.