use of binnie.genetics.genetics.IGeneItem 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);
}
}
}
}
}
}
use of binnie.genetics.genetics.IGeneItem in project Binnie by ForestryMC.
the class ItemSerum method addGene.
@Override
public ItemStack addGene(ItemStack stack, IGene gene) {
final IGeneItem geneI = this.getGeneItem(stack);
Preconditions.checkNotNull(geneI, "Cannot add gene to itemStack that is not a valid serum.");
geneI.addGene(gene);
geneI.writeToItem(stack);
return stack;
}
use of binnie.genetics.genetics.IGeneItem in project Binnie by ForestryMC.
the class ItemSerumArray method addGene.
@Override
public ItemStack addGene(final ItemStack stack, final IGene gene) {
final IGeneItem geneItem = this.getGeneItem(stack);
Preconditions.checkNotNull(geneItem, "Cannot add gene to itemStack that is not a valid serum array.");
geneItem.addGene(gene);
geneItem.writeToItem(stack);
return stack;
}
use of binnie.genetics.genetics.IGeneItem 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);
}
}
}
}
use of binnie.genetics.genetics.IGeneItem in project Binnie by ForestryMC.
the class ItemGene method addInformation.
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack itemstack, @Nullable World worldIn, List<String> list, ITooltipFlag flagIn) {
int damage = itemstack.getMaxDamage() - itemstack.getItemDamage();
if (damage == 0) {
list.add(I18N.localise("genetics.item.gene.empty"));
} else if (damage == 1) {
list.add("1 " + I18N.localise("genetics.item.gene.charge"));
} else {
list.add(damage + " " + I18N.localise("genetics.item.gene.charges"));
}
IGeneItem gene = this.getGeneItem(itemstack);
if (gene != null) {
gene.getInfo(list);
}
}
Aggregations