Class ClientLoginNetworking
java.lang.Object
net.fabricmc.fabric.api.client.networking.v1.ClientLoginNetworking
Offers access to login stage client-side networking functionalities.
 
The Minecraft login protocol only allows the client to respond to a server's request, but not initiate one of its own.
- See Also:
- 
Nested Class SummaryNested Classes
- 
Method SummaryModifier and TypeMethodDescriptionstatic Set<Identifier> Gets all query request channel names which global receivers are registered for.static booleanregisterGlobalReceiver(Identifier channelName, ClientLoginNetworking.LoginQueryRequestHandler queryHandler) Registers a handler to a query request channel.static booleanregisterReceiver(Identifier channelName, ClientLoginNetworking.LoginQueryRequestHandler queryHandler) Registers a handler to a query request channel.unregisterGlobalReceiver(Identifier channelName) Removes the handler of a query request channel.static @Nullable ClientLoginNetworking.LoginQueryRequestHandlerunregisterReceiver(Identifier channelName) Removes the handler of a query request channel.
- 
Method Details- 
registerGlobalReceiverpublic static boolean registerGlobalReceiver(Identifier channelName, ClientLoginNetworking.LoginQueryRequestHandler queryHandler) Registers a handler to a query request channel. A global receiver is registered to all connections, in the present and future.If a handler is already registered to the channel, this method will returnfalse, and no change will be made. UseunregisterGlobalReceiver(Identifier)to unregister the existing handler.- Parameters:
- channelName- the id of the channel
- queryHandler- the handler
- Returns:
- false if a handler is already registered to the channel
- See Also:
 
- 
unregisterGlobalReceiver@Nullable public static ClientLoginNetworking.LoginQueryRequestHandler unregisterGlobalReceiver(Identifier channelName) Removes the handler of a query request channel. A global receiver is registered to all connections, in the present and future.The channelis guaranteed not to have a handler after this call.- Parameters:
- channelName- the id of the channel
- Returns:
- the previous handler, or nullif no handler was bound to the channel
- See Also:
 
- 
getGlobalReceiversGets all query request channel names which global receivers are registered for. A global receiver is registered to all connections, in the present and future.- Returns:
- all channel names which global receivers are registered for.
 
- 
registerReceiverpublic static boolean registerReceiver(Identifier channelName, ClientLoginNetworking.LoginQueryRequestHandler queryHandler) throws IllegalStateException Registers a handler to a query request channel.If a handler is already registered to the channelName, this method will returnfalse, and no change will be made. UseunregisterReceiver(Identifier)to unregister the existing handler.- Parameters:
- channelName- the id of the channel
- queryHandler- the handler
- Returns:
- false if a handler is already registered to the channel name
- Throws:
- IllegalStateException- if the client is not logging in
 
- 
unregisterReceiver@Nullable public static @Nullable ClientLoginNetworking.LoginQueryRequestHandler unregisterReceiver(Identifier channelName) throws IllegalStateException Removes the handler of a query request channel.The channelNameis guaranteed not to have a handler after this call.- Parameters:
- channelName- the id of the channel
- Returns:
- the previous handler, or nullif no handler was bound to the channel name
- Throws:
- IllegalStateException- if the client is not logging in
 
 
-