Search in sources :

Example 1 with GeneArrayItem

use of binnie.genetics.genetics.GeneArrayItem in project Binnie by ForestryMC.

the class ItemSerumArray method getSubItems.

@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
    if (this.isInCreativeTab(tab)) {
        for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
            for (IIndividual template : root.getIndividualTemplates()) {
                if (template.getGenome().getPrimary().isSecret()) {
                    continue;
                }
                IGeneItem geneItem = new GeneArrayItem();
                for (IChromosomeType type : root.getKaryotype()) {
                    IChromosome chromosome = template.getGenome().getChromosomes()[type.ordinal()];
                    if (chromosome != null) {
                        IAllele active = chromosome.getActiveAllele();
                        geneItem.addGene(new Gene(active, type, root));
                    }
                }
                ItemStack array = new ItemStack(this);
                geneItem.writeToItem(array);
                items.add(array);
            }
        }
    }
}
Also used : IAllele(forestry.api.genetics.IAllele) ISpeciesRoot(forestry.api.genetics.ISpeciesRoot) IGeneItem(binnie.genetics.genetics.IGeneItem) IIndividual(forestry.api.genetics.IIndividual) Gene(binnie.core.genetics.Gene) IGene(binnie.core.api.genetics.IGene) IChromosome(forestry.api.genetics.IChromosome) IChromosomeType(forestry.api.genetics.IChromosomeType) ItemStack(net.minecraft.item.ItemStack) GeneArrayItem(binnie.genetics.genetics.GeneArrayItem)

Example 2 with GeneArrayItem

use of binnie.genetics.genetics.GeneArrayItem in project Binnie by ForestryMC.

the class ItemSerumArray method create.

public static ItemStack create(final IGene gene) {
    final ItemStack item = new ItemStack(Genetics.items().itemSerumArray);
    item.setItemDamage(item.getMaxDamage());
    final GeneArrayItem seq = new GeneArrayItem(gene);
    seq.writeToItem(item);
    return item;
}
Also used : ItemStack(net.minecraft.item.ItemStack) GeneArrayItem(binnie.genetics.genetics.GeneArrayItem)

Aggregations

GeneArrayItem (binnie.genetics.genetics.GeneArrayItem)2 ItemStack (net.minecraft.item.ItemStack)2 IGene (binnie.core.api.genetics.IGene)1 Gene (binnie.core.genetics.Gene)1 IGeneItem (binnie.genetics.genetics.IGeneItem)1 IAllele (forestry.api.genetics.IAllele)1 IChromosome (forestry.api.genetics.IChromosome)1 IChromosomeType (forestry.api.genetics.IChromosomeType)1 IIndividual (forestry.api.genetics.IIndividual)1 ISpeciesRoot (forestry.api.genetics.ISpeciesRoot)1