Interface IClientNetworkAPI
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
API Features to set up a network channel for custom server<->client data exchange. Client side.
public interface IClientNetworkAPI : INetworkAPI
- Extension Methods
Methods
GetChannel(string)
Returns a previously registered channel, null otherwise
IClientNetworkChannel GetChannel(string channelName)
Parameters
channelName
string
Returns
GetChannelState(string)
Check in what state a channel currently is in
EnumChannelState GetChannelState(string channelName)
Parameters
channelName
string
Returns
GetUdpChannel(string)
Returns a previously registered channel, null otherwise
IClientNetworkChannel GetUdpChannel(string channelName)
Parameters
channelName
string
Returns
RegisterChannel(string)
Supplies you with your very own and personal network channel with which you can send packets to the server. Use the same channelName on the client and server to have them link up.
IClientNetworkChannel RegisterChannel(string channelName)
Parameters
channelName
stringUnique channel identifier
Returns
RegisterUdpChannel(string)
Supplies you with your very own and personal network channel with which you can send packets to the server. Use the same channelName on the client and server to have them link up.
IClientNetworkChannel RegisterUdpChannel(string channelName)
Parameters
channelName
stringUnique channel identifier
Returns
SendArbitraryPacket(byte[])
Sends given packet data to the server. This let's you mess with the raw network communication and fiddle with internal engine packets if you know the protocol. For normal network communication you probably want to register your own network channel.
void SendArbitraryPacket(byte[] data)
Parameters
data
byte[]
SendBlockEntityPacket(int, int, int, int, byte[])
Sends a blockentity interaction packet to the server. For quick an easy blockentity network communication without setting up a channel first.
[Obsolete("Not dimension aware, use BlockPos overload instead, otherwise thie BlockEntity will probably not work correctly in other dimensions")]
void SendBlockEntityPacket(int x, int y, int z, int packetId, byte[] data = null)
Parameters
SendBlockEntityPacket(int, int, int, object)
Sends a blockentity interaction packet to the server. For quick an easy blockentity network communication without setting up a channel first.
void SendBlockEntityPacket(int x, int y, int z, object internalPacket)
Parameters
SendBlockEntityPacket(BlockPos, int, byte[])
Sends a blockentity interaction packet to the server. For quick an easy blockentity network communication without setting up a channel first.
void SendBlockEntityPacket(BlockPos pos, int packetId, byte[] data = null)
Parameters
SendBlockEntityPacket<T>(BlockPos, int, T)
Sends a blockentity interaction packet to the server. For quick an easy blockentity network communication without setting up a channel first. Uses Protobuf.net to serialize your data
void SendBlockEntityPacket<T>(BlockPos pos, int packetId, T data = default)
Parameters
Type Parameters
T
SendEntityPacket(long, int, byte[])
Sends a entity interaction packet to the server. For quick an easy entity network communication without setting up a channel first.
void SendEntityPacket(long entityid, int packetId, byte[] data = null)
Parameters
SendEntityPacket(long, object)
Sends a entity interaction packet to the server. For quick an easy entity network communication without setting up a channel first.
void SendEntityPacket(long entityid, object internalPacket)
Parameters
SendEntityPacketWithOffset(long, int, object)
Sends a entity interaction packet to the server. For quick an easy entity network communication without setting up a channel first.
void SendEntityPacketWithOffset(long entityid, int packetIdOffset, object internalPacket)
Parameters
SendHandInteraction(int, BlockSelection, EntitySelection, EnumHandInteract, int, bool, EnumItemUseCancelReason)
Sends the current hand interaction.
void SendHandInteraction(int mouseButton, BlockSelection blockSelection, EntitySelection entitySelection, EnumHandInteract beforeUseType, int state, bool firstEvent, EnumItemUseCancelReason cancelReason)
Parameters
mouseButton
intthe current mouse button press
blockSelection
BlockSelectionthe currently selected Block (if there is one)
entitySelection
EntitySelectionthe currently selected Entity (if there is one)
beforeUseType
EnumHandInteractstate
intThe state of the hand.
firstEvent
boolIs it the first of this events for this block? (by default the client calls the interaction every second while the player holds down the right mouse button)
cancelReason
EnumItemUseCancelReasonThe reason we cancelled the use of an item (if there is one)
SendMountPacket(Entity)
Sends a mount position via UDP to the server
void SendMountPacket(Entity mount)
Parameters
mount
Entity
SendPacketClient(object)
Sends given packet to server. For use with inventory supplied network packets only, since the packet format is not exposed to the api
void SendPacketClient(object packetClient)
Parameters
packetClient
objectThe network packet to send.
SendPlayerEntityPacket(EntityPlayer)
Sends the players entity position via UDP to the server
void SendPlayerEntityPacket(EntityPlayer player)
Parameters
player
EntityPlayer
SendPlayerNowReady()
If any mod denies the client event IsPlayerReady, then it has to call this method once to indicate that the player is now ready to play (which switches the server side client state from Connected to Playing)
void SendPlayerNowReady()