Class SkillStateCodecs

java.lang.Object
de.Keyle.MyPet.api.skill.SkillStateCodecs

public final class SkillStateCodecs extends Object
Self-registering handle pairing a skill's SkillStateCodec with its state class, declared as a static field on the skill's impl class. Each codec is the single source of truth for its skill's NBT keys; stateless skills carry no codec.
  • Method Details

    • of

      public static <S extends Skill, T extends SkillState> SkillStateCodecs of(Class<S> skillClass, Class<T> stateClass, SkillStateCodec<T> codec)
      Declares a skill's state codec. Self-registers; picked up by SkillManager.registerSkill when the declaring class is initialized.
      Type Parameters:
      S - the skill the codec serves
      T - the state record it reads and writes
      Parameters:
      skillClass - the skill to register for
      stateClass - the state type
      codec - reads and writes that state
      Returns:
      the registered handle, for assignment to a static final field