use of forestry.api.genetics.IAlleleSpecies in project Binnie by ForestryMC.
the class BreedingSystem method calculateBranches.
@Override
public void calculateBranches(ISpeciesRoot speciesRoot) {
Collection<IClassification> allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values();
this.allBranches = new ArrayList<>();
for (IClassification branch : allRegBranches) {
IAlleleSpecies[] species = branch.getMemberSpecies();
if (species.length <= 0) {
continue;
}
IAlleleSpecies firstSpecies = species[0];
IAllele[] template = speciesRoot.getTemplate(firstSpecies.getUID());
if (template != null) {
boolean possible = false;
for (IAlleleSpecies species2 : branch.getMemberSpecies()) {
if (allActiveSpecies.contains(species2)) {
possible = true;
}
}
if (!possible) {
continue;
}
this.allBranches.add(branch);
}
}
}
use of forestry.api.genetics.IAlleleSpecies in project Binnie by ForestryMC.
the class TreeBreedingSystem method onSyncBreedingTracker.
@Override
public void onSyncBreedingTracker(final IBreedingTracker tracker) {
this.discoveredFruits.clear();
this.discoveredWoods.clear();
for (final IAlleleSpecies species : this.getDiscoveredSpecies(tracker)) {
final IAlleleTreeSpecies tSpecies = (IAlleleTreeSpecies) species;
final ITreeGenome genome = (ITreeGenome) this.getSpeciesRoot().templateAsGenome(this.getSpeciesRoot().getTemplate(tSpecies));
IAlleleTreeSpecies treeSpecies = genome.getPrimary();
final ItemStack wood = treeSpecies.getWoodProvider().getWoodStack();
if (!wood.isEmpty()) {
this.discoveredWoods.add(wood);
}
/*for (final ItemStack wood : tSpecies.getRoot().templateAsIndividual(getSpeciesRoot().getTemplate(tSpecies.getUID())).getProduceList()) {
this.discoveredWoods.add(wood);
}*/
this.discoveredFruits.addAll(genome.getFruitProvider().getProducts().keySet());
}
}
Aggregations