Package net.fabricmc.fabric.api.networking.v1


package net.fabricmc.fabric.api.networking.v1
The Networking API, version 1.

There are three stages of Minecraft networking, all of which are supported in this API:

LOGIN
This is the initial stage, before the player logs into the world. If using a proxy server, the packets in this stage may be intercepted and discarded by the proxy. Most of the pre-1.20.2 uses of this event should be replaced with the CONFIGURATION stage. Related events are found at ServerLoginConnectionEvents, and related methods are found at ServerLoginNetworking.
CONFIGURATION
This is the stage after LOGIN. The player is authenticated, but still hasn't joined the world at this point. Servers can use this phase to send configurations or verify client's mod versions. Note that some server mods allow players in the PLAY stage to re-enter this stage, for example when a player chooses a minigame server in a lobby. Related events are found at S2CConfigurationChannelEvents ServerConfigurationConnectionEvents, and related methods are found at ServerConfigurationNetworking.
PLAY
This is the stage after CONFIGURATION, where gameplay-related packets are sent and received. The player has joined the world and is playing the game. Related events are found at S2CPlayChannelEvents and ServerPlayConnectionEvents, and related methods are found at ServerPlayNetworking.

In addition, this API includes helpers for registering custom packet payloads and player lookups.