Skip to content
This repository has been archived by the owner on May 26, 2018. It is now read-only.

Network

cpw edited this page Dec 7, 2013 · 1 revision

A quick overview of the network changes in 1.7+

  1. NetworkMod is gone. All mods are automatically network capable.
  2. VersionCheckHandler is now the more generic NetworkCheckHandler. Use this if you want to detect something you don't like about the client or server (due to mod sets). Expect an empty set if/when vanilla client/server support is added.
  3. All network is through netty now. This mirrors the change in vanilla itself - the entire networking stack was replaced wholesale with one derived from Netty.

An overview of the new network system. FML no longer auto-allocates an old packet 250 channel based on networkmod information. Instead, mods request a "communication channel" through NetworkRegistry.newChannel. This layers a pair of netty EmbeddedChannel on top of the "new" 250 (now called 3f/17) packet system. There are TWO channels: one for "client side", and one for "server side". You get back a map containing the two channels. You can add whatever pipeline stuffs you want to these channels - FML provides one common one : the discriminator handler which reads a byte and constructs a specific packet based off that byte (subclass to implement it). Other ideas are to inline something like zlib compression - if you're slinging around lots of text on your network channel, zlib will really help reduce the size of the packets and it's very cheap CPU wise.

If you want to do it "old school", then you can probably just put a direct channel handler for FMLProxyPacket, and use that.

More to come..

Clone this wiki locally