Search in sources :

Example 21 with IBreedingSystem

use of binnie.core.api.genetics.IBreedingSystem in project Binnie by ForestryMC.

the class ManagerGenetics method getSystem.

public IBreedingSystem getSystem(final ISpeciesRoot root) {
    String rootUID = root.getUID();
    IBreedingSystem system = this.getSystem(rootUID);
    Preconditions.checkState(system != null, "Could not find system for species root %s", rootUID);
    return system;
}
Also used : IBreedingSystem(binnie.core.api.genetics.IBreedingSystem)

Example 22 with IBreedingSystem

use of binnie.core.api.genetics.IBreedingSystem 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;
}
Also used : IIndividual(forestry.api.genetics.IIndividual) ISpeciesType(forestry.api.genetics.ISpeciesType) ArrayList(java.util.ArrayList) IBreedingSystem(binnie.core.api.genetics.IBreedingSystem) IAllele(forestry.api.genetics.IAllele) ISpeciesRoot(forestry.api.genetics.ISpeciesRoot) Gene(binnie.core.genetics.Gene) IChromosomeType(forestry.api.genetics.IChromosomeType) ItemStack(net.minecraft.item.ItemStack)

Aggregations

IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)22 ArrayList (java.util.ArrayList)8 IAllele (forestry.api.genetics.IAllele)7 ISpeciesRoot (forestry.api.genetics.ISpeciesRoot)6 IChromosomeType (forestry.api.genetics.IChromosomeType)5 IIndividual (forestry.api.genetics.IIndividual)5 ItemStack (net.minecraft.item.ItemStack)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 IAlleleSpecies (forestry.api.genetics.IAlleleSpecies)4 Gene (binnie.core.genetics.Gene)3 Point (binnie.core.gui.geometry.Point)3 ControlPlayerInventory (binnie.core.gui.minecraft.control.ControlPlayerInventory)3 List (java.util.List)3 IGene (binnie.core.api.genetics.IGene)2 BreedingSystem (binnie.core.genetics.BreedingSystem)2 ControlText (binnie.core.gui.controls.ControlText)2 Control (binnie.core.gui.controls.core.Control)2 ControlScrollableContent (binnie.core.gui.controls.scroll.ControlScrollableContent)2 Area (binnie.core.gui.geometry.Area)2 ControlItemDisplay (binnie.core.gui.minecraft.control.ControlItemDisplay)2