类 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 dataT
- the registry typeVR
- 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.
-
嵌套类概要
嵌套类修饰符和类型类说明static final class
AdvancedDataMapType.Builder<T,
R, VR extends DataMapValueRemover<R, T>> A builder foradvanced data map types
. -
字段概要
字段 -
构造器概要
构造器限定符构造器说明private
AdvancedDataMapType
(ResourceKey<Registry<R>> registryKey, ResourceLocation id, com.mojang.serialization.Codec<T> codec, @Nullable com.mojang.serialization.Codec<T> networkCodec, boolean mandatorySync, com.mojang.serialization.Codec<VR> remover, DataMapValueMerger<R, T> merger) -
方法概要
修饰符和类型方法说明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。merger()
返回 the merger that handles data map conflicts。com.mojang.serialization.Codec
<VR> remover()
返回 the codec used to create removers。从类继承的方法 net.neoforged.neoforge.registries.datamaps.DataMapType
codec, id, mandatorySync, networkCodec, registryKey
-
字段详细资料
-
remover
-
merger
-
-
构造器详细资料
-
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
返回 the codec used to create removers。- 返回:
- the codec used to create removers
-
merger
返回 the merger that handles data map conflicts。- 返回:
- the merger that handles data map conflicts
-
builder
public static <T,R> AdvancedDataMapType.Builder<T,R, builderDataMapValueRemover.Default<T, R>> (ResourceLocation id, ResourceKey<Registry<R>> registry, com.mojang.serialization.Codec<T> codec) 返回 an advanced data map type builder。- 类型参数:
T
- the type of the data mapR
- the registry the data is for- 参数:
id
- the ID of the data mapregistry
- the key of the registry the data map is forcodec
- the codec used to deserialize the values from JSON- 返回:
- an advanced data map type builder
-