Interface Capability.IStorage<T>

All Known Implementing Classes:
CapabilityFluidHandler.DefaultFluidHandlerStorage
Enclosing class:
Capability<T>

public static interface Capability.IStorage<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    readNBT(Capability<T> capability, T instance, Direction side, INBT nbt)
    Read the capability instance from a NBT tag.
    writeNBT(Capability<T> capability, T instance, Direction side)
    Serialize the capability instance to a NBTTag.
  • Method Details

    • writeNBT

      @Nullable INBT writeNBT(Capability<T> capability, T instance, Direction side)
      Serialize the capability instance to a NBTTag. This allows for a central implementation of saving the data. It is important to note that it is up to the API defining the capability what requirements the 'instance' value must have. Due to the possibility of manipulating internal data, some implementations MAY require that the 'instance' be an instance of the 'default' implementation. Review the API docs for more info.
      Parameters:
      capability - The Capability being stored.
      instance - An instance of that capabilities interface.
      side - The side of the object the instance is associated with.
      Returns:
      a NBT holding the data. Null if no data needs to be stored.
    • readNBT

      void readNBT(Capability<T> capability, T instance, Direction side, INBT nbt)
      Read the capability instance from a NBT tag. This allows for a central implementation of saving the data. It is important to note that it is up to the API defining the capability what requirements the 'instance' value must have. Due to the possibility of manipulating internal data, some implementations MAY require that the 'instance' be an instance of the 'default' implementation. Review the API docs for more info. *
      Parameters:
      capability - The Capability being stored.
      instance - An instance of that capabilities interface.
      side - The side of the object the instance is associated with.
      nbt - A NBT holding the data. Must not be null, as doesn't make sense to call this function with nothing to read...