use of forestry.api.genetics.ISpeciesPlugin in project ForestryMC by ForestryMC.
the class GuiElementFactory method createMutation.
public IGuiElementLayout createMutation(int x, int y, int width, int height, IMutation mutation, IAllele species, IBreedingTracker breedingTracker) {
if (breedingTracker.isDiscovered(mutation)) {
GuiElementPanel element = new GuiElementPanel(x, y, width, height);
ISpeciesRoot speciesRoot = mutation.getRoot();
int speciesIndex = speciesRoot.getSpeciesChromosomeType().ordinal();
ISpeciesPlugin plugin = mutation.getRoot().getSpeciesPlugin();
Map<String, ItemStack> iconStacks = plugin.getIndividualStacks();
ItemStack partner = iconStacks.get(mutation.getPartner(species).getUID());
IAllele resultAllele = mutation.getTemplate()[speciesIndex];
ItemStack result = iconStacks.get(resultAllele.getUID());
element.addElements(new GuiElementItemStack(0, 0, partner), new GuiElementItemStack(33, 0, result));
element.addElements(createProbabilityArrow(mutation, 18, 4, breedingTracker));
return element;
}
// Do not display secret undiscovered mutations.
if (mutation.isSecret()) {
return null;
}
return createUnknownMutationGroup(x, y, width, height, mutation, breedingTracker);
}
use of forestry.api.genetics.ISpeciesPlugin in project ForestryMC by ForestryMC.
the class DatabaseScreenLogic method getTabs.
private IDatabaseTab[] getTabs(ISpeciesRoot speciesRoot) {
ISpeciesPlugin databasePlugin = speciesRoot.getSpeciesPlugin();
if (databasePlugin == null) {
// no plugin ofr this species
return null;
}
this.databasePlugin = databasePlugin;
IDatabaseTab[] tabs = new IDatabaseTab[4];
IDatabaseTab speciesTab = databasePlugin.getSpeciesTab(true);
if (speciesTab == null) {
// the plugin does not support the database
return null;
}
IDatabaseTab productsTab = databasePlugin.getProductsTab();
IDatabaseTab mutationTab = databasePlugin.getMutationTab();
if (productsTab == null) {
productsTab = DatabaseTab.PRODUCTS;
}
if (mutationTab == null) {
mutationTab = DatabaseTab.MUTATIONS;
}
tabs[0] = speciesTab;
tabs[1] = databasePlugin.getSpeciesTab(false);
tabs[2] = productsTab;
tabs[3] = mutationTab;
return tabs;
}
Aggregations