Class EnumNBTHandler<E extends Enum<E>>

java.lang.Object
com.hrznstudio.titanium.nbthandler.data.EnumNBTHandler<E>
All Implemented Interfaces:
INBTHandler<E>
Direct Known Subclasses:
EnumDyeColorNBTHandler

public abstract class EnumNBTHandler<E extends Enum<E>> extends Object implements INBTHandler<E>
  • Constructor Details

    • EnumNBTHandler

      public EnumNBTHandler()
  • Method Details

    • getIdFrom

      protected abstract int getIdFrom(E obj)
    • getFromId

      protected abstract E getFromId(int id)
    • storeToNBT

      public final boolean storeToNBT(@Nonnull net.minecraft.nbt.CompoundTag compound, @Nonnull String name, @Nonnull E object)
      Description copied from interface: INBTHandler
      Stores a value as the given name in the NBT.
      Specified by:
      storeToNBT in interface INBTHandler<E extends Enum<E>>
      Parameters:
      compound - The NBT where the object needs to be stored.
      name - The name as it will be stored.
      object - The object value to be stored.
      Returns:
      true if the Object was successfully stored in the NBT
    • readFromNBT

      public final E readFromNBT(@Nonnull net.minecraft.nbt.CompoundTag compound, @Nonnull String name, @Nullable E currentValue)
      Description copied from interface: INBTHandler
      Reads the value from the NBT to be stored in the Field.
      Specified by:
      readFromNBT in interface INBTHandler<E extends Enum<E>>
      Parameters:
      compound - The NBT that stores all the information.
      name - The name of the object stored in the NBT.
      currentValue - The current value of the object
      Returns:
      The object if it was successfully stored or null if it wasn't giving the next handlers a chance to store the value.