use of binnie.core.genetics.Gene in project Binnie by ForestryMC.
the class GeneArrayItem method readFromNBT.
@Override
public void readFromNBT(@Nullable NBTTagCompound nbt) {
genes.clear();
if (nbt == null) {
return;
}
NBTTagList list = nbt.getTagList(GENES_NBT, 10);
for (int i = 0; i < list.tagCount(); ++i) {
Gene gene = Gene.create(list.getCompoundTagAt(i));
genes.add(gene);
}
}
use of binnie.core.genetics.Gene in project Binnie by ForestryMC.
the class GeneTracker method readFromNBT.
@Override
public void readFromNBT(NBTTagCompound nbt) {
for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) {
if (!nbt.hasKey(root.getUID())) {
continue;
}
NBTTagCompound nbtRoot = nbt.getCompoundTag(root.getUID());
for (IChromosomeType chromo : root.getKaryotype()) {
if (!nbtRoot.hasKey(String.valueOf(chromo.ordinal()))) {
continue;
}
NBTTagList nbtChromo = nbtRoot.getTagList(String.valueOf(chromo.ordinal()), 8);
for (int i = 0; i < nbtChromo.tagCount(); ++i) {
String uid = nbtChromo.getStringTagAt(i);
IAllele allele = AlleleManager.alleleRegistry.getAllele(uid);
if (allele == null) {
continue;
}
Gene gene = new Gene(allele, chromo, root);
if (!discoveredGenes.contains(gene)) {
discoveredGenes.add(gene);
}
}
}
}
}
use of binnie.core.genetics.Gene in project Binnie by ForestryMC.
the class SequencerItem method create.
@Nullable
public static SequencerItem create(ItemStack itemStack) {
NBTTagCompound nbt = itemStack.getTagCompound();
if (nbt != null && nbt.hasKey("gene", Constants.NBT.TAG_COMPOUND) && nbt.hasKey("seq", Constants.NBT.TAG_BYTE) && nbt.hasKey("ana")) {
NBTTagCompound geneNbt = nbt.getCompoundTag("gene");
Gene gene = Gene.create(geneNbt);
SequencerItem sequencerItem = new SequencerItem(gene);
sequencerItem.sequenced = nbt.getByte("seq");
sequencerItem.analysed = nbt.getBoolean("ana");
return sequencerItem;
}
return null;
}
Aggregations