Interface Specification<A,B>

Type Parameters:
A - The reforged data type
B - The minecraft data type
All Superinterfaces:
Cloneable
All Known Implementing Classes:
AbstractSpecification, CardSpecification, EmptySpecification, PokemonSpecification, StatueSpecification

public interface Specification<A,B> extends Cloneable
An interface that represents a check of the param types against given data Or applying the given data to the param types
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Applies the specification data to the given object Will do nothing if the object is not of type A or B
    Creates an instance of the reforged data object
    create(boolean shallow)
    Creates an instance of the reforged data object
    If shallow is true not all fields will be instantiated - shallow should be false by default
    getRequirement(Class<? extends Requirement<A,B,T>> clazz)
    Attempts to get a requirement from the specification Will return Optional.empty() if not found
    <T> Set<Requirement<A,B,T>>
    getRequirements(Class<? extends Requirement<A,B,T>> clazz)
    Attempts to get a list of requirements from the specification
    <T> Optional<T>
    getValue(Class<? extends Requirement<A,B,T>> clazz)
    Attempts to get a value from the specification Will return Optional.empty() if not found
    boolean
    Checks if an object matches the specification data Will return false if the object is neither A or B
    net.minecraft.nbt.CompoundTag
    write(net.minecraft.nbt.CompoundTag nbt)
    Writes the specification to NBT
  • Method Details

    • matches

      boolean matches(Object o)
      Checks if an object matches the specification data Will return false if the object is neither A or B
      Parameters:
      o - The object being checked
      Returns:
      True if it matches the data - false otherwise
    • apply

      void apply(Object o)
      Applies the specification data to the given object Will do nothing if the object is not of type A or B
      Parameters:
      o - The object being updated
    • create

      A create()
      Creates an instance of the reforged data object
      Returns:
      An instance
    • create

      A create(boolean shallow)
      Creates an instance of the reforged data object
      If shallow is true not all fields will be instantiated - shallow should be false by default
      Parameters:
      shallow -
      Returns:
    • write

      net.minecraft.nbt.CompoundTag write(net.minecraft.nbt.CompoundTag nbt)
      Writes the specification to NBT
      Parameters:
      nbt - The NBT being written to
      Returns:
      The updated NBT
    • getValue

      <T> Optional<T> getValue(Class<? extends Requirement<A,B,T>> clazz)
      Attempts to get a value from the specification Will return Optional.empty() if not found
      Type Parameters:
      T - The type of the requirement
      Parameters:
      clazz - The data type being searched for
      Returns:
      Any found data
    • getRequirement

      <T> Optional<Requirement<A,B,T>> getRequirement(Class<? extends Requirement<A,B,T>> clazz)
      Attempts to get a requirement from the specification Will return Optional.empty() if not found
      Type Parameters:
      T - The type of the requirement
      Parameters:
      clazz - The data type being searched for
      Returns:
      Any found data
    • getRequirements

      <T> Set<Requirement<A,B,T>> getRequirements(Class<? extends Requirement<A,B,T>> clazz)
      Attempts to get a list of requirements from the specification
      Type Parameters:
      T - The type of the requirement
      Parameters:
      clazz - The data type being searched for
      Returns:
      Any found data