Interface TileEntity

Interface passed to TileEntity.registerPrototype function.

interface TileEntity {
    blockID: number;
    blockSource: BlockSource;
    click: ((id: number, count: number, data: number, coords: ItemUseCoordinates, player: number, extra: ItemExtraData) => boolean | void);
    client?: LocalTileEntityPrototype;
    container: Container | ItemContainer;
    containerEvents?: {
        [eventName: string]: ((container: ItemContainer, window:
            | Window
            | StandartWindow
            | StandardWindow
            | TabbedWindow
            | null, windowContent: WindowContent | null, eventData: any) => void);
    };
    created: (() => void);
    data: Scriptable;
    defaultValues: Scriptable;
    destroy: ((fromDestroyBlock: boolean, isDropAllowed: boolean) => boolean | void);
    destroyBlock: ((coords: ItemUseCoordinates, player: number) => void);
    dimension: number;
    events?: {
        [packetName: string]: ((packetData: any, packetExtra: any, connectedClient: NetworkClient) => void);
    };
    getGuiScreen: (() => IWindow);
    getScreenByName: ((screenName?: string) => IWindow);
    getScreenName?: ((player: number, coords: Vector) => string);
    init: (() => void);
    isLoaded: boolean;
    liquidStorage: Storage;
    load: (() => void);
    networkData: SyncedNetworkData;
    networkEntity: NetworkEntity;
    networkEntityType: NetworkEntityType;
    networkEntityTypeName: string;
    noupdate: boolean;
    onCheckerTick: ((isInitialized: boolean, isLoaded: boolean, wasLoaded: boolean) => void);
    onConnectionPlayer?: ((client: NetworkClient) => void);
    onDisconnectionPlayer?: ((client: NetworkClient) => void);
    onItemClick: ((id: number, count: number, data: number, coords: ItemUseCoordinates, player: number, extra: ItemExtraData) => boolean | void);
    projectileHit: ((coords: ItemUseCoordinates, target: ProjectileHitTarget) => void);
    redstone: ((params: RedstoneSignalParams) => void);
    remove: boolean;
    requireMoreLiquid: ((liquid: string, amount: number) => void);
    selfDestroy: (() => void);
    sendPacket: ((name: string, data: object) => void);
    sendResponse: ((packetName: string, someData: object) => void);
    tick?: (() => void);
    unload: (() => void);
    update: (() => void);
    useNetworkItemContainer?: boolean;
    x: number;
    y: number;
    z: number;
}

Hierarchy (view full)

Properties

blockID: number

Block ID of tile.

blockSource: BlockSource

BlockSource object to manipulate tile position in world.

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

Called when player uses some item on a TileEntity.

Type declaration

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

      Returns boolean | void

      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.

Client tile entity prototype copy.

Tile item container.

containerEvents?: {
    [eventName: string]: ((container: ItemContainer, window:
        | Window
        | StandartWindow
        | StandardWindow
        | TabbedWindow
        | null, windowContent: WindowContent | null, eventData: any) => void);
}

Events of the container on the server side.

Type declaration

created: (() => void)

Called when a TileEntity is created.

Tile data values object.

defaultValues: Scriptable

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

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

Occurs when the TileEntity is being destroyed.

Type declaration

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

      • fromDestroyBlock: boolean
      • isDropAllowed: boolean

      Returns boolean | void

      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)

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

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

dimension: number

Dimension where the tile is located.

events?: {
    [packetName: string]: ((packetData: any, packetExtra: any, connectedClient: NetworkClient) => void);
}

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.

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

        Returns void

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.

Client-side method only.

getScreenByName: ((screenName?: string) => IWindow)

Called on client side, returns the window to open.

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

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

init: (() => void)

Called when a TileEntity is initialized in the world.

isLoaded: boolean

true if tile is loaded in the world.

liquidStorage: Storage

Tile liquid storage.

load: (() => void)

Called when the client copy is created.

2.0.2b29

networkData: SyncedNetworkData

SyncedNetworkData object of the tile.

networkEntity: NetworkEntity

Instance of TileEntity.networkEntityType for the tile.

networkEntityType: NetworkEntityType

NetworkEntityType object of the tile.

networkEntityTypeName: string

2.2.1b92

noupdate: boolean

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

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

Called before every tile ticking to remove them.

2.0.2b29

onConnectionPlayer?: ((client: NetworkClient) => void)

Called when player connects to server.

Type declaration

    • (client): void
    • Parameters

      Returns void

2.3.1b116-3

onDisconnectionPlayer?: ((client: NetworkClient) => void)

Called when player disconnects from server.

Type declaration

    • (client): void
    • Parameters

      Returns void

2.3.1b116-3

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.

Type declaration

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

      Returns boolean | void

      true if clicked or screen opened success, false otherwise

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

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

redstone: ((params: RedstoneSignalParams) => void)

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

remove: boolean

true if tile has been destroyed.

requireMoreLiquid: ((liquid: string, amount: number) => void)

Called when more liquid is required.

selfDestroy: (() => void)

Destroys the tile prototype.

sendPacket: ((name: string, data: object) => void)

Sends the packet from server to all clients.

sendResponse: ((packetName: string, someData: object) => void)

Sends packet to specified client.

Availabled only in server-side methods!

tick?: (() => void)

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

unload: (() => void)

Called on destroying the client copy.

2.0.2b29

update: (() => void)

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

useNetworkItemContainer?: boolean

Use ItemContainer that supports multiplayer.

x: number

X coord of the tile in it's dimension.

y: number

Y coord of the tile in it's dimension.

z: number

Z coord of the tile in it's dimension.

Copyright © 2024 Nernar. Copyright © 2020 #mineprogramming. Built with ❤ and TypeDoc.