- All Superinterfaces:
DataComponent.Holder
Represents any container of DataComponent
s.
This type is capable of storing a patch of added and removed components on top of a 'prototype', or existing
set of components. See diff(DataComponentMap, DataComponentMap)
.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
static interface
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic DataComponentMap.Builder
builder()
static Codec
<DataComponentMap> codec
(IntFunction<DataComponent<?>> idToType, Function<String, DataComponent<?>> nameToType) Creates a network type for the given component type.static DataComponentMap
diff
(DataComponentMap prototype, DataComponentMap patch) entrySet()
<T> T
get
(DataComponentMap prototype, DataComponent<T> component) Does a 'patch'ed get against the given prototype.boolean
has
(DataComponentMap prototype, DataComponent<?> component) Does a 'patch'ed has against the given prototype.boolean
isEmpty()
static NetworkBuffer.Type
<DataComponentMap> networkType
(IntFunction<DataComponent<?>> idToType) static Codec
<DataComponentMap> patchCodec
(IntFunction<DataComponent<?>> idToType, Function<String, DataComponent<?>> nameToType) Creates a network type for the given component type.static NetworkBuffer.Type
<DataComponentMap> patchNetworkType
(IntFunction<DataComponent<?>> idToType, boolean trusted) Creates a network type for the given component type.remove
(DataComponent<?> component) Removes the component from the map (or patch).default DataComponentMap
set
(DataComponent<Unit> component) <T> DataComponentMap
set
(DataComponent<T> component, T value) Adds the component, overwriting any prior value if present.Methods inherited from interface net.minestom.server.component.DataComponent.Holder
get, get, has
-
Field Details
-
EMPTY
-
-
Method Details
-
builder
-
patchBuilder
-
networkType
@Internal static NetworkBuffer.Type<DataComponentMap> networkType(IntFunction<DataComponent<?>> idToType) -
codec
@Internal static Codec<DataComponentMap> codec(IntFunction<DataComponent<?>> idToType, Function<String, DataComponent<?>> nameToType) Creates a network type for the given component type. For internal use only, get the value from the target component class. -
patchNetworkType
@Internal static NetworkBuffer.Type<DataComponentMap> patchNetworkType(IntFunction<DataComponent<?>> idToType, boolean trusted) Creates a network type for the given component type. For internal use only, get the value from the target component class. -
patchCodec
@Internal static Codec<DataComponentMap> patchCodec(IntFunction<DataComponent<?>> idToType, Function<String, DataComponent<?>> nameToType) Creates a network type for the given component type. For internal use only, get the value from the target component class. -
diff
-
isEmpty
boolean isEmpty() -
has
Does a 'patch'ed has against the given prototype. That is, this map is treated as the primary source, but if unspecified, the given prototype is used as a fallback.- Parameters:
prototype
- The prototype to fall back tocomponent
- The component to check- Returns:
- True if the component is present (taking into account the prototype).
-
get
Does a 'patch'ed get against the given prototype. That is, this map is treated as the primary source, but if unspecified, the given prototype is used as a fallback.- Type Parameters:
T
- The type of the component- Parameters:
prototype
- The prototype to fall back tocomponent
- The component to get- Returns:
- The value of the component, or null if not present (taking into account the prototype).
-
set
Adds the component, overwriting any prior value if present.- Returns:
- A new map with the component set to the value
-
set
-
remove
Removes the component from the map (or patch).- Parameters:
component
- The component to remove- Returns:
- A new map with the component removed
-
entrySet
Collection<DataComponent.Value> entrySet() -
toBuilder
DataComponentMap.Builder toBuilder() -
toPatchBuilder
DataComponentMap.PatchBuilder toPatchBuilder()
-