use of forestry.api.genetics.ISpeciesRoot in project Binnie by ForestryMC.
the class InoculatorRecipeMaker method create.
public static List<InoculatorRecipeWrapper> create() {
List<InoculatorRecipeWrapper> recipes = new ArrayList<>();
for (IBreedingSystem system : Binnie.GENETICS.getActiveSystems()) {
ISpeciesRoot root = system.getSpeciesRoot();
IChromosomeType speciesChromosomeType = root.getSpeciesChromosomeType();
IAllele[] defaultTemplate = root.getDefaultTemplate();
IIndividual individual = root.templateAsIndividual(defaultTemplate);
for (ISpeciesType speciesType : system.getActiveTypes()) {
if (system.isDNAManipulable(speciesType)) {
ItemStack memberStack = root.getMemberStack(individual, speciesType);
memberStack.setItemDamage(OreDictionary.WILDCARD_VALUE);
IAllele species = defaultTemplate[speciesChromosomeType.ordinal()];
ItemStack serum = ItemSerum.create(new Gene(species, speciesChromosomeType, root));
// set fully charged
serum.setItemDamage(0);
recipes.add(new InoculatorRecipeWrapper(serum, memberStack));
recipes.add(new SplicerRecipeWrapper(serum, memberStack));
ItemStack serumArray = ItemSerumArray.create(new Gene(species, speciesChromosomeType, root));
// set fully charged
serumArray.setItemDamage(0);
for (IChromosomeType chromosomeType : root.getKaryotype()) {
if (chromosomeType != speciesChromosomeType) {
IAllele allele = defaultTemplate[chromosomeType.ordinal()];
Engineering.addGene(serumArray, new Gene(allele, chromosomeType, root));
}
}
recipes.add(new InoculatorRecipeWrapper(serumArray, memberStack));
recipes.add(new SplicerRecipeWrapper(serumArray, memberStack));
}
}
}
return recipes;
}
use of forestry.api.genetics.ISpeciesRoot in project Binnie by ForestryMC.
the class IsolatorRecipeMaker method create.
public static List<IsolatorRecipeWrapper> create() {
List<IsolatorRecipeWrapper> recipes = new ArrayList<>();
Collection<ISpeciesRoot> roots = AlleleManager.alleleRegistry.getSpeciesRoot().values();
for (ISpeciesRoot root : roots) {
ISpeciesType[] speciesTypes = root.getIconType().getClass().getEnumConstants();
IChromosomeType speciesChromosomeType = root.getSpeciesChromosomeType();
IAllele[] defaultTemplate = root.getDefaultTemplate();
IIndividual individual = root.templateAsIndividual(defaultTemplate);
for (ISpeciesType speciesType : speciesTypes) {
ItemStack memberStack = root.getMemberStack(individual, speciesType);
memberStack.setItemDamage(OreDictionary.WILDCARD_VALUE);
IAllele species = defaultTemplate[speciesChromosomeType.ordinal()];
ItemStack filledSequence = ItemSequence.create(new Gene(species, speciesChromosomeType, root), false);
IsolatorRecipeWrapper recipeWrapper = new IsolatorRecipeWrapper(memberStack, filledSequence);
recipes.add(recipeWrapper);
}
}
return recipes;
}
use of forestry.api.genetics.ISpeciesRoot in project Binnie by ForestryMC.
the class GeneTracker method writeToNBT.
@Override
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
NBTTagCompound nbtRoot = new NBTTagCompound();
for (IChromosomeType chromo : root.getKaryotype()) {
NBTTagList nbtChromo = new NBTTagList();
for (IGene gene : discoveredGenes) {
if (gene.getSpeciesRoot() == root && gene.getChromosome() == chromo) {
nbtChromo.appendTag(new NBTTagString(gene.getAllele().getUID()));
}
}
nbtRoot.setTag(String.valueOf(chromo.ordinal()), nbtChromo);
}
nbt.setTag(root.getUID(), nbtRoot);
}
return nbt;
}
use of forestry.api.genetics.ISpeciesRoot in project Binnie by ForestryMC.
the class GeneTracker method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound nbt) {
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
if (!nbt.hasKey(root.getUID())) {
continue;
}
NBTTagCompound nbtRoot = nbt.getCompoundTag(root.getUID());
for (IChromosomeType chromo : root.getKaryotype()) {
if (!nbtRoot.hasKey(String.valueOf(chromo.ordinal()))) {
continue;
}
NBTTagList nbtChromo = nbtRoot.getTagList(String.valueOf(chromo.ordinal()), 8);
for (int i = 0; i < nbtChromo.tagCount(); ++i) {
String uid = nbtChromo.getStringTagAt(i);
IAllele allele = AlleleManager.alleleRegistry.getAllele(uid);
if (allele == null) {
continue;
}
Gene gene = new Gene(allele, chromo, root);
if (!discoveredGenes.contains(gene)) {
discoveredGenes.add(gene);
}
}
}
}
}
Aggregations