@ModuleContainerObjectMethod.Inject( module = IntegrationForestry.analyzerMod, worldThread = false, modId = Constants.MOD_ID, doc = "function(root:string):table -- Get a list of all mutations in the given species root" ) public static Object[] getMutationsList(IContext<IModuleContainer> context, Object[] args) throws LuaException { String uid = ArgumentHelper.getString(args, 0); ISpeciesRoot root = getSpeciesRoot(uid); LuaList<Map<Object, Object>> mutations = root.getMutations(false).stream() .filter(s -> !s.isSecret()) .map(m -> context.makePartialChild(m).getMeta()) .collect(LuaList.toLuaList()); return new Object[]{mutations.asMap()}; } }
@Nullable public IElementGroup createMutationResultant(int x, int y, int width, int height, IMutation mutation, IBreedingTracker breedingTracker) { if (breedingTracker.isDiscovered(mutation)) { IElementGroup element = new PaneLayout(x, y, width, height); IAlyzerPlugin plugin = mutation.getRoot().getAlyzerPlugin(); Map<String, ItemStack> iconStacks = plugin.getIconStacks(); ItemStack firstPartner = iconStacks.get(mutation.getAllele0().getUID()); ItemStack secondPartner = iconStacks.get(mutation.getAllele1().getUID()); element.add(new ItemElement(0, 0, firstPartner), createProbabilityAdd(mutation, 21, 4), new ItemElement(33, 0, secondPartner)); return element; } // Do not display secret undiscovered mutations. if (mutation.isSecret()) { return null; } return createUnknownMutationGroup(x, y, width, height, mutation); }
@Nullable public IElementGroup createMutation(int x, int y, int width, int height, IMutation mutation, IAllele species, IBreedingTracker breedingTracker) { if (breedingTracker.isDiscovered(mutation)) { PaneLayout element = new PaneLayout(x, y, width, height); ISpeciesRoot speciesRoot = mutation.getRoot(); int speciesIndex = speciesRoot.getSpeciesChromosomeType().ordinal(); IDatabasePlugin 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.add(new ItemElement(0, 0, partner), new ItemElement(33, 0, result)); createProbabilityArrow(element, 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); }
private void displaySpeciesInformation(boolean analyzed, IAlleleSpecies species, ItemStack iconStack, int x) { if (!analyzed) { textLayout.drawLine(Translator.translateToLocal("for.gui.unknown"), x); return; } textLayout.drawLine(species.getAlleleName(), x); GuiUtil.drawItemStack(this, iconStack, guiLeft + x + 69, guiTop + textLayout.getLineY() - 2); textLayout.newLine(); // Viable Combinations int columnWidth = 16; int column = 10; for (IMutation combination : speciesRoot.getCombinations(species)) { if (combination.isSecret()) { continue; } if (breedingTracker.isDiscovered(combination)) { drawMutationIcon(combination, species, column); } else { drawUnknownIcon(combination, column); } column += columnWidth; if (column > 75) { column = 10; textLayout.newLine(18); } } textLayout.newLine(); textLayout.newLine(); }
public void drawAnalyticsPageMutations(IIndividual individual) { textLayout.startPage(COLUMN_0, COLUMN_1, COLUMN_2); textLayout.drawLine(Translator.translateToLocal("for.gui.beealyzer.mutations") + ":", COLUMN_0); textLayout.newLine(); RenderHelper.enableGUIStandardItemLighting(); IGenome genome = individual.getGenome(); ISpeciesRoot speciesRoot = genome.getSpeciesRoot(); IAlleleSpecies species = genome.getPrimary(); int columnWidth = 50; int x = 0; EntityPlayer player = Minecraft.getMinecraft().player; IBreedingTracker breedingTracker = speciesRoot.getBreedingTracker(player.world, player.getGameProfile()); for (IMutation mutation : speciesRoot.getCombinations(species)) { if (breedingTracker.isDiscovered(mutation)) { drawMutationInfo(mutation, species, COLUMN_0 + x, breedingTracker); } else { // Do not display secret undiscovered mutations. if (mutation.isSecret()) { continue; } drawUnknownMutation(mutation, COLUMN_0 + x, breedingTracker); } x += columnWidth; if (x >= columnWidth * 4) { x = 0; textLayout.newLine(16); } } textLayout.endPage(); }