Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Network

New module to work with client and server packets in multiplayer.

Index

Functions

addClientPacket

  • addClientPacket(name: string, func: (packetData: any) => void): void
  • Event that is called when a client receives a packet with given name

    Parameters

    • name: string

      name of the packet

    • func: (packetData: any) => void
        • (packetData: any): void
        • Parameters

          • packetData: any

          Returns void

    Returns void

addServerPacket

  • addServerPacket(name: string, func: (client: any, data: any) => void): void
  • Event that is called when server receives a packet with the specified name from client

    Parameters

    • name: string

      name of the packet

    • func: (client: any, data: any) => void
        • (client: any, data: any): void
        • Parameters

          • client: any
          • data: any

          Returns void

    Returns void

getClientForPlayer

  • getClientForPlayer(player: number): Client

localToServerId

  • localToServerId(id: string | number): number
  • Converts item or block id from local to server value

    Parameters

    • id: string | number

    Returns number

sendToAllClients

  • sendToAllClients(name: string, packetData: any): void
  • Sends packet object with specified name to all clients

    Parameters

    • name: string
    • packetData: any

    Returns void

sendToServer

  • sendToServer(name: string, packetData: any): void
  • Sends packet object with the specified name from client to server

    Parameters

    • name: string
    • packetData: any

    Returns void

serverToLocalId

  • serverToLocalId(id: string | number): number
  • Converts item or block id from server to local value

    Parameters

    • id: string | number

    Returns number

Generated using TypeDoc