Closed SpaceWalkerRS closed 1 year ago
We had some discussion before about whether the Networking API should send/receive data in NBT format. I decided against this for now and use the PacketByteBuf
in order to keep the implementation as "raw" as possible. This still leaves the option open for mods utilize NBT for their networking, but encourages serializing to/from the PacketByteBuf
directly, which is probably preferable if you're sending larger amounts of data.
looks good, seems to be lacking some documentation overall though, but it looks alright to me
Good point. I'll go ahead and write some before merging this in.
Adds a Networking module and an implementation for (13w41a)-(1.13-pre2), with the following features:
Networking API
Sending and receiving data is done through the
ClientPlayNetworking
andServerPlayNetworking
classes. Mods can register network listeners through theregisterListener
andregisterListenerAsync
methods, allowing them to receive data through specific channels. Sending data is done through thesend
methods.Upon login, the client will initiate a "handshake" with the server, in which it will let the server know which channels the client has listeners for. The server will then reciprocate by telling the client which channels the server has listeners for. This information is then used to close channels for which there are no listeners. This is to avoid packet and log spam when one side has a mod installed but the other does not.