Package cn.nukkit.entity.ai.memory.codec
Interface IMemoryCodec<Data>
- All Known Implementing Classes:
BooleanMemoryCodec
,MemoryCodec
,NumberMemoryCodec
,StringMemoryCodec
记忆编解码器
-
Method Summary
Modifier and TypeMethodDescriptiondefault Data
decode
(CompoundTag tag) default void
encode
(Data data, CompoundTag tag) 获取记忆解码器,用于从CompoundTag读取持久化数据写入到实体记忆中获取记忆编码器,将实体记忆中的数据持久化进实体CompoundTagvoid
init
(Data data, EntityIntelligent entity) 从实体记忆初始化实体,可以用于初始化实体DataFlag.
-
Method Details
-
getDecoder
Function<CompoundTag,Data> getDecoder()获取记忆解码器,用于从CompoundTag读取持久化数据写入到实体记忆中Obtain a memory decoder for reading persistent data from Compound Tag and writing it to entity memory
- Returns:
- the decoder
-
getEncoder
BiConsumer<Data,CompoundTag> getEncoder()获取记忆编码器,将实体记忆中的数据持久化进实体CompoundTagGet the memory encoder to persist the data in the entity memory into the entity Compound Tag
- Returns:
- the encoder
-
init
从实体记忆初始化实体,可以用于初始化实体DataFlag.Initialize the entity from the entity memory, which can be used to initialize the entity Data Flag.
- Parameters:
data
- the dataentity
- the entity
-
decode
-
encode
-