Package com.pixelmonmod.api
Class EmptySpecification
java.lang.Object
com.pixelmonmod.api.EmptySpecification
- All Implemented Interfaces:
Specification<Object,,Object> Cloneable
Abn empty specification implementation that does nothing
-
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 defaultstatic EmptySpecification<T> Optional<Requirement<Object, Object, T>> getRequirement(Class<? extends Requirement<Object, Object, T>> clazz) Attempts to get a requirement from the specification Will returnOptional.empty()if not found<T> Set<Requirement<Object, Object, T>> getRequirements(Class<? extends Requirement<Object, Object, T>> clazz) Attempts to get a list of requirements from the specification<T> Optional<T> getValue(Class<? extends Requirement<Object, Object, 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
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<Object,Object> - 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<Object,Object> - Parameters:
o- The object being updated
-
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<Object,Object> - Parameters:
nbt- The NBT being written to- Returns:
- The updated NBT
-
getValue
Description copied from interface:SpecificationAttempts to get a value from the specification Will returnOptional.empty()if not found- Specified by:
getValuein interfaceSpecification<Object,Object> - Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-
getRequirement
public <T> Optional<Requirement<Object,Object, getRequirementT>> (Class<? extends Requirement<Object, Object, T>> clazz) Description copied from interface:SpecificationAttempts to get a requirement from the specification Will returnOptional.empty()if not found- Specified by:
getRequirementin interfaceSpecification<Object,Object> - Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-
getRequirements
public <T> Set<Requirement<Object,Object, getRequirementsT>> (Class<? extends Requirement<Object, Object, T>> clazz) Description copied from interface:SpecificationAttempts to get a list of requirements from the specification- Specified by:
getRequirementsin interfaceSpecification<Object,Object> - Type Parameters:
T- The type of the requirement- Parameters:
clazz- The data type being searched for- Returns:
- Any found data
-
create
Description copied from interface:SpecificationCreates an instance of the reforged data object- Specified by:
createin interfaceSpecification<Object,Object> - Returns:
- An instance
-
create
Description copied from interface:SpecificationCreates an instance of the reforged data object
If shallow is true not all fields will be instantiated - shallow should be false by default- Specified by:
createin interfaceSpecification<Object,Object> - Parameters:
shallow-- Returns:
-
getInstance
-