Interface IMemoryStorage

All Known Implementing Classes:
MemoryStorage

@PowerNukkitXOnly @Since("1.19.50-r1") public interface IMemoryStorage
记忆存储器

memory storage

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clear(MemoryType<?> type)
    清空指定记忆类型数据为null
    default <D> boolean
    使用指定的数据对比记忆类型存储的数据
    default void
    将此记忆存储器的数据编码进所属实体NBT(若MemoryType附加有编解码器)
    <D> D
    get(MemoryType<D> type)
    从指定记忆类型获取数据
    获取所有记忆
    获取记忆存储所属的实体
    default boolean
    检查指定记忆类型数据是否为空(null)
    default boolean
    检查指定记忆类型数据是否不为空(null)
    <D> void
    put(MemoryType<D> type, D data)
    写入数据到记忆类型
  • Method Details

    • put

      <D> void put(MemoryType<D> type, D data)
      写入数据到记忆类型

      Write data to MemoryType

      Type Parameters:
      D - 数据类型
      Parameters:
      type - 记忆类型
      data - 数据
    • get

      <D> D get(MemoryType<D> type)
      从指定记忆类型获取数据

      Get data from the specified MemoryType

      Type Parameters:
      D - 数据类型
      Parameters:
      type - 记忆类型
      Returns:
      数据
    • getAll

      Map<MemoryType<?>,?> getAll()
      获取所有记忆

      get all memories

      Returns:
      所有记忆
    • clear

      void clear(MemoryType<?> type)
      清空指定记忆类型数据为null

      Clear the specified MemoryType data to null

      Parameters:
      type - 记忆类型
    • getEntity

      @Since("1.19.63-r1") Entity getEntity()
      获取记忆存储所属的实体

      Get the entity that the memory store belongs to

      Returns:
      实体
    • isEmpty

      default boolean isEmpty(MemoryType<?> type)
      检查指定记忆类型数据是否为空(null)

      Check if the specified memory type data is empty (null)

      Parameters:
      type - 记忆类型
      Returns:
      是否为空
    • notEmpty

      default boolean notEmpty(MemoryType<?> type)
      检查指定记忆类型数据是否不为空(null)

      Check if the specified memory type data is not empty (null)

      Parameters:
      type - 记忆类型
      Returns:
      是否不为空
    • compareDataTo

      default <D> boolean compareDataTo(MemoryType<D> type, Object to)
      使用指定的数据对比记忆类型存储的数据

      Use the specified data compare the data of memory type

      Parameters:
      type - 记忆类型
      to - 指定的数据
      Returns:
      是否相同
    • encode

      default void encode()
      将此记忆存储器的数据编码进所属实体NBT(若MemoryType附加有编解码器)

      Encode the data of this memory storage into the entity NBT (if there is a codec attached to the Memory Type)