@Override public boolean isDiscovered(IAlleleSpecies species) { return discoveredSpecies.contains(species.getUID()); }
@Override public IAllele getPartner(IAllele allele) { if (species0.getUID().equals(allele.getUID())) { return species1; } else if (species1.getUID().equals(allele.getUID())) { return species0; } else { throw new IllegalArgumentException("Tried to get partner for allele that is not part of this mutation."); } }
public TemplateNotFoundException(IAlleleSpecies species) { super("Could not find template for species %s with UID %s", species.getAlleleName(), species.getUID()); }
@Override public void registerSpecies(IAlleleSpecies species) { if (!discoveredSpecies.contains(species.getUID())) { discoveredSpecies.add(species.getUID()); ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(speciesRootUID()); ForestryEvent event = new ForestryEvent.SpeciesDiscovered(speciesRoot, username, species, this); MinecraftForge.EVENT_BUS.post(event); syncToPlayer(Collections.singleton(species.getUID()), emptyStringCollection, emptyStringCollection); } }
private static int getHighestAdvancement(IAlleleSpecies mutationSpecies, int highest, Set<IAlleleSpecies> exclude, IChromosomeType speciesChromosome) { if (exclude.contains(mutationSpecies) || AlleleManager.alleleRegistry.isBlacklisted(mutationSpecies.getUID())) { return highest; } int otherAdvance = getGeneticAdvancement(mutationSpecies, exclude, speciesChromosome); return otherAdvance > highest ? otherAdvance : highest; } }
@Override public String getIdent() { return getGenome().getPrimary().getUID(); }
@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; }
private static String generateSpeciesListEntry(IAlleleSpecies species, IBreedingTracker tracker) { String discovered = ""; if (tracker.isDiscovered(species)) { discovered = discoveredSymbol; } String blacklisted = ""; if (AlleleManager.alleleRegistry.isBlacklisted(species.getUID())) { blacklisted = blacklistedSymbol; } String notCounted = ""; if (!species.isCounted()) { notCounted = notCountedSymbol; } return speciesListEntry(discovered, blacklisted, notCounted, species.getUID(), species.getAlleleName(), species.getAuthority()); }
@Override public void registerMutation(IMutation mutation) { if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) { return; } if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())) { return; } if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) { return; } butterflyMutations.add((IButterflyMutation) mutation); }
@Override public void registerMutation(IMutation mutation) { if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) { return; } if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())) { return; } if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) { return; } beeMutations.add((IBeeMutation) mutation); }
@Override public void registerMutation(IMutation mutation) { if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getTemplate()[0].getUID())) { return; } if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele0().getUID())) { return; } if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) { return; } treeMutations.add((ITreeMutation) mutation); }
public SpeciesDisplayHelper(ISpeciesRoot root) { this.root = root; ISpeciesType type = root.getIconType(); for (IIndividual individual : root.getIndividualTemplates()) { ItemStack itemStack = root.getMemberStack(individual, type); iconStacks.put(type, individual.getGenome().getPrimary().getUID(), itemStack); } }
@Override public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setInteger("state", state.ordinal()); if (tokenIndividual != null) { nbttagcompound.setString("tokenSpecies", tokenIndividual.getGenome().getPrimary().getUID()); } return nbttagcompound; }
@Override public void writeData(PacketBufferForestry data) { data.writeEnum(state, State.VALUES); if (tokenIndividual != null) { data.writeBoolean(true); data.writeString(tokenIndividual.getGenome().getPrimary().getUID()); } else { data.writeBoolean(false); } }
public static ResearchNote createMutationNote(GameProfile researcher, IMutation mutation) { NBTTagCompound compound = new NBTTagCompound(); compound.setString("ROT", mutation.getRoot().getUID()); compound.setString("AL0", mutation.getAllele0().getUID()); compound.setString("AL1", mutation.getAllele1().getUID()); compound.setString("RST", mutation.getTemplate()[0].getUID()); return new ResearchNote(researcher, MUTATION, compound); }
public static ResearchNote createSpeciesNote(GameProfile researcher, IAlleleSpecies species) { NBTTagCompound compound = new NBTTagCompound(); compound.setString("ROT", species.getRoot().getUID()); compound.setString("AL0", species.getUID()); return new ResearchNote(researcher, SPECIES, compound); }