@Override public List<IMutation> getCombinations(IAllele other) { List<IMutation> combinations = new ArrayList<>(); for (IMutation mutation : getMutations(false)) { if (mutation.isPartner(other)) { combinations.add(mutation); } } return combinations; }
@Override public List<IMutation> getCombinations(IAlleleSpecies parentSpecies0, IAlleleSpecies parentSpecies1, boolean shuffle) { List<IMutation> combinations = new ArrayList<>(); String parentSpecies1UID = parentSpecies1.getUID(); for (IMutation mutation : getMutations(shuffle)) { if (mutation.isPartner(parentSpecies0)) { IAllele partner = mutation.getPartner(parentSpecies0); if (partner.getUID().equals(parentSpecies1UID)) { combinations.add(mutation); } } } return combinations; }
@Nullable private static IMutation getEncodedMutation(ISpeciesRoot root, NBTTagCompound compound) { IAllele allele0 = AlleleManager.alleleRegistry.getAllele(compound.getString("AL0")); IAllele allele1 = AlleleManager.alleleRegistry.getAllele(compound.getString("AL1")); if (allele0 == null || allele1 == null) { return null; } IAllele result = null; if (compound.hasKey("RST")) { result = AlleleManager.alleleRegistry.getAllele(compound.getString("RST")); } IMutation encoded = null; for (IMutation mutation : root.getCombinations(allele0)) { if (mutation.isPartner(allele1)) { if (result == null || mutation.getTemplate()[0].getUID().equals(result.getUID())) { encoded = mutation; break; } } } return encoded; }