A
- The reforged data typeB
- The minecraft data typepublic interface Specification<A,B>
extends java.lang.Cloneable
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
|
A |
create()
Creates an instance of the reforged data object
|
A |
create(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> java.util.Optional<Requirement<A,B,T>> |
getRequirement(java.lang.Class<? extends Requirement<A,B,T>> clazz)
Attempts to get a requirement from the specification
Will return
Optional.empty() if not found |
<T> java.util.Set<Requirement<A,B,T>> |
getRequirements(java.lang.Class<? extends Requirement<A,B,T>> clazz)
Attempts to get a list of requirements from the specification
|
<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
|
net.minecraft.nbt.CompoundNBT |
write(net.minecraft.nbt.CompoundNBT nbt)
Writes the specification to NBT
|
boolean matches(java.lang.Object o)
o
- The object being checkedvoid apply(java.lang.Object o)
o
- The object being updatedA create()
A create(boolean shallow)
shallow
- net.minecraft.nbt.CompoundNBT write(net.minecraft.nbt.CompoundNBT nbt)
nbt
- The NBT being written to<T> java.util.Optional<T> getValue(java.lang.Class<? extends Requirement<A,B,T>> clazz)
Optional.empty()
if not foundT
- The type of the requirementclazz
- The data type being searched for<T> java.util.Optional<Requirement<A,B,T>> getRequirement(java.lang.Class<? extends Requirement<A,B,T>> clazz)
Optional.empty()
if not foundT
- The type of the requirementclazz
- The data type being searched for<T> java.util.Set<Requirement<A,B,T>> getRequirements(java.lang.Class<? extends Requirement<A,B,T>> clazz)
T
- The type of the requirementclazz
- The data type being searched for