Package cn.nukkit.entity.ai.memory.codec
Class MemoryCodec<Data>
java.lang.Object
cn.nukkit.entity.ai.memory.codec.MemoryCodec<Data>
- All Implemented Interfaces:
IMemoryCodec<Data>
- Direct Known Subclasses:
BooleanMemoryCodec
,NumberMemoryCodec
,StringMemoryCodec
@PowerNukkitXOnly
@Since("1.19.63-r1")
public class MemoryCodec<Data>
extends Object
implements IMemoryCodec<Data>
-
Constructor Summary
ConstructorsConstructorDescriptionMemoryCodec
(Function<CompoundTag, Data> decoder, BiConsumer<Data, CompoundTag> encoder) -
Method Summary
Modifier and TypeMethodDescription获取记忆解码器,用于从CompoundTag读取持久化数据写入到实体记忆中获取记忆编码器,将实体记忆中的数据持久化进实体CompoundTagvoid
init
(Data data, EntityIntelligent entity) 从实体记忆初始化实体,可以用于初始化实体DataFlag.onInit
(BiConsumer<Data, EntityIntelligent> onInit) BiConsumer<Data, EntityIntelligent> Data can be NullMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cn.nukkit.entity.ai.memory.codec.IMemoryCodec
decode, encode
-
Constructor Details
-
MemoryCodec
-
-
Method Details
-
onInit
BiConsumer<Data, EntityIntelligent> Data can be Null -
init
Description copied from interface:IMemoryCodec
从实体记忆初始化实体,可以用于初始化实体DataFlag.Initialize the entity from the entity memory, which can be used to initialize the entity Data Flag.
- Specified by:
init
in interfaceIMemoryCodec<Data>
- Parameters:
data
- the dataentity
- the entity
-
getDecoder
Description copied from interface:IMemoryCodec
获取记忆解码器,用于从CompoundTag读取持久化数据写入到实体记忆中Obtain a memory decoder for reading persistent data from Compound Tag and writing it to entity memory
- Specified by:
getDecoder
in interfaceIMemoryCodec<Data>
- Returns:
- the decoder
-
getEncoder
Description copied from interface:IMemoryCodec
获取记忆编码器,将实体记忆中的数据持久化进实体CompoundTagGet the memory encoder to persist the data in the entity memory into the entity Compound Tag
- Specified by:
getEncoder
in interfaceIMemoryCodec<Data>
- Returns:
- the encoder
-
getOnInit
-