use of binnie.core.api.genetics.IItemAnalysable in project Binnie by ForestryMC.
the class ManagerGenetics method analyse.
public static ItemStack analyse(ItemStack stack, World world, GameProfile username) {
if (!stack.isEmpty()) {
ItemStack conv = Binnie.GENETICS.getConversionStack(stack).copy();
if (!conv.isEmpty()) {
conv.setCount(stack.getCount());
stack = conv;
}
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(stack);
if (root != null) {
final IIndividual ind = root.getMember(stack);
ind.analyze();
IBreedingTracker breedingTracker = ind.getGenome().getSpeciesRoot().getBreedingTracker(world, username);
breedingTracker.registerBirth(ind);
final NBTTagCompound nbttagcompound = new NBTTagCompound();
ind.writeToNBT(nbttagcompound);
stack.setTagCompound(nbttagcompound);
return stack;
}
if (stack.getItem() instanceof IItemAnalysable) {
return ((IItemAnalysable) stack.getItem()).analyse(stack);
}
}
return stack;
}
Aggregations