Network
Index
Functions
addClientPacket
Event that is called when a client receives a packet with given name.
Type parameters
- T: object
Parameters
name: string
name of the packet
func: (packetData: T) => void
Returns void
addServerPacket
Event that is called when server receives a packet with the specified name from client.
Type parameters
- T: object
Parameters
name: string
name of the packet
func: (client: NetworkClient, data: T) => void
Returns void
getClientForPlayer
Parameters
player: number
Returns NetworkClient
Client object for player by player's entity ID.
getConnectedClients
Returns native.Array<NetworkClient>
Array containing connected clients.
getConnectedPlayers
Returns native.Array<number>
Array containing connected players UIDs.
inRemoteWorld
Returns boolean
true
if player connected to remote world.
localToServerId
Converts item or block ID from local to server value.
Parameters
id: string | number
Returns number
sendServerMessage
Sends message to all players.
Parameters
message: string
text of the message
Returns void
sendToAllClients
Sends packet object with specified name to all clients.
Parameters
name: string
packetData: object
Returns void
sendToServer
Sends packet object with the specified name from client to server.
Parameters
name: string
packetData: object
Returns void
serverToLocalId
Converts item or block ID from server to local value.
Parameters
id: string | number
Returns number
Working with client and server packets in multiplayer and also determine stuff.