use of forestry.api.genetics.IAlleleSpecies in project Binnie by ForestryMC.
the class ExtraTreeMutation method getVanilla.
public static IAlleleSpecies getVanilla(final String uid) {
String forestryUid = "forestry.tree" + uid;
final IAllele allele = AlleleManager.alleleRegistry.getAllele(forestryUid);
Preconditions.checkArgument(allele != null);
Preconditions.checkArgument(allele instanceof IAlleleSpecies, "No Forestry species with uid: %s", forestryUid);
return (IAlleleSpecies) allele;
}
use of forestry.api.genetics.IAlleleSpecies in project Binnie by ForestryMC.
the class BreedingSystem method calculateMutations.
@Override
public void calculateMutations(ISpeciesRoot speciesRoot) {
this.allMutations = new ArrayList<>();
List<? extends IMutation> speciesMutations = speciesRoot.getMutations(false);
if (!speciesMutations.isEmpty()) {
final Set<IMutation> mutations = new LinkedHashSet<>(speciesMutations);
for (final IMutation mutation : mutations) {
this.allMutations.add(mutation);
final Set<IAlleleSpecies> participatingSpecies = new LinkedHashSet<>();
participatingSpecies.add(mutation.getAllele0());
participatingSpecies.add(mutation.getAllele1());
for (final IAlleleSpecies species : participatingSpecies) {
this.allFurtherMutations.put(species, mutation);
if (this.allActiveSpecies.contains(species)) {
this.furtherMutations.put(species, mutation);
}
}
IAllele[] template = mutation.getTemplate();
IAlleleSpecies speciesAllele = (IAlleleSpecies) template[0];
this.allResultantMutations.put(speciesAllele, mutation);
this.resultantMutations.put(speciesAllele, mutation);
}
}
}
use of forestry.api.genetics.IAlleleSpecies in project Binnie by ForestryMC.
the class BreedingSystem method calculateAlleles.
@Override
public void calculateAlleles(ISpeciesRoot speciesRoot) {
this.allSpecies = new ArrayList<>();
this.allActiveSpecies = new ArrayList<>();
this.resultantMutations.clear();
this.furtherMutations.clear();
this.allResultantMutations.clear();
this.allFurtherMutations.clear();
Collection<IAllele> allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values();
for (IAllele allele : allAlleles) {
String uid = allele.getUID();
IAllele[] template = speciesRoot.getTemplate(uid);
if (template != null) {
IAlleleSpecies species = (IAlleleSpecies) allele;
this.allSpecies.add(species);
if (isBlacklisted(allele) || uid.contains("speciesBotAlfheim")) {
continue;
}
this.allActiveSpecies.add((IAlleleSpecies) allele);
}
}
}
use of forestry.api.genetics.IAlleleSpecies in project Binnie by ForestryMC.
the class PageFruit method onValueChanged.
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
new ControlText(this, new Area(0, 0, this.getSize().xPos(), 24), I18N.localise("extratrees.gui.database.tab.fruit." + (this.treesThatBearFruit ? "natural" : "potential")), TextJustification.MIDDLE_CENTER);
ITreeBreedingSystem breedingSystem = (ITreeBreedingSystem) database.getBreedingSystem();
final Collection<IAlleleSpecies> trees;
if (this.treesThatBearFruit) {
trees = breedingSystem.getTreesThatBearFruit(species, database.isMaster(), database.getWorld(), database.getUsername());
} else {
trees = breedingSystem.getTreesThatCanBearFruit(species, database.isMaster(), database.getWorld(), database.getUsername());
}
new ControlSpeciesBox(this, 4, 24, this.getSize().xPos() - 8, this.getSize().yPos() - 4 - 24).setOptions(trees);
}
use of forestry.api.genetics.IAlleleSpecies in project Binnie by ForestryMC.
the class PagePlanksTrees method onValueChanged.
@Override
public void onValueChanged(final ItemStack species) {
this.deleteAllChildren();
final WindowAbstractDatabase database = Window.get(this);
new ControlText(this, new Area(0, 0, this.getSize().xPos(), 24), species.getDisplayName(), TextJustification.MIDDLE_CENTER);
final Collection<IAlleleSpecies> trees = getTreesThatMakePlanks(species, database.isMaster(), database.getWorld(), database.getUsername());
new ControlSpeciesBox(this, 4, 24, this.getSize().xPos() - 8, this.getSize().yPos() - 4 - 24).setOptions(trees);
}
Aggregations