package net.minecraft.network.syncher; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; /** * Handles encoding and decoding of data for {@link SynchedEntityData}. * Note that mods cannot add new serializers, because this is not a managed registry and the serializer ID is limited to 16. */ public interface EntityDataSerializer { StreamCodec codec(); default EntityDataAccessor createAccessor(int id) { return new EntityDataAccessor<>(id, this); } T copy(T value); static EntityDataSerializer forValueType(StreamCodec streamCodec) { return () -> streamCodec; } public interface ForValueType extends EntityDataSerializer { @Override default T copy(T object) { return object; } } }