Interface IServerNetworkAPI
- Namespace
- Vintagestory.API.Server
- Assembly
- VintagestoryAPI.dll
API Features to set up a network channel for custom server<->client data exchange. Server side.
public interface IServerNetworkAPI : INetworkAPI
- Extension Methods
Methods
BroadcastArbitraryPacket(byte[], params IServerPlayer[])
Sends a packet data to everyone except given players.This let's you mess with the raw network communication if you know the protocol. Use with caution! For normal network communication you probably want to register your own network channel.
void BroadcastArbitraryPacket(byte[] data, params IServerPlayer[] exceptPlayers)
Parameters
data
byte[]exceptPlayers
IServerPlayer[]
BroadcastBlockEntityPacket(BlockPos, int, byte[])
Broadcasts a blockentity packet to all connected players. For quick an easy network communication without setting up a channel first.
void BroadcastBlockEntityPacket(BlockPos pos, int packetId, byte[] data = null)
Parameters
BroadcastBlockEntityPacket(BlockPos, int, byte[], params IServerPlayer[])
void BroadcastBlockEntityPacket(BlockPos pos, int packetId, byte[] data = null, params IServerPlayer[] skipPlayers)
Parameters
pos
BlockPospacketId
intdata
byte[]skipPlayers
IServerPlayer[]
BroadcastBlockEntityPacket<T>(BlockPos, int, T)
Broadcasts a blockentity packet to all connected players. For quick an easy network communication without setting up a channel first. Uses ProtoBuf.net to serialize the data.
void BroadcastBlockEntityPacket<T>(BlockPos pos, int packetId, T data = default)
Parameters
Type Parameters
T
BroadcastEntityPacket(long, int, byte[])
Sends a entity packet to all players in range. For quick an easy entity network communication without setting up a channel first.
void BroadcastEntityPacket(long entityid, int packetId, byte[] data = null)
Parameters
GetChannel(string)
Returns a previoulsy registered channeled, null otherwise
IServerNetworkChannel GetChannel(string channelName)
Parameters
channelName
string
Returns
GetUdpChannel(string)
Returns a previoulsy registered channeled, null otherwise
IServerNetworkChannel GetUdpChannel(string channelName)
Parameters
channelName
string
Returns
RegisterChannel(string)
Supplies you with your very own and personal network channel that you can use to send packets across the network. Use the same channelName on the client and server to have them link up.
IServerNetworkChannel RegisterChannel(string channelName)
Parameters
channelName
stringUnique channel identifier
Returns
RegisterUdpChannel(string)
Supplies you with your very own and personal network channel that you can use to send packets across the network. Use the same channelName on the client and server to have them link up.
IServerNetworkChannel RegisterUdpChannel(string channelName)
Parameters
channelName
stringUnique channel identifier
Returns
SendArbitraryPacket(byte[], params IServerPlayer[])
Sends a packet data to given players. This let's you mess with the raw network communication if you know the protocol. Use with caution! For normal network communication you probably want to register your own network channel.
void SendArbitraryPacket(byte[] data, params IServerPlayer[] players)
Parameters
data
byte[]players
IServerPlayer[]
SendBlockEntityPacket(IServerPlayer, BlockPos, int, byte[])
Sends a blockentity packet to the given player. For quick an easy network communication without setting up a channel first.
void SendBlockEntityPacket(IServerPlayer player, BlockPos pos, int packetId, byte[] data = null)
Parameters
player
IServerPlayerpos
BlockPospacketId
intdata
byte[]
SendBlockEntityPacket<T>(IServerPlayer, BlockPos, int, T)
Sends a blockentity packet to the given player. For quick an easy network communication without setting up a channel first. Uses ProtoBuf.net to serialize the data.
void SendBlockEntityPacket<T>(IServerPlayer player, BlockPos pos, int packetId, T data = default)
Parameters
player
IServerPlayerpos
BlockPospacketId
intdata
T
Type Parameters
T
SendEntityPacket(IServerPlayer, long, int, byte[])
Sends a entity packet to the given player and entity. For quick an easy entity network communication without setting up a channel first.
void SendEntityPacket(IServerPlayer player, long entityid, int packetId, byte[] data = null)
Parameters
player
IServerPlayerentityid
longpacketId
intdata
byte[]