类 AdvancedDataMapType<R,T,VR extends DataMapValueRemover<R,T>>

java.lang.Object
net.neoforged.neoforge.registries.datamaps.DataMapType<R,T>
net.neoforged.neoforge.registries.datamaps.AdvancedDataMapType<R,T,VR>
类型参数:
R - the type of the attached data
T - the registry type
VR - the type of the remover

public final class AdvancedDataMapType<R,T,VR extends DataMapValueRemover<R,T>> extends DataMapType<R,T>
A version of data map types that has two more features for compatibility and conflict handling: mergers and removers.

A remover will be used to support targeted removals that support decomposition, instead of the removal of the entire value. That way, for instance, one is able to remove just a value with a specific key from a map-based data map, instead of the entire map.
To use a remover one has to change the structure of the remove list, to an object:

 
 "remove": {
     "someobject:someid": {} // Remover object
 }
 
 
Or, to an object list:
 
 "remove": [
  {
      "key": someobject:someid",
      "remover": {} // Remover object. Optional. If not provided, the attached value will be removed from the object completely, without invoking the remover
  }
 ]
 
 

Advanced data map types also have the ability of handling conflicts between datapacks that attach an object to the same registry object. Using mergers, collection-based data maps can, as such, merge values provided by multiple packs in the same collection.
The default merge will however have the overriding behaviour of "last come wins", similar to recipes.

  • 字段详细资料

  • 构造器详细资料

    • AdvancedDataMapType

      private AdvancedDataMapType(ResourceKey<Registry<R>> registryKey, ResourceLocation id, com.mojang.serialization.Codec<T> codec, @Nullable @Nullable com.mojang.serialization.Codec<T> networkCodec, boolean mandatorySync, com.mojang.serialization.Codec<VR> remover, DataMapValueMerger<R,T> merger)
  • 方法详细资料

    • remover

      public com.mojang.serialization.Codec<VR> remover()
      返回 the codec used to create removers。
      返回:
      the codec used to create removers
    • merger

      public DataMapValueMerger<R,T> merger()
      返回 the merger that handles data map conflicts。
      返回:
      the merger that handles data map conflicts
    • builder

      public static <T, R> AdvancedDataMapType.Builder<T,R,DataMapValueRemover.Default<T,R>> builder(ResourceLocation id, ResourceKey<Registry<R>> registry, com.mojang.serialization.Codec<T> codec)
      返回 an advanced data map type builder。
      类型参数:
      T - the type of the data map
      R - the registry the data is for
      参数:
      id - the ID of the data map
      registry - the key of the registry the data map is for
      codec - the codec used to deserialize the values from JSON
      返回:
      an advanced data map type builder