Class ServerStatusPing

java.lang.Object
net.minecraftforge.network.ServerStatusPing

public class ServerStatusPing extends Object
Represents additional data sent by FML when a server is pinged. Previous versions used the following format:

 {
     "fmlNetworkVersion" : FMLNETVERSION,
     "channels": [
          {
              "res": "fml:handshake",
              "version": "1.2.3.4",
              "required": true
          }
     ],
     "mods": [
          {
              "modid": "modid",
              "modmarker": "{@literal <somestring>}"
          }
     ]
 }
 

Due to size of the ping packet (32767 UTF-16 code points of JSON data) this could exceed this limit and cause issues. To work around this, a truncation mechanism was introduced, to heuristically truncate the size of the data, at the expense of making the compatibility info on the server screen inaccurate.

Modern versions will send binary data, which is encoded in a custom format optimized for UTF-16 code point count. See ServerStatusPing.Serializer.encodeOptimized(ByteBuf) and ServerStatusPing.Serializer.decodeOptimized(String). Essentially 15 bits of binary data are encoded into every UTF-16 code point. The resulting string is then stored in the "d" property of the resulting JSON.

For the format of the binary data see ServerStatusPing.Serializer.serialize(ServerStatusPing).

The "channels" and "mods" properties are retained for backwards compatibility, but left empty. A client that cannot read the old format would not be able to connect anyways, but the properties must exist to not cause exceptions.


 {
     "fmlNetworkVersion": FMLNETVERSION,
     "channels": [],
     "mods": [],
     "d": "&lt;binary data&gt;"
 }
 
  • Field Details

    • LOGGER

      private static final org.apache.logging.log4j.Logger LOGGER
    • channels

      private final transient Map<ResourceLocation,org.apache.commons.lang3.tuple.Pair<String,Boolean>> channels
    • mods

      private final transient Map<String,String> mods
    • fmlNetworkVer

      private final transient int fmlNetworkVer
    • truncated

      private final transient boolean truncated
  • Constructor Details

    • ServerStatusPing

      public ServerStatusPing()
    • ServerStatusPing

      private ServerStatusPing(Map<ResourceLocation,org.apache.commons.lang3.tuple.Pair<String,Boolean>> deserialized, Map<String,String> modMarkers, int fmlNetVer, boolean truncated)
  • Method Details