mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-20 04:10:07 +00:00
Fix some bugs
This commit is contained in:
1 parent
fcef87b3da
commit
faf2b88ed8
5 files changed
+45
-32
No files matched your search
@@ -121,34 +121,44 @@ public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
}
|
||||
|
||||
public void calculateArrays() {
|
||||
final Collection<IAllele> allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values();
|
||||
Collection<IAllele> allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values();
|
||||
this.resultantMutations = new HashMap<>();
|
||||
this.furtherMutations = new HashMap<>();
|
||||
this.allResultantMutations = new HashMap<>();
|
||||
this.allFurtherMutations = new HashMap<>();
|
||||
this.allActiveSpecies = new ArrayList<>();
|
||||
this.allSpecies = new ArrayList<>();
|
||||
for (final IAllele species : allAlleles) {
|
||||
if (this.getSpeciesRoot().getTemplate(species.getUID()) != null) {
|
||||
this.resultantMutations.put((IAlleleSpecies) species, new ArrayList<>());
|
||||
this.furtherMutations.put((IAlleleSpecies) species, new ArrayList<>());
|
||||
this.allResultantMutations.put((IAlleleSpecies) species, new ArrayList<>());
|
||||
this.allFurtherMutations.put((IAlleleSpecies) species, new ArrayList<>());
|
||||
this.allSpecies.add((IAlleleSpecies) species);
|
||||
if (this.isBlacklisted(species) || species.getUID().contains("speciesBotAlfheim")) {
|
||||
ISpeciesRoot speciesRoot = getSpeciesRoot();
|
||||
for (IAllele allele : allAlleles) {
|
||||
String uid = allele.getUID();
|
||||
IAllele[] template = speciesRoot.getTemplate(uid);
|
||||
if (template != null) {
|
||||
IAlleleSpecies species = (IAlleleSpecies) allele;
|
||||
this.resultantMutations.put(species, new ArrayList<>());
|
||||
this.furtherMutations.put(species, new ArrayList<>());
|
||||
this.allResultantMutations.put(species, new ArrayList<>());
|
||||
this.allFurtherMutations.put(species, new ArrayList<>());
|
||||
this.allSpecies.add(species);
|
||||
if (isBlacklisted(allele) || uid.contains("speciesBotAlfheim")) {
|
||||
continue;
|
||||
}
|
||||
this.allActiveSpecies.add((IAlleleSpecies) species);
|
||||
this.allActiveSpecies.add((IAlleleSpecies) allele);
|
||||
}
|
||||
}
|
||||
this.allMutations = new ArrayList<>();
|
||||
final Collection<IClassification> allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values();
|
||||
Collection<IClassification> allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values();
|
||||
this.allBranches = new ArrayList<>();
|
||||
for (final IClassification branch : allRegBranches) {
|
||||
if (branch.getMemberSpecies().length > 0 && this.getSpeciesRoot().getTemplate(branch.getMemberSpecies()[0].getUID()) != null) {
|
||||
for (IClassification branch : allRegBranches) {
|
||||
IAlleleSpecies[] species = branch.getMemberSpecies();
|
||||
if (species.length <= 0) {
|
||||
continue;
|
||||
}
|
||||
IAlleleSpecies firstSpecies = species[0];
|
||||
IAllele[] template = speciesRoot.getTemplate(firstSpecies.getUID());
|
||||
if (template != null) {
|
||||
boolean possible = false;
|
||||
for (final IAlleleSpecies species2 : branch.getMemberSpecies()) {
|
||||
if (this.allActiveSpecies.contains(species2)) {
|
||||
for (IAlleleSpecies species2 : branch.getMemberSpecies()) {
|
||||
if (allActiveSpecies.contains(species2)) {
|
||||
possible = true;
|
||||
}
|
||||
}
|
||||
@@ -158,7 +168,7 @@ public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
this.allBranches.add(branch);
|
||||
}
|
||||
}
|
||||
List<? extends IMutation> speciesMutations = this.getSpeciesRoot().getMutations(false);
|
||||
List<? extends IMutation> speciesMutations = speciesRoot.getMutations(false);
|
||||
if (!speciesMutations.isEmpty()) {
|
||||
final Set<IMutation> mutations = new LinkedHashSet<>();
|
||||
mutations.addAll(speciesMutations);
|
||||
@@ -167,10 +177,10 @@ public abstract class BreedingSystem implements IItemStackRepresentitive {
|
||||
final Set<IAlleleSpecies> participatingSpecies = new LinkedHashSet<>();
|
||||
participatingSpecies.add(mutation.getAllele0());
|
||||
participatingSpecies.add(mutation.getAllele1());
|
||||
for (final IAlleleSpecies species3 : participatingSpecies) {
|
||||
this.allFurtherMutations.get(species3).add(mutation);
|
||||
if (this.allActiveSpecies.contains(species3)) {
|
||||
this.furtherMutations.get(species3).add(mutation);
|
||||
for (final IAlleleSpecies species : participatingSpecies) {
|
||||
this.allFurtherMutations.get(species).add(mutation);
|
||||
if (this.allActiveSpecies.contains(species)) {
|
||||
this.furtherMutations.get(species).add(mutation);
|
||||
}
|
||||
}
|
||||
IAllele[] template = mutation.getTemplate();
|
||||
|
||||
@@ -1988,9 +1988,7 @@ public enum ExtraBeeDefinition implements IBeeDefinition {
|
||||
setAlleles(template);
|
||||
|
||||
genome = BeeManager.beeRoot.templateAsGenome(template);
|
||||
if(speciesBuilder.isActive()){
|
||||
BeeManager.beeRoot.registerTemplate(template);
|
||||
}
|
||||
BeeManager.beeRoot.registerTemplate(template);
|
||||
}
|
||||
|
||||
public IBeeMutationBuilder registerMutation(IBeeDefinition allele0, IBeeDefinition allele1, int chance) {
|
||||
|
||||
@@ -239,9 +239,12 @@ public class ItemHoneyComb extends ItemProduct implements IColoredItem {
|
||||
}
|
||||
|
||||
public static boolean isInvalidComb(ItemStack stack){
|
||||
if(stack.isEmpty() || stack.getItem() != ExtraBees.comb){
|
||||
if(stack.isEmpty()){
|
||||
return true;
|
||||
}
|
||||
if(stack.getItem() != ExtraBees.comb){
|
||||
return false;
|
||||
}
|
||||
EnumHoneyComb honeyComb = EnumHoneyComb.get(stack);
|
||||
return !honeyComb.isActive();
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ public class AnalystPageGenome extends ControlAnalystPage {
|
||||
this.active = active;
|
||||
setColor(26265);
|
||||
int y = 4;
|
||||
int width = width();
|
||||
int center = width / 2;
|
||||
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 16;
|
||||
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind);
|
||||
@@ -55,12 +57,12 @@ public class AnalystPageGenome extends ControlAnalystPage {
|
||||
for (IChromosomeType chromo : system.getActiveKaryotype()) {
|
||||
IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo);
|
||||
String alleleName = system.getAlleleName(chromo, allele);
|
||||
int height = CraftGUI.render.textHeight(alleleName, width() / 2 - 2);
|
||||
new ControlText(scaled, new Area(0, y + (height - 9) / 2, width() / 2 - 2, 0), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT).setColor(getColor());
|
||||
new ControlText(scaled, new Area(width() / 2 + 2, y, width() / 2 - 2, 0), alleleName, TextJustification.TOP_LEFT).setColor(getColor());
|
||||
int height = CraftGUI.render.textHeight(alleleName, center - 2);
|
||||
new ControlText(scaled, new Area(0, y + (height - 9) / 2, center - 2, 0), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT).setColor(getColor());
|
||||
new ControlText(scaled, new Area(center + 2, y, center - 2, 0), alleleName, TextJustification.TOP_LEFT).setColor(getColor());
|
||||
y += 3 + height;
|
||||
}
|
||||
setSize(new Point(width(), y + 8));
|
||||
setSize(new Point(width, y + 8));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user