A - The reforged data typeB - The minecraft data typepublic abstract class AbstractSpecification<A,B> extends java.lang.Object implements Specification<A,B>
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Class<A> |
dataType |
protected java.lang.Class<B> |
minecraftType |
protected java.lang.String |
originalSpec |
protected java.util.List<Requirement<A,B,?>> |
requirements |
| Constructor and Description |
|---|
AbstractSpecification(java.lang.Class<A> dataType,
java.lang.Class<B> minecraftType,
java.lang.String originalSpec,
java.util.List<Requirement<A,B,?>> requirements) |
| Modifier and Type | Method and Description |
|---|---|
void |
apply(java.lang.Object o)
Applies the specification data to the given object
Will do nothing if the object is not of type A or B
|
<T> java.util.Optional<T> |
getValue(java.lang.Class<? extends Requirement<A,B,T>> clazz)
Attempts to get a value from the specification
Will return
Optional.empty() if not found |
boolean |
matches(java.lang.Object o)
Checks if an object matches the specification data
Will return false if the object is neither A or B
|
java.lang.String |
toString() |
net.minecraft.nbt.NBTTagCompound |
write(net.minecraft.nbt.NBTTagCompound nbt)
Writes the specification to NBT
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcreate, createprotected final java.lang.Class<A> dataType
protected final java.lang.Class<B> minecraftType
protected final java.lang.String originalSpec
protected final java.util.List<Requirement<A,B,?>> requirements
public AbstractSpecification(java.lang.Class<A> dataType, java.lang.Class<B> minecraftType, java.lang.String originalSpec, java.util.List<Requirement<A,B,?>> requirements)
public boolean matches(java.lang.Object o)
Specificationmatches in interface Specification<A,B>o - The object being checkedpublic void apply(java.lang.Object o)
Specificationapply in interface Specification<A,B>o - The object being updatedpublic <T> java.util.Optional<T> getValue(java.lang.Class<? extends Requirement<A,B,T>> clazz)
SpecificationOptional.empty() if not foundgetValue in interface Specification<A,B>T - The type of the requirementclazz - The data type being searched forpublic net.minecraft.nbt.NBTTagCompound write(net.minecraft.nbt.NBTTagCompound nbt)
Specificationwrite in interface Specification<A,B>nbt - The NBT being written topublic java.lang.String toString()
toString in class java.lang.Object