Search in sources :

Example 6 with ISpeciesType

use of forestry.api.genetics.ISpeciesType in project ForestryMC by ForestryMC.

the class FilterLogic method getValidDirections.

public Collection<EnumFacing> getValidDirections(ItemStack itemStack, EnumFacing from) {
    ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(itemStack);
    IIndividual individual = null;
    ISpeciesType type = null;
    if (root != null) {
        individual = root.getMember(itemStack);
        type = root.getType(itemStack);
    }
    IFilterData filterData = new FilterData(root, individual, type);
    List<EnumFacing> validFacings = new LinkedList<>();
    for (EnumFacing facing : EnumFacing.VALUES) {
        if (facing == from) {
            continue;
        }
        if (isValid(facing, itemStack, filterData)) {
            validFacings.add(facing);
        }
    }
    return validFacings;
}
Also used : ISpeciesRoot(forestry.api.genetics.ISpeciesRoot) IIndividual(forestry.api.genetics.IIndividual) IFilterData(forestry.api.genetics.IFilterData) ISpeciesType(forestry.api.genetics.ISpeciesType) EnumFacing(net.minecraft.util.EnumFacing) IFilterData(forestry.api.genetics.IFilterData) LinkedList(java.util.LinkedList)

Example 7 with ISpeciesType

use of forestry.api.genetics.ISpeciesType 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)

Example 8 with ISpeciesType

use of forestry.api.genetics.ISpeciesType 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;
}
Also used : IIndividual(forestry.api.genetics.IIndividual) ISpeciesType(forestry.api.genetics.ISpeciesType) ArrayList(java.util.ArrayList) 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

IIndividual (forestry.api.genetics.IIndividual)8 ISpeciesType (forestry.api.genetics.ISpeciesType)8 ISpeciesRoot (forestry.api.genetics.ISpeciesRoot)6 ItemStack (net.minecraft.item.ItemStack)4 IAllele (forestry.api.genetics.IAllele)3 IFilterData (forestry.api.genetics.IFilterData)3 ArrayList (java.util.ArrayList)3 IBreedingSystem (binnie.core.api.genetics.IBreedingSystem)2 Gene (binnie.core.genetics.Gene)2 IChromosomeType (forestry.api.genetics.IChromosomeType)2 LinkedList (java.util.LinkedList)2 EnumFacing (net.minecraft.util.EnumFacing)2 EventMouse (binnie.core.gui.events.EventMouse)1 ControlItemDisplay (binnie.core.gui.minecraft.control.ControlItemDisplay)1 FilterData (forestry.sorting.FilterData)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1