Class MemoryStorage

java.lang.Object
cn.nukkit.entity.ai.memory.MemoryStorage
All Implemented Interfaces:
IMemoryStorage

@PowerNukkitXOnly @Since("1.19.50-r1") public class MemoryStorage extends Object implements IMemoryStorage
记忆存储器标准实现
  • Field Details

  • Constructor Details

  • Method Details

    • put

      public <D> void put(MemoryType<D> type, D data)
      Description copied from interface: IMemoryStorage
      写入数据到记忆类型

      Write data to MemoryType

      Specified by:
      put in interface IMemoryStorage
      Type Parameters:
      D - 数据类型
      Parameters:
      type - 记忆类型
      data - 数据
    • get

      public <D> D get(MemoryType<D> type)
      Description copied from interface: IMemoryStorage
      从指定记忆类型获取数据

      Get data from the specified MemoryType

      Specified by:
      get in interface IMemoryStorage
      Type Parameters:
      D - 数据类型
      Parameters:
      type - 记忆类型
      Returns:
      数据
    • getAll

      public Map<MemoryType<?>,?> getAll()
      Description copied from interface: IMemoryStorage
      获取所有记忆

      get all memories

      Specified by:
      getAll in interface IMemoryStorage
      Returns:
      所有记忆
    • clear

      public void clear(MemoryType<?> type)
      Description copied from interface: IMemoryStorage
      清空指定记忆类型数据为null

      Clear the specified MemoryType data to null

      Specified by:
      clear in interface IMemoryStorage
      Parameters:
      type - 记忆类型
    • getEntity

      public EntityIntelligent getEntity()
      Description copied from interface: IMemoryStorage
      获取记忆存储所属的实体

      Get the entity that the memory store belongs to

      Specified by:
      getEntity in interface IMemoryStorage
      Returns:
      实体