mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 12:59:44 +00:00
Remove experimental code
This commit is contained in:
1 parent
4e096e7338
commit
e7766d3ad9
2 files changed
+17
-54
No files matched your search
@@ -38,17 +38,6 @@ public class Chromosome implements IChromosome {
|
||||
return new Chromosome(primary, secondary);
|
||||
}
|
||||
|
||||
public static Chromosome create(@Nullable String primarySpeciesUid, @Nullable String secondarySpeciesUid, IChromosomeType chromosomeType, String primaryUID, String secondaryUID) {
|
||||
IAllele primary = AlleleManager.alleleRegistry.getAllele(primaryUID);
|
||||
IAllele secondary = AlleleManager.alleleRegistry.getAllele(secondaryUID);
|
||||
|
||||
primary = validateAllele(primarySpeciesUid, chromosomeType, primary);
|
||||
secondary = validateAllele(secondarySpeciesUid, chromosomeType, secondary);
|
||||
|
||||
|
||||
return new Chromosome(primary, secondary);
|
||||
}
|
||||
|
||||
private static IAllele validateAllele(@Nullable String speciesUid, IChromosomeType chromosomeType, @Nullable IAllele allele) {
|
||||
if (!chromosomeType.getAlleleClass().isInstance(allele)) {
|
||||
ISpeciesRoot speciesRoot = chromosomeType.getSpeciesRoot();
|
||||
@@ -123,16 +112,16 @@ public class Chromosome implements IChromosome {
|
||||
|
||||
IAllele choice1;
|
||||
if (rand.nextBoolean()) {
|
||||
choice1 = parent1.getActiveAllele();
|
||||
choice1 = parent1.getPrimaryAllele();
|
||||
} else {
|
||||
choice1 = parent1.getInactiveAllele();
|
||||
choice1 = parent1.getSecondaryAllele();
|
||||
}
|
||||
|
||||
IAllele choice2;
|
||||
if (rand.nextBoolean()) {
|
||||
choice2 = parent2.getActiveAllele();
|
||||
choice2 = parent2.getPrimaryAllele();
|
||||
} else {
|
||||
choice2 = parent2.getInactiveAllele();
|
||||
choice2 = parent2.getSecondaryAllele();
|
||||
}
|
||||
|
||||
if (rand.nextBoolean()) {
|
||||
|
||||
@@ -162,54 +162,28 @@ public abstract class Genome implements IGenome {
|
||||
|
||||
|
||||
private static IChromosome[] getChromosomes(NBTTagCompound genomeNBT, ISpeciesRoot speciesRoot) {
|
||||
//Handle old nbt format
|
||||
if(genomeNBT.hasKey("Chromosomes")) {
|
||||
NBTTagList chromosomesNBT = genomeNBT.getTagList("Chromosomes", 10);
|
||||
IChromosome[] chromosomes = new IChromosome[speciesRoot.getDefaultTemplate().length];
|
||||
NBTTagList chromosomesNBT = genomeNBT.getTagList("Chromosomes", 10);
|
||||
IChromosome[] chromosomes = new IChromosome[speciesRoot.getDefaultTemplate().length];
|
||||
|
||||
String primarySpeciesUid = null;
|
||||
String secondarySpeciesUid = null;
|
||||
String primarySpeciesUid = null;
|
||||
String secondarySpeciesUid = null;
|
||||
|
||||
for (int i = 0; i < chromosomesNBT.tagCount(); i++) {
|
||||
NBTTagCompound chromosomeNBT = chromosomesNBT.getCompoundTagAt(i);
|
||||
byte chromosomeOrdinal = chromosomeNBT.getByte(SLOT_TAG);
|
||||
for (int i = 0; i < chromosomesNBT.tagCount(); i++) {
|
||||
NBTTagCompound chromosomeNBT = chromosomesNBT.getCompoundTagAt(i);
|
||||
byte chromosomeOrdinal = chromosomeNBT.getByte(SLOT_TAG);
|
||||
|
||||
if (chromosomeOrdinal >= 0 && chromosomeOrdinal < chromosomes.length) {
|
||||
IChromosomeType chromosomeType = speciesRoot.getKaryotype()[chromosomeOrdinal];
|
||||
Chromosome chromosome = Chromosome.create(primarySpeciesUid, secondarySpeciesUid, chromosomeType, chromosomeNBT);
|
||||
chromosomes[chromosomeOrdinal] = chromosome;
|
||||
if (chromosomeOrdinal >= 0 && chromosomeOrdinal < chromosomes.length) {
|
||||
IChromosomeType chromosomeType = speciesRoot.getKaryotype()[chromosomeOrdinal];
|
||||
Chromosome chromosome = Chromosome.create(primarySpeciesUid, secondarySpeciesUid, chromosomeType, chromosomeNBT);
|
||||
chromosomes[chromosomeOrdinal] = chromosome;
|
||||
|
||||
if (chromosomeOrdinal == speciesRoot.getSpeciesChromosomeType().ordinal()) {
|
||||
primarySpeciesUid = chromosome.getPrimaryAllele().getUID();
|
||||
secondarySpeciesUid = chromosome.getSecondaryAllele().getUID();
|
||||
}
|
||||
}
|
||||
}
|
||||
return chromosomes;
|
||||
}else{
|
||||
NBTTagCompound activeTag = genomeNBT.getCompoundTag("Active");
|
||||
NBTTagCompound inactiveTag = genomeNBT.getCompoundTag("Inactive");
|
||||
IChromosomeType[] karyotype = speciesRoot.getKaryotype();
|
||||
IChromosome[] chromosomes = new IChromosome[karyotype.length];
|
||||
|
||||
String primarySpeciesUid = null;
|
||||
String secondarySpeciesUid = null;
|
||||
|
||||
for(int index = 0;index < chromosomes.length;index++){
|
||||
IChromosomeType chromosomeType = karyotype[index];
|
||||
String typeName = chromosomeType.getName();
|
||||
String activeAllele = activeTag.getString(typeName);
|
||||
String inactiveAllele = inactiveTag.getString(typeName);
|
||||
Chromosome chromosome = Chromosome.create(primarySpeciesUid, secondarySpeciesUid, chromosomeType, activeAllele, inactiveAllele);
|
||||
chromosomes[index] = chromosome;
|
||||
|
||||
if (index == speciesRoot.getSpeciesChromosomeType().ordinal()) {
|
||||
if (chromosomeOrdinal == speciesRoot.getSpeciesChromosomeType().ordinal()) {
|
||||
primarySpeciesUid = chromosome.getPrimaryAllele().getUID();
|
||||
secondarySpeciesUid = chromosome.getSecondaryAllele().getUID();
|
||||
}
|
||||
}
|
||||
return chromosomes;
|
||||
}
|
||||
return chromosomes;
|
||||
}
|
||||
|
||||
protected static IAllele getActiveAllele(ItemStack itemStack, IChromosomeType chromosomeType, ISpeciesRoot speciesRoot) {
|
||||
|
||||
Reference in new issue
Block a user