Search in sources :

Example 1 with GeneItem

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

the class ItemSerum method getSpeciesRoot.

@Override
public ISpeciesRoot getSpeciesRoot(ItemStack stack) {
    GeneItem geneItem = this.getGeneItem(stack);
    Preconditions.checkNotNull(geneItem, "Cannot get species root from itemStack that is not a valid serum.");
    return geneItem.getSpeciesRoot();
}
Also used : GeneItem(binnie.genetics.genetics.GeneItem) IGeneItem(binnie.genetics.genetics.IGeneItem)

Example 2 with GeneItem

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

the class ItemSerum method getSubItems.

@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) {
    if (this.isInCreativeTab(tab)) {
        for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
            Map<IChromosomeType, List<IAllele>> chromosomeMap = Binnie.GENETICS.getChromosomeMap(root);
            if (chromosomeMap != null) {
                for (Map.Entry<IChromosomeType, List<IAllele>> entry : chromosomeMap.entrySet()) {
                    IChromosomeType chromosome = entry.getKey();
                    for (final IAllele allele : entry.getValue()) {
                        Gene gene = Gene.create(allele, chromosome, root);
                        IGeneItem geneItem = new GeneItem(gene);
                        ItemStack stack = new ItemStack(this);
                        geneItem.writeToItem(stack);
                        items.add(stack);
                    }
                }
            }
        }
    }
}
Also used : IAllele(forestry.api.genetics.IAllele) ISpeciesRoot(forestry.api.genetics.ISpeciesRoot) IGeneItem(binnie.genetics.genetics.IGeneItem) Gene(binnie.core.genetics.Gene) IGene(binnie.core.api.genetics.IGene) GeneItem(binnie.genetics.genetics.GeneItem) IGeneItem(binnie.genetics.genetics.IGeneItem) List(java.util.List) NonNullList(net.minecraft.util.NonNullList) IChromosomeType(forestry.api.genetics.IChromosomeType) ItemStack(net.minecraft.item.ItemStack) Map(java.util.Map)

Example 3 with GeneItem

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

the class ItemSerum method create.

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

Example 4 with GeneItem

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

the class ItemSerum method getGenes.

@Override
public IGene[] getGenes(ItemStack stack) {
    GeneItem geneItem = this.getGeneItem(stack);
    Preconditions.checkNotNull(geneItem, "Cannot get genes from itemStack that is not a valid serum.");
    return new IGene[] { geneItem.getGene() };
}
Also used : GeneItem(binnie.genetics.genetics.GeneItem) IGeneItem(binnie.genetics.genetics.IGeneItem) IGene(binnie.core.api.genetics.IGene)

Example 5 with GeneItem

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

the class ItemSerum method getGene.

@Override
public IGene getGene(ItemStack stack, int chromosome) {
    GeneItem geneItem = this.getGeneItem(stack);
    Preconditions.checkNotNull(geneItem, "Cannot get gene from itemStack that is not a valid serum.");
    return geneItem.getGene();
}
Also used : GeneItem(binnie.genetics.genetics.GeneItem) IGeneItem(binnie.genetics.genetics.IGeneItem)

Aggregations

GeneItem (binnie.genetics.genetics.GeneItem)5 IGeneItem (binnie.genetics.genetics.IGeneItem)5 IGene (binnie.core.api.genetics.IGene)2 ItemStack (net.minecraft.item.ItemStack)2 Gene (binnie.core.genetics.Gene)1 IAllele (forestry.api.genetics.IAllele)1 IChromosomeType (forestry.api.genetics.IChromosomeType)1 ISpeciesRoot (forestry.api.genetics.ISpeciesRoot)1 List (java.util.List)1 Map (java.util.Map)1 NonNullList (net.minecraft.util.NonNullList)1