Search in sources :

Example 36 with IAlleleSpecies

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);
        }
    }
}
Also used : IAllele(forestry.api.genetics.IAllele) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) IClassification(forestry.api.genetics.IClassification)

Example 37 with IAlleleSpecies

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());
    }
}
Also used : IAlleleTreeSpecies(forestry.api.arboriculture.IAlleleTreeSpecies) IAlleleSpecies(forestry.api.genetics.IAlleleSpecies) ItemStack(net.minecraft.item.ItemStack) ITreeGenome(forestry.api.arboriculture.ITreeGenome)

Aggregations

IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)37 ItemStack (net.minecraft.item.ItemStack)11 IAlleleTreeSpecies (forestry.api.arboriculture.IAlleleTreeSpecies)7 ITreeGenome (forestry.api.arboriculture.ITreeGenome)6 IAllele (forestry.api.genetics.IAllele)6 ArrayList (java.util.ArrayList)6 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)5 IIndividual (forestry.api.genetics.IIndividual)4 ISpeciesRoot (forestry.api.genetics.ISpeciesRoot)4 ControlText (binnie.core.gui.controls.ControlText)3 ControlSpeciesBox (binnie.core.gui.database.ControlSpeciesBox)3 WindowAbstractDatabase (binnie.core.gui.database.WindowAbstractDatabase)3 Area (binnie.core.gui.geometry.Area)3 IBreedingTracker (forestry.api.genetics.IBreedingTracker)3 IClassification (forestry.api.genetics.IClassification)3 IMutation (forestry.api.genetics.IMutation)3 Nullable (javax.annotation.Nullable)3 ITreeBreedingSystem (binnie.genetics.api.ITreeBreedingSystem)2 GameProfile (com.mojang.authlib.GameProfile)2 Alignment (binnie.core.api.gui.Alignment)1