Package com.pixelmonmod.api
Class SpecificationFactory
java.lang.Object
com.pixelmonmod.api.SpecificationFactory
The static factory for registering
Requirements and getting instances of Specifications-
Method Summary
Modifier and TypeMethodDescriptionstatic <A,B, C extends Specification<A, B>>
@NotNull ParseAttempt<C>create(Class<? extends Specification<A, B>> clazz, String... specs) Creates aSpecificationinstance from a string array for the givenSpecificationstatic <A,B, C extends Specification<A, B>>
Cempty()Gets the emptySpecificationstatic <A,B, C extends Specification<A, B>>
ParseAttempt<C>fromNbt(Class<? extends Specification<A, B>> clazz, net.minecraft.nbt.CompoundTag nbt) Creates aSpecificationimplementation from given itemCompoundTagstatic String[]getRequirementNames(Class<? extends Specification<?, ?>> clazz) Gets all requirement names in the givenSpecificationstatic <A,B, C extends Specification<A, B>>
voidregister(Class<C> clazz, Requirement<A, B, ?> requirement) Register a newRequirementfor the givenSpecificationstatic <A,B> ParseAttempt<List<Requirement<A, B, ?>>> requirements(Class<? extends Specification<A, B>> specification, String spec) Gets the list ofRequirements created from the given spec for the specifiedSpecification
-
Method Details
-
register
public static <A,B, void registerC extends Specification<A, B>> (Class<C> clazz, Requirement<A, B, ?> requirement) Register a newRequirementfor the givenSpecification- Parameters:
clazz- The type being registered underrequirement- The requirement being registered
-
create
@NotNull public static <A,B, @NotNull ParseAttempt<C> createC extends Specification<A, B>> (Class<? extends Specification<A, B>> clazz, String... specs) Creates aSpecificationinstance from a string array for the givenSpecification- Parameters:
clazz- The typespecs- The specs being parsed- Returns:
- The pokemon spec created
-
requirements
public static <A,B> ParseAttempt<List<Requirement<A,B, requirements?>>> (Class<? extends Specification<A, B>> specification, String spec) Gets the list ofRequirements created from the given spec for the specifiedSpecification- Parameters:
specification- The typespec- The spec being parsed- Returns:
- The list of all requirements
-
empty
Gets the emptySpecification- Returns:
- The new spec
-
getRequirementNames
Gets all requirement names in the givenSpecification- Parameters:
clazz- The type- Returns:
- All requirement names registered under that type
-
fromNbt
public static <A,B, ParseAttempt<C> fromNbtC extends Specification<A, B>> (Class<? extends Specification<A, B>> clazz, net.minecraft.nbt.CompoundTag nbt) Creates aSpecificationimplementation from given itemCompoundTag- Type Parameters:
A- The reforged typeB- The minecraft typeC- The implementation of the spec interface- Parameters:
clazz- The typenbt- The NBT data- Returns:
- The specification implementation
-