Class PatchedDataComponentMap
java.lang.Object
net.minecraft.core.component.PatchedDataComponentMap
- All Implemented Interfaces:
Iterable<TypedDataComponent<?>>, DataComponentGetter, DataComponentMap
-
Nested Class Summary
Nested classes/interfaces inherited from interface DataComponentMap
DataComponentMap.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate it.unimi.dsi.fastutil.objects.Reference2ObjectMap<DataComponentType<?>, Optional<?>> private final DataComponentMapFields inherited from interface DataComponentMap
CODEC, EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionPatchedDataComponentMap(DataComponentMap prototype) privatePatchedDataComponentMap(DataComponentMap prototype, it.unimi.dsi.fastutil.objects.Reference2ObjectMap<DataComponentType<?>, Optional<?>> patch, boolean copyOnWrite) -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyPatch(DataComponentPatch patch) private voidapplyPatch(DataComponentType<?> type, Optional<?> value) asPatch()voidcopy()private voidbooleanstatic PatchedDataComponentMapfromPatch(DataComponentMap prototype, DataComponentPatch patch) <T> @Nullable Tget(DataComponentType<? extends T> type) inthashCode()private static inthashPatch(it.unimi.dsi.fastutil.objects.Reference2ObjectMap<DataComponentType<?>, Optional<?>> patch) booleanhasNonDefault(DataComponentType<?> type) booleanprivate static booleanisPatchSanitized(DataComponentMap prototype, it.unimi.dsi.fastutil.objects.Reference2ObjectMap<DataComponentType<?>, Optional<?>> patch) iterator()Set<DataComponentType<?>> keySet()booleanpatchEquals(DataComponentPatch patch) Returns true if the contained patch equals the given patch..<T> @Nullable Tremove(DataComponentType<? extends T> type) voidrestorePatch(DataComponentPatch patch) <T> @Nullable Tset(DataComponentType<T> type, @Nullable T value) <T> @Nullable Tset(TypedDataComponent<T> value) voidsetAll(DataComponentMap components) intsize()toString()Methods inherited from interface DataComponentGetter
get, getOrDefault, getOrDefault, getTyped, hasMethods inherited from interface DataComponentMap
filter, has, isEmpty, streamMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
prototype
-
patch
-
copyOnWrite
private boolean copyOnWrite
-
-
Constructor Details
-
PatchedDataComponentMap
-
PatchedDataComponentMap
private PatchedDataComponentMap(DataComponentMap prototype, it.unimi.dsi.fastutil.objects.Reference2ObjectMap<DataComponentType<?>, Optional<?>> patch, boolean copyOnWrite)
-
-
Method Details
-
fromPatch
public static PatchedDataComponentMap fromPatch(DataComponentMap prototype, DataComponentPatch patch) -
isPatchSanitized
private static boolean isPatchSanitized(DataComponentMap prototype, it.unimi.dsi.fastutil.objects.Reference2ObjectMap<DataComponentType<?>, Optional<?>> patch) -
get
- Specified by:
getin interfaceDataComponentGetter
-
hasNonDefault
-
set
-
set
-
remove
-
applyPatch
-
applyPatch
-
restorePatch
-
clearPatch
public void clearPatch() -
setAll
-
ensureMapOwnership
private void ensureMapOwnership() -
keySet
- Specified by:
keySetin interfaceDataComponentMap
-
iterator
- Specified by:
iteratorin interfaceDataComponentMap- Specified by:
iteratorin interfaceIterable<TypedDataComponent<?>>
-
size
public int size()- Specified by:
sizein interfaceDataComponentMap
-
isPatchEmpty
public boolean isPatchEmpty() -
asPatch
-
copy
-
toImmutableMap
-
patchEquals
Returns true if the contained patch equals the given patch..- Returns:
- true if the contained patch equals the given patch.
-
equals
-
hashCode
-
hashPatch
private static int hashPatch(it.unimi.dsi.fastutil.objects.Reference2ObjectMap<DataComponentType<?>, Optional<?>> patch) -
toString
-