API reference Obsidian.API.Inventory.DataComponents
ComponentNetworkCodec<TValue> record
How a plugin's component type sends its values to clients, like vanilla's DataComponentType.streamCodec(). A client mod registering the same type must read and write the same bytes.
public sealed record ComponentNetworkCodec<TValue> : IEquatable<ComponentNetworkCodec<TValue>>
In Obsidian.API.
Constructors
ComponentNetworkCodec(Action<INetStreamWriter, TValue>, Func<INetStreamReader, TValue>)
public ComponentNetworkCodec(Action<INetStreamWriter, TValue> Write, Func<INetStreamReader, TValue> Read);How a plugin's component type sends its values to clients, like vanilla's DataComponentType.streamCodec(). A client mod registering the same type must read and write the same bytes.
Properties
Hash
public Func<TValue, int> Hash { get; init; }Optional persistent-codec hash for click predictions, using ComponentHash. Supply this when saved NBT loses the codec's types, such as booleans stored as bytes. It must match the client mod's HashOps value.
public Func<INetStreamReader, TValue> Read { get; init; }public Action<INetStreamWriter, TValue> Write { get; init; }