Package com.pixelmonmod.api
Class AbstractSpecification<A,B>
java.lang.Object
com.pixelmonmod.api.AbstractSpecification<A,B>
- Type Parameters:
A- The reforged data typeB- The minecraft data type
- All Implemented Interfaces:
Specification<A,,B> Cloneable
- Direct Known Subclasses:
PokemonSpecification,StatueSpecification
Abstract implementation of the specification interface that handles all the logic for the sub-classes
Meaning the sub classes just have to pass in the data types
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSpecification(Class<A> dataType, Class<B> minecraftType, String originalSpec, List<Requirement<A, B, ?>> requirements) -
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the specification data to the given object Will do nothing if the object is not of type A or B<T> Optional<Requirement<A, B, T>> getRequirement(Class<? extends Requirement<A, B, T>> clazz) Attempts to get a requirement from the specification Will returnOptional.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 returnOptional.empty()if not foundbooleanChecks if an object matches the specification data Will return false if the object is neither A or BtoString()net.minecraft.nbt.CompoundTagwrite(net.minecraft.nbt.CompoundTag nbt) Writes the specification to NBTMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.pixelmonmod.api.Specification
create, create
-
Field Details
-
dataType
-
minecraftType
-
originalSpec
-
requirements
-
-
Constructor Details
-
AbstractSpecification
-
-
Method Details
-
matches
Description copied from interface:SpecificationChecks if an object matches the specification data Will return false if the object is neither A or B- Specified by:
matchesin interfaceSpecification<A,B> - Parameters:
o- The object being checked- Returns:
- True if it matches the data - false otherwise
-
apply
Description copied from interface:SpecificationApplies the specification data to the given object Will do nothing if the object is not of type A or B- Specified by:
applyin interfaceSpecification<A,B> - Parameters:
o- The object being updated
-
getValue
Description copied from interface:SpecificationAttempts to get a value from the specification Will returnOptional.empty()if not found- Specified by:
getValuein interfaceSpecification<A,B> - Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-
getRequirement
Description copied from interface:SpecificationAttempts to get a requirement from the specification Will returnOptional.empty()if not found- Specified by:
getRequirementin interfaceSpecification<A,B> - Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-
getRequirements
Description copied from interface:SpecificationAttempts to get a list of requirements from the specification- Specified by:
getRequirementsin interfaceSpecification<A,B> - Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-
write
public net.minecraft.nbt.CompoundTag write(net.minecraft.nbt.CompoundTag nbt) Description copied from interface:SpecificationWrites the specification to NBT- Specified by:
writein interfaceSpecification<A,B> - Parameters:
nbt- The NBT being written to- Returns:
- The updated NBT
-
toString
-