diff --git a/src/main/java/binnie/core/genetics/BreedingSystem.java b/src/main/java/binnie/core/genetics/BreedingSystem.java index 8508586e..64959d7d 100644 --- a/src/main/java/binnie/core/genetics/BreedingSystem.java +++ b/src/main/java/binnie/core/genetics/BreedingSystem.java @@ -121,34 +121,44 @@ public abstract class BreedingSystem implements IItemStackRepresentitive { } public void calculateArrays() { - final Collection allAlleles = AlleleManager.alleleRegistry.getRegisteredAlleles().values(); + Collection 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 allRegBranches = AlleleManager.alleleRegistry.getRegisteredClassifications().values(); + Collection 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 speciesMutations = this.getSpeciesRoot().getMutations(false); + List speciesMutations = speciesRoot.getMutations(false); if (!speciesMutations.isEmpty()) { final Set mutations = new LinkedHashSet<>(); mutations.addAll(speciesMutations); @@ -167,10 +177,10 @@ public abstract class BreedingSystem implements IItemStackRepresentitive { final Set 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(); diff --git a/src/main/java/binnie/extrabees/genetics/ExtraBeeDefinition.java b/src/main/java/binnie/extrabees/genetics/ExtraBeeDefinition.java index 84d0a090..3f7a845c 100644 --- a/src/main/java/binnie/extrabees/genetics/ExtraBeeDefinition.java +++ b/src/main/java/binnie/extrabees/genetics/ExtraBeeDefinition.java @@ -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) { diff --git a/src/main/java/binnie/extrabees/items/ItemHoneyComb.java b/src/main/java/binnie/extrabees/items/ItemHoneyComb.java index 80706cbb..eb752b0b 100644 --- a/src/main/java/binnie/extrabees/items/ItemHoneyComb.java +++ b/src/main/java/binnie/extrabees/items/ItemHoneyComb.java @@ -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(); } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java index 179a319f..1dbfc949 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java @@ -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 diff --git a/src/main/resources/assets/binniecore/lang/en_US.lang b/src/main/resources/assets/binniecore/lang/en_US.lang index 217d9848..6612dfb2 100644 --- a/src/main/resources/assets/binniecore/lang/en_US.lang +++ b/src/main/resources/assets/binniecore/lang/en_US.lang @@ -47,10 +47,10 @@ binniecore.rootBees.chromosome.speed=Production binniecore.rootBees.chromosome.lifespan=Lifespan binniecore.rootBees.chromosome.fertility=Fertility binniecore.rootBees.chromosome.temperature_tolerance=Temperature Tolerance -binniecore.rootBees.chromosome.nocturnal=Cathemeral +binniecore.rootBees.chromosome.never_sleeps=Cathemeral binniecore.rootBees.chromosome.humidity=Humidity binniecore.rootBees.chromosome.humidity_tolerance=Humidity Tolerance -binniecore.rootBees.chromosome.tolerant_flyer=Rain Tolerance +binniecore.rootBees.chromosome.tolerates_rain=Rain Tolerance binniecore.rootBees.chromosome.cave_dwelling=Cave Dwelling binniecore.rootBees.chromosome.flower_provider=Flowers binniecore.rootBees.chromosome.flowering=Pollination @@ -62,10 +62,10 @@ binniecore.rootBees.chromosome.speed.short=Production binniecore.rootBees.chromosome.lifespan.short=Lifespan binniecore.rootBees.chromosome.fertility.short=Fertility binniecore.rootBees.chromosome.temperature_tolerance.short=Temp. Tol. -binniecore.rootBees.chromosome.nocturnal.short=Cathemeral +binniecore.rootBees.chromosome.never_sleeps.short=Cathemeral binniecore.rootBees.chromosome.humidity.short=Humidity binniecore.rootBees.chromosome.humidity_tolerance.short=Humid. Tol. -binniecore.rootBees.chromosome.tolerant_flyer.short=Rain Tol. +binniecore.rootBees.chromosome.tolerates_rain.short=Rain Tol. binniecore.rootBees.chromosome.cave_dwelling.short=Cave Dwell. binniecore.rootBees.chromosome.flower_provider.short=Flowers binniecore.rootBees.chromosome.flowering.short=Pollination