Interface DataComponent<T>
- Type Parameters:
T- The value type of the component
- All Superinterfaces:
Decoder<T>, Encoder<T>, Holder<DataComponent<T>>, Keyed, RegistryKey<DataComponent<T>>, StaticProtocolObject<DataComponent<T>>
public sealed interface DataComponent<T>
extends StaticProtocolObject<DataComponent<T>>, Encoder<T>, Decoder<T>
A common type to represent all forms of component in the game. Each group of component types has its own declaration
file (see
DataComponent for example).- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents any type which can hold data components.static final recordNested classes/interfaces inherited from interface Holder
Holder.Direct<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<DataComponent<?>> static final Codec<DataComponentMap> static final NetworkBuffer.Type<DataComponentMap> static final NetworkBuffer.Type<DataComponent<?>> static final Codec<DataComponentMap> static final NetworkBuffer.Type<DataComponentMap> static final NetworkBuffer.Type<DataComponentMap> -
Method Summary
Modifier and TypeMethodDescriptioncodec()static <T> DataComponent<T> createHeadless(int id, Key key, NetworkBuffer.Type<T> network, @Nullable Codec<T> codec, @Nullable UnaryOperator<T> freeze) Freezes the given value if possible.static @Nullable DataComponent<?> fromId(int id) static @Nullable DataComponent<?> static @Nullable DataComponent<?> booleanbooleanisSynced()read(NetworkBuffer reader) static Collection<DataComponent<?>> values()voidwrite(NetworkBuffer writer, T value) Methods inherited from interface StaticProtocolObject
id, key, name, registry
-
Field Details
-
NETWORK_TYPE
-
CODEC
-
MAP_NETWORK_TYPE
-
MAP_NBT_TYPE
-
PATCH_NETWORK_TYPE
-
UNTRUSTED_PATCH_NETWORK_TYPE
-
PATCH_CODEC
-
-
Method Details
-
isSynced
boolean isSynced() -
isSerialized
boolean isSerialized() -
networkType
-
codec
-
read
-
write
-
freeze
-
fromKey
-
fromKey
-
fromId
-
values
-
createHeadless
@Internal static <T> DataComponent<T> createHeadless(int id, Key key, @Nullable NetworkBuffer.Type<T> network, @Nullable @Nullable Codec<T> codec, @Nullable @Nullable UnaryOperator<T> freeze)
-