Interface TileEntityPrototype

Interface passed to TileEntity.registerPrototype function.

interface TileEntityPrototype {
    click?: ((id: number, count: number, data: number, coords: ItemUseCoordinates, player: number, extra: ItemExtraData) => boolean | void);
    client?: LocalTileEntityPrototype;
    containerEvents?: {
        [eventName: string]: ((container: ItemContainer, window:
            | Window
            | StandartWindow
            | StandardWindow
            | TabbedWindow
            | null, windowContent: WindowContent | null, eventData: any) => void);
    };
    created?: (() => void);
    defaultValues?: Scriptable;
    destroy?: ((fromDestroyBlock: boolean, isDropAllowed: boolean) => boolean | void);
    destroyBlock?: ((coords: ItemUseCoordinates, player: number) => void);
    events?: {
        [packetName: string]: ((packetData: any, packetExtra: any, connectedClient: NetworkClient) => void);
    };
    getGuiScreen?: (() => IWindow);
    getScreenByName?: ((screenName?: string) => IWindow);
    getScreenName?: ((player: number, coords: Vector) => string);
    init?: (() => void);
    load?: (() => void);
    onCheckerTick?: ((isInitialized: boolean, isLoaded: boolean, wasLoaded: boolean) => void);
    onConnectionPlayer?: ((client: NetworkClient) => void);
    onDisconnectionPlayer?: ((client: NetworkClient) => void);
    projectileHit?: ((coords: ItemUseCoordinates, target: ProjectileHitTarget) => void);
    redstone?: ((params: RedstoneSignalParams) => void);
    requireMoreLiquid?: ((liquid: string, amount: number) => void);
    tick?: (() => void);
    unload?: (() => void);
    useNetworkItemContainer?: boolean;
}

Hierarchy (view full)

Properties

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.

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.

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.

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.

load?: (() => void)

Called when the client copy is created.

2.0.2b29

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

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.

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

Called when more liquid is required.

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

useNetworkItemContainer?: boolean

Use ItemContainer that supports multiplayer.

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