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.
-
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.static <T,R, E> DataMapValueMerger <R, T> wrappedListMerger(Function<T, List<E>> unpacker, Function<List<E>, T> packer) Returns a default merger that merges list data wrapped in another object.static <T,K, V, R> DataMapValueMerger <R, T> wrappedMapMerger(Function<T, Map<K, V>> unpacker, Function<Map<K, V>, T> packer) Returns a default merger that merges map data wrapped in another object.static <T,R, E> DataMapValueMerger <R, T> wrappedSetMerger(Function<T, Set<E>> unpacker, Function<Set<E>, T> packer) Returns a default merger that merges set data wrapped in another object.
-
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
-
wrappedListMerger
static <T,R, DataMapValueMerger<R,E> T> wrappedListMerger(Function<T, List<E>> unpacker, Function<List<E>, T> packer) Returns a default merger that merges list data wrapped in another object.- Returns:
- a default merger that merges list data wrapped in another object
-
setMerger
Returns a default merger that merges set data.- Returns:
- a default merger that merges set data
-
wrappedSetMerger
static <T,R, DataMapValueMerger<R,E> T> wrappedSetMerger(Function<T, Set<E>> unpacker, Function<Set<E>, T> packer) Returns a default merger that merges set data wrapped in another object.- Returns:
- a default merger that merges set data wrapped in another object
-
mapMerger
Returns a default merger that merges map data.- Returns:
- a default merger that merges map data
-
wrappedMapMerger
static <T,K, DataMapValueMerger<R,V, R> T> wrappedMapMerger(Function<T, Map<K, V>> unpacker, Function<Map<K, V>, T> packer) Returns a default merger that merges map data wrapped in another object.- Returns:
- a default merger that merges map data wrapped in another object
-