Package com.pixelmonmod.api
Interface Specification<A,B>
- Type Parameters:
A- The reforged data typeB- The minecraft data type
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
AbstractSpecification,CardSpecification,EmptySpecification,PokemonSpecification,StatueSpecification
An interface that represents a check of the param types against given data
Or applying the given data to the param types
-
Method Summary
Modifier and TypeMethodDescriptionvoidApplies the specification data to the given object Will do nothing if the object is not of type A or Bcreate()Creates an instance of the reforged data objectcreate(boolean shallow) Creates an instance of the reforged data object
If shallow is true not all fields will be instantiated - shallow should be false by default<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 Bnet.minecraft.nbt.CompoundTagwrite(net.minecraft.nbt.CompoundTag nbt) Writes the specification to NBT
-
Method Details
-
matches
Checks if an object matches the specification data Will return false if the object is neither A or B- Parameters:
o- The object being checked- Returns:
- True if it matches the data - false otherwise
-
apply
Applies the specification data to the given object Will do nothing if the object is not of type A or B- Parameters:
o- The object being updated
-
create
A create()Creates an instance of the reforged data object- Returns:
- An instance
-
create
Creates an instance of the reforged data object
If shallow is true not all fields will be instantiated - shallow should be false by default- Parameters:
shallow-- Returns:
-
write
net.minecraft.nbt.CompoundTag write(net.minecraft.nbt.CompoundTag nbt) Writes the specification to NBT- Parameters:
nbt- The NBT being written to- Returns:
- The updated NBT
-
getValue
Attempts to get a value from the specification Will returnOptional.empty()if not found- Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-
getRequirement
Attempts to get a requirement from the specification Will returnOptional.empty()if not found- Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-
getRequirements
Attempts to get a list of requirements from the specification- Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-