Record Class ConnectionData.ModMismatchData

java.lang.Object
java.lang.Record
net.minecraftforge.network.ConnectionData.ModMismatchData
记录组件:
mismatchedModData - The data of the mismatched or missing mods/channels, consisting of the mod or channel id and the version of the respective mod. If the mod version is absent, the entry is assumed to be missing on either side. If it is present, the entry gets treated as a mismatch.
presentModData - The data of the channels/mods from the side the mismatch data doesn't originate from, consisting of the mod or channel id and the name and version of the respective mod. This data is useful for a proper comparison against the mismatched channel data. The data is stored like this: [id -> [modName, modVersion]]
mismatchedDataFromServer - Whether the mismatched data originates from the server. Note, that the mismatched data origin does not tell us if the actual mismatch check happened on the client or the server.
封闭类:
ConnectionData

public static record ConnectionData.ModMismatchData(Map<ResourceLocation,String> mismatchedModData, Map<ResourceLocation,org.apache.commons.lang3.tuple.Pair<String,String>> presentModData, boolean mismatchedDataFromServer) extends Record
A class for holding the mod mismatch data of a failed handshake. Contains a list of mismatched channels, the channels present on the side the handshake failed on, the mods with mismatching registries (if available) and the information of whether the mismatching data's origin is the server.
  • 字段详细资料

  • 构造器详细资料

  • 方法详细资料

    • channel

      public static ConnectionData.ModMismatchData channel(Map<ResourceLocation,String> mismatchedChannels, ConnectionData connectionData, boolean mismatchedDataFromServer)
      Creates a ModMismatchData instance from given channel mismatch data, which is processed side-aware depending on the value of mismatchedDataFromServer
      参数:
      mismatchedChannels - The list of channels that were listed as mismatches, either because they are missing on one side or because their versions mismatched
      connectionData - The connection data instance responsible for collecting the server mod data.
      mismatchedDataFromServer - Whether the mismatched data originates from the server.
    • registry

      public static ConnectionData.ModMismatchData registry(com.google.common.collect.Multimap<ResourceLocation,ResourceLocation> mismatchedRegistryData, ConnectionData connectionData)
      Creates a ModMismatchData instance from given mismatched registry entries. In this case, the mismatched data is always treated as originating from the client because registry entries missing on the server never cause the handshake to fail.
      参数:
      mismatchedRegistryData - The list of mismatched registries and the associated mismatched registry entries. The data is stored like this: "registryNamespace:registryPath" -> "entryNamespace:entryPath"
      connectionData - The connection data instance responsible for collecting the server mod data.
    • containsMismatches

      public boolean containsMismatches()
      返回:
      true if this ModMismatchData instance contains channel or registry mismatches
    • enhanceWithModVersion

      private static Map<ResourceLocation,String> enhanceWithModVersion(Map<ResourceLocation,String> mismatchedChannels, ConnectionData connectionData, boolean mismatchedDataFromServer)
      Enhances a map of mismatched channels with the corresponding mod version.
      参数:
      mismatchedChannels - The original mismatched channel list, containing the id and version of the mismatched channel.
      connectionData - The connection data instance responsible for collecting the server mod data.
      mismatchedDataFromServer - Whether the mismatched data originates from the server. The given mismatched channel list gets processed side-aware depending on the value of this parameter.
      返回:
      A map containing the id of the channel and the version of the corresponding mod, or NetworkRegistry.ABSENT if the channel is missing.
    • getPresentChannelData

      private static Map<ResourceLocation,org.apache.commons.lang3.tuple.Pair<String,String>> getPresentChannelData(Set<ResourceLocation> mismatchedChannelsFilter, ConnectionData connectionData, boolean mismatchedDataFromServer)
      Queries the channel data from the side the mismatched data isn't from, in order to provide a map of all the present channels for a proper comparison against the mismatched channel data.
      参数:
      mismatchedChannelsFilter - A filter that gets used in order to only query the data of mismatched mods, because that's the only one we need for a proper comparison between mismatched and present mods.
      connectionData - The connection data instance responsible for collecting the server mod data.
      mismatchedDataFromServer - Whether the mismatched data originates from the server. The data gets queried from the side that the mismatch data does not originate from.
      返回:
      The data of all relevant present channels, containing the channel id and the name and version of the corresponding mod.
    • getPresentModDataFromChannel

      private static org.apache.commons.lang3.tuple.Pair<ResourceLocation,org.apache.commons.lang3.tuple.Pair<String,String>> getPresentModDataFromChannel(ResourceLocation channel, ConnectionData connectionData, boolean mismatchedDataFromServer)
      Queries the mod data from a given channel id from the side the mismatched data isn't from.
      参数:
      channel - The id of the channel the mod data should be queried for.
      connectionData - The connection data instance responsible for collecting the server mod data.
      mismatchedDataFromServer - Whether the mismatched data originates from the server. The data gets queried from the side that the mismatch data does not originate from.
      返回:
      The mod data corresponding to the channel id, containing the channel id and the name and version of the corresponding mod.
    • getServerSidePresentModData

      private static Map<ResourceLocation,org.apache.commons.lang3.tuple.Pair<String,String>> getServerSidePresentModData(Set<ResourceLocation> mismatchedModsFilter, ConnectionData connectionData)
      Queries the mod data from the server side. Useful in case of a registry mismatch, which always gets detected on the client.
      参数:
      mismatchedModsFilter - A filter that gets used in order to only query the data of mismatched mods, because that's the only one we need for a proper comparison between mismatched and present mods.
      connectionData - The connection data instance responsible for collecting the server mod data.
      返回:
      The mod data from the server, containing the channel id and the name and version of the corresponding mod.
    • toString

      public final String toString()
      返回此记录的字符串表示形式。此表示形式包含类型的名称,后跟每个记录组件的名称和值。
      指定者:
      toString 在类中 Record
      返回:
      此对象的字符串表示形式
    • hashCode

      public final int hashCode()
      返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。
      指定者:
      hashCode 在类中 Record
      返回:
      此对象的哈希代码值
    • equals

      public final boolean equals(Object o)
      指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 使用 Objects::equals(Object,Object) 对参考组件进行比较;使用 '==' 对基元组件进行比较
      指定者:
      equals 在类中 Record
      参数:
      o - 要与之进行比较的对象
      返回:
      如果此对象与 o 参数相同,则为 true;否则为 false
    • mismatchedModData

      public Map<ResourceLocation,String> mismatchedModData()
      返回 mismatchedModData 记录组件的值。
      返回:
      mismatchedModData 记录组件的值
    • presentModData

      public Map<ResourceLocation,org.apache.commons.lang3.tuple.Pair<String,String>> presentModData()
      返回 presentModData 记录组件的值。
      返回:
      presentModData 记录组件的值
    • mismatchedDataFromServer

      public boolean mismatchedDataFromServer()
      返回 mismatchedDataFromServer 记录组件的值。
      返回:
      mismatchedDataFromServer 记录组件的值