Package com.pixelmonmod.api
Class SpecificationFactory
java.lang.Object
com.pixelmonmod.api.SpecificationFactory
The static factory for registering
Requirement
s and getting instances of Specification
s-
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 aSpecification
instance from a string array for the givenSpecification
static <A,
B, C extends Specification<A, B>>
Cempty()
Gets the emptySpecification
static <A,
B, C extends Specification<A, B>>
ParseAttempt<C>fromNbt
(Class<? extends Specification<A, B>> clazz, net.minecraft.nbt.CompoundTag nbt) Creates aSpecification
implementation from given itemCompoundTag
static String[]
getRequirementNames
(Class<? extends Specification<?, ?>> clazz) Gets all requirement names in the givenSpecification
static <A,
B, C extends Specification<A, B>>
voidregister
(Class<C> clazz, Requirement<A, B, ?> requirement) Register a newRequirement
for the givenSpecification
static <A,
B> ParseAttempt<List<Requirement<A, B, ?>>> requirements
(Class<? extends Specification<A, B>> specification, String spec) Gets the list ofRequirement
s 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 newRequirement
for 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 aSpecification
instance 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 ofRequirement
s 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 aSpecification
implementation 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
-