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:
CardSpecification
,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
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractSpecification
(Class<A> dataType, Class<B> minecraftType, String originalSpec, List<Requirement<A, B, ?>> requirements) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Applies 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 foundboolean
Checks if an object matches the specification data Will return false if the object is neither A or BtoString()
net.minecraft.nbt.CompoundTag
write
(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, wait
Methods 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:Specification
Checks if an object matches the specification data Will return false if the object is neither A or B- Specified by:
matches
in interfaceSpecification<A,
B> - Parameters:
o
- The object being checked- Returns:
- True if it matches the data - false otherwise
-
apply
Description copied from interface:Specification
Applies the specification data to the given object Will do nothing if the object is not of type A or B- Specified by:
apply
in interfaceSpecification<A,
B> - Parameters:
o
- The object being updated
-
getValue
Description copied from interface:Specification
Attempts to get a value from the specification Will returnOptional.empty()
if not found- Specified by:
getValue
in 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:Specification
Attempts to get a requirement from the specification Will returnOptional.empty()
if not found- Specified by:
getRequirement
in 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:Specification
Attempts to get a list of requirements from the specification- Specified by:
getRequirements
in 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:Specification
Writes the specification to NBT- Specified by:
write
in interfaceSpecification<A,
B> - Parameters:
nbt
- The NBT being written to- Returns:
- The updated NBT
-
toString
-