Interface DataMapValueMerger<R,T>
- Type Parameters:
R
- the type of the registry this merger is forT
- the data type
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An interface used to merge two conflicting registry data map values attached to the same object.
Using a merger you can, for example, merge list data maps that come from different sources, when otherwise the newest entry would win and override the older one.
Using a merger you can, for example, merge list data maps that come from different sources, when otherwise the newest entry would win and override the older one.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
R> DataMapValueMerger <R, T> Returns a default merger that overrides the old value with the new one.static <T,
R> DataMapValueMerger <R, List<T>> Returns a default merger that merges list data.static <K,
V, R> DataMapValueMerger <R, Map<K, V>> Returns a default merger that merges map data.merge
(Registry<R> registry, com.mojang.datafixers.util.Either<TagKey<R>, ResourceKey<R>> first, T firstValue, com.mojang.datafixers.util.Either<TagKey<R>, ResourceKey<R>> second, T secondValue) Merge two conflicting data map values.static <T,
R> DataMapValueMerger <R, Set<T>> Returns a default merger that merges set data.
-
Method Details
-
merge
T merge(Registry<R> registry, com.mojang.datafixers.util.Either<TagKey<R>, ResourceKey<R>> first, T firstValue, com.mojang.datafixers.util.Either<TagKey<R>, ResourceKey<R>> second, T secondValue) Merge two conflicting data map values.- Parameters:
registry
- the registry the data is forfirst
- the source of the first (older) valuefirstValue
- the first (older) valuesecond
- the source of the second (newer) valuesecondValue
- the second (newer) value- Returns:
- the merged value
-
defaultMerger
Returns a default merger that overrides the old value with the new one.- Returns:
- a default merger that overrides the old value with the new one
-
listMerger
Returns a default merger that merges list data.- Returns:
- a default merger that merges list data
-
setMerger
Returns a default merger that merges set data.- Returns:
- a default merger that merges set data
-
mapMerger
Returns a default merger that merges map data.- Returns:
- a default merger that merges map data
-