Skip to main content

EnergyTile

Interface passed to TileEntity.registerPrototype function.

Hierarchy

Implemented by

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

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

    Example of the server container event function.

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.

energyNode

energyNode: EnergyTileNode

optionalenergyTypes

energyTypes?: {}

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.

    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.

    That feature is obsolete

    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: ItemUseCoordinates) => string

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


    Type declaration

    init

    init: () => void

    Called when a TileEntity is initialized in the world.


    Type declaration

      • (): void
      • Returns void

    optionalisEnergyTile

    isEnergyTile?: boolean

    isLoaded

    isLoaded: boolean

    true if tile is loaded in the world.

    liquidStorage

    liquidStorage: Storage

    Tile liquid storage.

    load
    since: 2.0.2b29

    load: () => void

    Called when the client copy is created.


    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
    since: 2.2.1b92

    networkEntityTypeName: string

    noupdate

    noupdate: boolean

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

    onCheckerTick
    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

    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.

    More about capabilities

    Available 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
    since: 2.0.2b29

    unload: () => void

    Called on destroying the client copy.


    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.

    Methods

    canExtractEnergy

    • canExtractEnergy(side: number, type: string): boolean
    • Parameters

      • side: number
      • type: string

      Returns boolean

    canReceiveEnergy

    • canReceiveEnergy(side: number, type: string): boolean
    • Parameters

      • side: number
      • type: string

      Returns boolean

    energyReceive

    • energyReceive(type: string, amount: number, voltage: number): number
    • Parameters

      • type: string
      • amount: number
      • voltage: number

      Returns number

    energyTick

    isConductor

    • isConductor(type: string): boolean
    • Parameters

      • type: string

      Returns boolean