use of forestry.api.genetics.ISpeciesRoot 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 forestry.api.genetics.ISpeciesRoot 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 forestry.api.genetics.ISpeciesRoot in project Binnie by ForestryMC.
the class SequencerRecipeMaker method create.
public static List<SequencerRecipeWrapper> create() {
List<SequencerRecipeWrapper> recipes = new ArrayList<>();
Collection<ISpeciesRoot> roots = AlleleManager.alleleRegistry.getSpeciesRoot().values();
for (ISpeciesRoot root : roots) {
IChromosomeType speciesChromosomeType = root.getSpeciesChromosomeType();
IAllele[] defaultTemplate = root.getDefaultTemplate();
IAllele species = defaultTemplate[speciesChromosomeType.ordinal()];
ItemStack filledSequence = ItemSequence.create(new Gene(species, speciesChromosomeType, root), false);
recipes.add(new SequencerRecipeWrapper(filledSequence));
filledSequence = filledSequence.copy();
filledSequence.setItemDamage(0);
recipes.add(new SequencerRecipeWrapper(filledSequence));
}
return recipes;
}
use of forestry.api.genetics.ISpeciesRoot in project EnderIO by SleepyTrousers.
the class SpeciesItemFilter method setItem.
@Nonnull
private ItemStack setItem(int slot, @Nonnull ItemStack itemStack) {
if (slot < 0 || slot >= items.size()) {
return ItemStack.EMPTY;
}
ItemStack prevStack = items.get(slot);
if (!prevStack.isEmpty()) {
this.primarySpeciesUids[slot] = null;
this.secondarySpeciesUids[slot] = null;
}
items.set(slot, itemStack);
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(itemStack);
if (speciesRoot != null) {
IIndividual member = speciesRoot.getMember(itemStack);
if (member != null) {
IGenome genome = member.getGenome();
primarySpeciesUids[slot] = genome.getPrimary().getUID();
secondarySpeciesUids[slot] = genome.getSecondary().getUID();
}
}
return prevStack;
}
use of forestry.api.genetics.ISpeciesRoot in project ForestryMC by ForestryMC.
the class EntityButterfly method readEntityFromNBT.
@Override
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
super.readEntityFromNBT(nbttagcompound);
IButterfly butterfly = null;
if (nbttagcompound.hasKey("BTFLY")) {
butterfly = new Butterfly((NBTTagCompound) nbttagcompound.getTag("BTFLY"));
}
setIndividual(butterfly);
if (nbttagcompound.hasKey("PLN")) {
NBTTagCompound pollenNBT = nbttagcompound.getCompoundTag("PLN");
ISpeciesRoot root;
if (pollenNBT.hasKey("Root")) {
root = AlleleManager.alleleRegistry.getSpeciesRoot(pollenNBT.getString("Root"));
} else {
root = TreeManager.treeRoot;
}
pollen = root.getMember(pollenNBT);
}
EnumButterflyState state = EnumButterflyState.VALUES[nbttagcompound.getByte("STATE")];
setState(state);
exhaustion = nbttagcompound.getInteger("EXH");
BlockPos home = new BlockPos(nbttagcompound.getInteger("homeX"), nbttagcompound.getInteger("homeY"), nbttagcompound.getInteger("homeZ"));
setHomePosAndDistance(home, ModuleLepidopterology.maxDistance);
}
Aggregations