private void setTokenSpecies(String speciesUid) { IAllele allele = AlleleManager.alleleRegistry.getAllele(speciesUid); if (allele instanceof IAlleleSpecies) { IAlleleSpecies species = (IAlleleSpecies) allele; ISpeciesRoot root = species.getRoot(); IAllele[] template = root.getTemplate(species); this.tokenIndividual = root.templateAsIndividual(template); this.tokenStack = root.getMemberStack(this.tokenIndividual, root.getIconType()); } }
@Override public boolean test(ItemStack itemStack) { ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(speciesRootUid); return speciesRoot != null && speciesRoot.isMember(itemStack); } }
@Override public ISpeciesRoot getSpeciesRoot(IIndividual individual) { return individual.getGenome().getSpeciesRoot(); }
@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); }
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 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 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); } }
@Override public int getColorFromItemstack(ItemStack stack, int tintIndex) { if (stack.getTagCompound() != null) { IIndividual individual = AlleleManager.alleleRegistry.getIndividual(stack); if (individual != null) { IAlleleSpecies species = individual.getGenome().getPrimary(); return species.getSpriteColour(tintIndex); } } return 0xffffff; }
@Override public void registerAllele(IAllele allele, IChromosomeType... chromosomeTypes) { addValidAlleleTypes(allele, chromosomeTypes); alleleMap.put(allele.getUID(), allele); if (allele instanceof IAlleleSpecies) { IClassification branch = ((IAlleleSpecies) allele).getBranch(); branch.addMemberSpecies((IAlleleSpecies) allele); } for (IAlleleHandler handler : this.alleleHandlers) { handler.onRegisterAllele(allele); } }
@Override public final boolean isBlacklisted(final IAllele allele) { return AlleleManager.alleleRegistry.isBlacklisted(allele.getUID()); }
ToleranceSystem(final IChromosomeType chromosomeType, final IToleranceType type) { this.speciesRootUid = chromosomeType.getSpeciesRoot().getUID(); this.chromosomeType = chromosomeType; this.type = type; }
@Override public IAllele getActiveAllele(IChromosomeType chromosomeType) { return chromosomes[chromosomeType.ordinal()].getActiveAllele(); }
@Override public IAllele getInactiveAllele(IChromosomeType chromosomeType) { return chromosomes[chromosomeType.ordinal()].getInactiveAllele(); }
/** * The type of the species that will be used at the given position of the mutation recipe in the gui. * * @param position 0 = first parent, 1 = second parent, 2 = result */ default ISpeciesType getTypeForMutation(int position) { return getIconType(); }
/** * Checks a position for suitability, and then plants a flower there. * Returns true on success. * For implementers, you can plant a random flower using IFlowerGrowthHelper.plantRandomFlower * * @since Forestry 5.5.4 */ default boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos, Collection<IBlockState> potentialFlowers) { //noinspection deprecation return growFlower(helper, flowerType, world, pos); } }
@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); }
@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; } FlowerRoot.flowerMutations.add((IFlowerMutation) mutation); }
private static String getMutationString(IMutation mutation) { String species0 = mutation.getAllele0().getUID(); String species1 = mutation.getAllele1().getUID(); String resultSpecies = mutation.getTemplate()[0].getUID(); return String.format(MUTATION_FORMAT, species0, species1, resultSpecies); }