Class NetworkContext

java.lang.Object
net.minecraftforge.network.NetworkContext

public class NetworkContext extends Object
  • Field Details

  • Constructor Details

    • NetworkContext

      private NetworkContext(Connection connection)
  • Method Details

    • get

      public static NetworkContext get(Connection connection)
      Gets the associated NetworkContext from the connection, creating a new instance if necessary.
    • getType

      public ConnectionType getType()
    • getNetVersion

      public int getNetVersion()
    • getRemoteChannels

      public Set<ResourceLocation> getRemoteChannels()
    • getModList

      public Map<String,ModVersions.Info> getModList()
      A list of mods and their verisons reported by the other side of the connection. The remote side can and does lie about this, so not rely on it for any anti-cheat system.
    • enhanceHostName

      @Internal public static String enhanceHostName(String hostName)
      This is a hint that we are a modded client, This is sent in the first packet the client sends to the server. Unfortunately we do not have a modder facing value in this packet, so we have a long standing tradition of encoding it on the hostName field, which is a UTF string. Forge treats this string a null terminated list. With our value being anywhere in the list. Our identifier is currently FORGE, Optionally followed by a number indicating the network version. If the version is missing, we assume 0. TODO: Move out of the Intention packet and into a immediately sent Login custom payload? Which should arrive before we get to config stage?
    • processIntention

      @Internal public void processIntention(String hostName)
    • finishTask

      @Internal public void finishTask(ConfigurationTask.Type task)
    • getMismatchs

      @Internal public NetworkContext.NetworkMismatchData getMismatchs()
    • setConnectionType

      @Internal void setConnectionType(ConnectionType type)