User Tools

Site Tools


tutorial:networking

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:networking [2021/09/07 20:22] – Rename ModNetworkingConstants to TutorialNetworkingConstants to clarify that it is a tutorial class, not part of Minecraft or FAPI daomephstatutorial:networking [2022/01/28 06:28] – [How do I fix the crash?] fix type solidblock
Line 51: Line 51:
 [[Minecraft's Logical Sides|{{tutorial:sides.png?700}}]] [[Minecraft's Logical Sides|{{tutorial:sides.png?700}}]]
  
-The diagram above shows that the game client and dedicated server art separate systems bridged together using packets. This packet bridge does not only exist between a game client and dedicated server, but also between your client and another client connected over LAN. The packet bridge is also present even in singleplayer! This is because the game client will spin up a special integrated server instance to run the game on. The key difference between the three types of connections that are shown in the table below:+The diagram above shows that the game client and dedicated server are separate systems bridged together using packets. This packet bridge does not only exist between a game client and dedicated server, but also between your client and another client connected over LAN. The packet bridge is also present even in singleplayer! This is because the game client will spin up a special integrated server instance to run the game on. The key difference between the three types of connections that are shown in the table below:
  
 ^ Connection Type               ^ Access to game client       ^ ^ Connection Type               ^ Access to game client       ^
Line 105: Line 105:
  
 To receive a packet from a server on the game client, your mod needs to specify how it will handle the incoming packet. To receive a packet from a server on the game client, your mod needs to specify how it will handle the incoming packet.
-In your client entrypoint, you will register the receiver for your packet using ''PlayClientNetworking.registerGlobalReceiver(Identifier channelName, ChannelHandler channelHandler)''+In your client entrypoint, you will register the receiver for your packet using ''ClientPlayNetworking.registerGlobalReceiver(Identifier channelName, ChannelHandler channelHandler)''
  
 The ''Identifier'' should match the same Identifier you use to send the packet to the client. The ''ChannelHandler'' is the functional interface you will use to implement how the packet is handled. **Note the ''ChannelHandler'' should be the one that is a nested interface of ''ClientPlayNetworking''** The ''Identifier'' should match the same Identifier you use to send the packet to the client. The ''ChannelHandler'' is the functional interface you will use to implement how the packet is handled. **Note the ''ChannelHandler'' should be the one that is a nested interface of ''ClientPlayNetworking''**
tutorial/networking.txt · Last modified: 2024/06/10 11:45 by l1ttle