diff --git a/src/main/java/binnie/core/craftgui/controls/ControlText.java b/src/main/java/binnie/core/craftgui/controls/ControlText.java index 13f65103..07f6e31a 100644 --- a/src/main/java/binnie/core/craftgui/controls/ControlText.java +++ b/src/main/java/binnie/core/craftgui/controls/ControlText.java @@ -16,7 +16,7 @@ public class ControlText extends Control implements IControlValue { private TextJustification align; public ControlText(final IWidget parent, final Point pos, final String text) { - this(parent, new Area(pos, new Point(500, 0)), text, TextJustification.TopLeft); + this(parent, new Area(pos, new Point(500, 0)), text, TextJustification.TOP_LEFT); } public ControlText(final IWidget parent, final String text, final TextJustification align) { diff --git a/src/main/java/binnie/core/craftgui/controls/ControlTextCentered.java b/src/main/java/binnie/core/craftgui/controls/ControlTextCentered.java index 0df47912..4255f9b6 100644 --- a/src/main/java/binnie/core/craftgui/controls/ControlTextCentered.java +++ b/src/main/java/binnie/core/craftgui/controls/ControlTextCentered.java @@ -7,6 +7,6 @@ import binnie.core.craftgui.geometry.TextJustification; public class ControlTextCentered extends ControlText { public ControlTextCentered(final IWidget parent, final int y, final String text) { - super(parent, new Area(new Point(0, y), new Point(parent.size().x(), 0)), text, TextJustification.TopCenter); + super(parent, new Area(new Point(0, y), new Point(parent.size().x(), 0)), text, TextJustification.TOP_CENTER); } } diff --git a/src/main/java/binnie/core/craftgui/geometry/TextJustification.java b/src/main/java/binnie/core/craftgui/geometry/TextJustification.java index 9464869e..4ade7961 100644 --- a/src/main/java/binnie/core/craftgui/geometry/TextJustification.java +++ b/src/main/java/binnie/core/craftgui/geometry/TextJustification.java @@ -1,9 +1,9 @@ package binnie.core.craftgui.geometry; public enum TextJustification { - TopLeft(0.0f, 0.0f), - TopCenter(0.5f, 0.0f), - TopRight(1.0f, 0.0f), + TOP_LEFT(0.0f, 0.0f), + TOP_CENTER(0.5f, 0.0f), + TOP_RIGHT(1.0f, 0.0f), MIDDLE_LEFTt(0.0f, 0.5f), MiddleCenter(0.5f, 0.5f), MiddleRight(1.0f, 0.5f), diff --git a/src/main/java/binnie/core/craftgui/renderer/RenderUtil.java b/src/main/java/binnie/core/craftgui/renderer/RenderUtil.java index ab5d8fd9..23f77eea 100644 --- a/src/main/java/binnie/core/craftgui/renderer/RenderUtil.java +++ b/src/main/java/binnie/core/craftgui/renderer/RenderUtil.java @@ -123,7 +123,7 @@ public class RenderUtil { } public static void drawText(final Point pos, final String text, final int colour) { - drawText(new Area(pos, new Point(500, 500)), TextJustification.TopLeft, text, colour); + drawText(new Area(pos, new Point(500, 500)), TextJustification.TOP_LEFT, text, colour); } public static void drawText(final Area area, final TextJustification justification, final String text, final int colour) { diff --git a/src/main/java/binnie/extratrees/machines/craftgui/WindowWoodworker.java b/src/main/java/binnie/extratrees/machines/craftgui/WindowWoodworker.java index fc96f90f..64c2f437 100644 --- a/src/main/java/binnie/extratrees/machines/craftgui/WindowWoodworker.java +++ b/src/main/java/binnie/extratrees/machines/craftgui/WindowWoodworker.java @@ -55,7 +55,7 @@ public class WindowWoodworker extends Window { @SideOnly(Side.CLIENT) public void initialiseClient() { this.setTitle(Machine.getMachine(this.getInventory()).getPackage().getDisplayName()); - new ControlText(this, new Area(190, 36, 114, 10), I18N.localise("binniecore.gui.design"), TextJustification.TopCenter).setColour(4473924); + new ControlText(this, new Area(190, 36, 114, 10), I18N.localise("binniecore.gui.design"), TextJustification.TOP_CENTER).setColour(4473924); new Panel(this, 188, 48, 118, 126, MinecraftGUI.PanelType.Gray); this.textEdit = new ControlTextEdit(this, 188, 178, 118, 12); final ControlScrollableContent scroll = new ControlScrollableContent(this, 190, 50, 114, 122, 12); diff --git a/src/main/java/binnie/genetics/genetics/AlleleHelper.java b/src/main/java/binnie/genetics/genetics/AlleleHelper.java new file mode 100644 index 00000000..82adea27 --- /dev/null +++ b/src/main/java/binnie/genetics/genetics/AlleleHelper.java @@ -0,0 +1,221 @@ +package binnie.genetics.genetics; + +import java.util.Locale; + +import org.apache.commons.lang3.text.WordUtils; + +import forestry.api.core.EnumHumidity; +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.EnumTolerance; +import forestry.api.genetics.IAllele; +import forestry.core.genetics.alleles.EnumAllele; + +import binnie.botany.api.EnumAcidity; +import binnie.botany.api.EnumMoisture; +import binnie.botany.api.EnumSoilType; +import binnie.botany.genetics.EnumFlowerColor; +import binnie.core.util.I18N; + +public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper { + public static IAllele getAllele(EnumTemperature temperature) { + return getAllele(getUid(temperature)); + } + + public static IAllele getAllele(EnumHumidity humidity) { + return getAllele(getUid(humidity)); + } + + public static IAllele getAllele(EnumTolerance tolerance) { + return getAllele(getUid(tolerance)); + } + + public static IAllele getAllele(EnumAllele.Fertility fertility) { + return getAllele(getUid(fertility)); + } + + public static IAllele getAllele(EnumAllele.Territory territory) { + return getAllele(getUid(territory)); + } + + public static IAllele getAllele(EnumAllele.Lifespan lifespan) { + return getAllele(getUid(lifespan)); + } + + public static IAllele getAllele(EnumAllele.Sappiness sappiness) { + return getAllele(getUid(sappiness)); + } + + public static IAllele getAllele(EnumAllele.Speed speed) { + return getAllele(getUid(speed)); + } + + public static IAllele getAllele(EnumAllele.Flowering flowering) { + return getAllele(getUid(flowering)); + } + + public static IAllele getAllele(EnumAllele.Height height) { + return getAllele(getUid(height)); + } + + public static IAllele getAllele(EnumAllele.Maturation maturation) { + return getAllele(getUid(maturation)); + } + + public static IAllele getAllele(EnumAllele.Yield yield) { + return getAllele(getUid(yield)); + } + + public static IAllele getAllele(EnumAllele.Saplings saplings) { + return getAllele(getUid(saplings)); + } + + public static IAllele getAllele(EnumFlowerColor color) { + return color.getFlowerColorAllele(); + } + + public static IAllele getAllele(int number) { + return getAllele("forestry.i" + number + "d"); + } + + public static IAllele getAllele(boolean bool) { + if (bool) { + return getAllele("forestry.boolTrue"); + } + return getAllele("forestry.boolFalse"); + } + + public static IAllele getAllele(String uid) { + return AlleleManager.alleleRegistry.getAllele(uid); + } + + public static String toDisplay(EnumTemperature temperature) { + return AlleleManager.climateHelper.toDisplay(temperature); + } + + public static String toDisplay(EnumHumidity humidity) { + return AlleleManager.climateHelper.toDisplay(humidity); + } + + public static String toDisplay(EnumMoisture moisture) { + return I18N.localise("botany.moisture." + moisture.getName()); + } + + public static String toDisplay(EnumAcidity acidity) { + return I18N.localise("botany.ph." + acidity.getName()); + } + + public static String toDisplay(EnumSoilType soilType) { + return I18N.localise("botany.soil." + soilType.getName()); + } + + public static String toDisplay(EnumTolerance tolerance) { + return toAlleleDisplay("tolerance", tolerance.name()); + } + + public static String toDisplay(EnumAllele.Flowering flowering) { + if (flowering == EnumAllele.Flowering.AVERAGE) { + return toAlleleDisplay("flowering", "normal"); + } + return toAlleleDisplay(null, flowering.name()); + } + + public static String toDisplay(EnumAllele.Speed speed) { + return toAlleleDisplay(null, speed.name()); + } + + public static String toDisplay(EnumAllele.Lifespan lifespan) { + return toAlleleDisplay("lifespan", lifespan.name()); + } + + public static String getUid(EnumAllele.Fertility fertility) { + return getUid("fertility", fertility.name()); + } + + public static String getUid(EnumAllele.Lifespan lifespan) { + return getUid("lifespan", lifespan.name()); + } + + public static String getUid(EnumAllele.Sappiness sappiness) { + return getUid("sappiness", sappiness.name()); + } + + private static String getUid(EnumTemperature temperature) { + return getUid("temperature", temperature.name()); + } + + private static String getUid(EnumHumidity humidity) { + return getUid("humidity", humidity.name()); + } + + public static String getUid(EnumAllele.Saplings saplings) { + if (saplings == EnumAllele.Saplings.AVERAGE) { + return getUid("saplings", "Default"); + } + if (saplings == EnumAllele.Saplings.HIGH) { + return getUid("saplings", "Double"); + } + if (saplings == EnumAllele.Saplings.HIGHER) { + return getUid("saplings", "Triple"); + } + return getUid("saplings", saplings.name()); + } + + public static String getUid(EnumAllele.Height height) { + if (height == EnumAllele.Height.AVERAGE) { + return getUid("height", "Max10", false); + } + return getUid("height", height.name()); + } + + public static String getUid(EnumAllele.Maturation maturation) { + return getUid("maturation", maturation.name()); + } + + public static String getUid(EnumAllele.Territory territory) { + return getUid("territory", territory.name()); + } + + public static String getUid(EnumAllele.Yield yield) { + if (yield == EnumAllele.Yield.AVERAGE) { + return getUid("yield", "Default", false); + } + return getUid("yield", yield.name()); + } + + public static String getUid(EnumAllele.Fireproof fireproof) { + return getUid("bool", fireproof.name()); + } + + public static String getUid(EnumAllele.Flowering flowering) { + return getUid("flowering", flowering.name()); + } + + public static String getUid(EnumTolerance tolerance) { + return getUid("tolerance", tolerance.name()); + } + + public static String getUid(EnumAllele.Speed speed) { + return getUid("speed", speed.name()); + } + + protected static String getUid(String key, String valueName) { + return getUid(key, valueName, true); + } + + private static String getUid(String key, String valueName, boolean needCapitalize) { + if (needCapitalize) { + valueName = WordUtils.capitalize(valueName.toLowerCase(Locale.ENGLISH)); + } + valueName = valueName.replace("_", ""); + return "forestry." + key + valueName; + } + + private static String toAlleleDisplay(String key, String valueName) { + String name = valueName.toLowerCase().replace("_", ""); + if (key == null) { + return I18N.localise("forestry.allele." + name); + } + return I18N.localise("forestry.allele." + key + "." + name); + } +} diff --git a/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java b/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java index c005014c..a6066fde 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java @@ -44,7 +44,7 @@ public class AnalystPageBehaviour extends ControlAnalystPage { if (!effect.getUID().contains("None")) { final String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc"); final String loc = effectDesc.equals("") ? ("Effect: " + effect.getName()) : effectDesc; - new ControlText(this, new Area(4, y, this.width() - 8, 0), loc, TextJustification.TopCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 0), loc, TextJustification.TOP_CENTER).setColour(this.getColour()); y += CraftGUI.render.textHeight(loc, this.width() - 8) + 1; new ControlTextCentered(this, y, "§oWithin " + t.getX() / 2 + " blocks").setColour(this.getColour()); y += 22; @@ -64,7 +64,7 @@ public class AnalystPageBehaviour extends ControlAnalystPage { if (!effect2.getUID().contains("None")) { final String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc"); final String loc2 = effectDesc2.equals("") ? ("Effect: " + effect2.getName()) : effectDesc2; - new ControlText(this, new Area(4, y, this.width() - 8, 0), loc2, TextJustification.TopCenter).setColour(this.getColour()); + new ControlText(this, new Area(4, y, this.width() - 8, 0), loc2, TextJustification.TOP_CENTER).setColour(this.getColour()); y += CraftGUI.render.textHeight(loc2, this.width() - 8) + 1; y += 22; } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageDescription.java b/src/main/java/binnie/genetics/gui/AnalystPageDescription.java index cb3f95b0..7a2cfed8 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageDescription.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageDescription.java @@ -64,7 +64,7 @@ public class AnalystPageDescription extends ControlAnalystPage { y += (int) (3.0f + CraftGUI.render.textHeight(discovered, this.width())); new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.desc.complexity") + ": " + species.getComplexity()).setColour(this.getColour()); y += 26; - final ControlText descText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descBody + "§r", TextJustification.TopCenter); + final ControlText descText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); final IWidget signatureText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descSig + "§r", TextJustification.BottomRight); descText.setColour(this.getColour()); signatureText.setColour(this.getColour()); diff --git a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java index 1b56574d..af72022b 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java @@ -56,8 +56,8 @@ public class AnalystPageGenome extends ControlAnalystPage { final IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo); final String alleleName = system.getAlleleName(chromo, allele); final int height = CraftGUI.render.textHeight(alleleName, this.width() / 2 - 2); - new ControlText(scaled, new Area(0, y + (height - 9) / 2, this.width() / 2 - 2, 0), system.getChromosomeShortName(chromo) + " :", TextJustification.TopRight).setColour(this.getColour()); - new ControlText(scaled, new Area(this.width() / 2 + 2, y, this.width() / 2 - 2, 0), alleleName, TextJustification.TopLeft).setColour(this.getColour()); + new ControlText(scaled, new Area(0, y + (height - 9) / 2, this.width() / 2 - 2, 0), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT).setColour(this.getColour()); + new ControlText(scaled, new Area(this.width() / 2 + 2, y, this.width() / 2 - 2, 0), alleleName, TextJustification.TOP_LEFT).setColour(this.getColour()); y += 3 + height; } this.setSize(new Point(this.width(), y + 8)); diff --git a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java index 39b68c6e..03a49f66 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java +++ b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java @@ -4,8 +4,10 @@ import net.minecraft.util.math.Vec3i; import forestry.api.apiculture.IBee; import forestry.api.apiculture.IBeeGenome; +import forestry.api.genetics.EnumTolerance; import forestry.api.genetics.IAllele; import forestry.api.genetics.IAlleleSpecies; +import forestry.core.genetics.alleles.EnumAllele; import binnie.Binnie; import binnie.core.craftgui.IWidget; @@ -15,126 +17,128 @@ import binnie.core.craftgui.database.DatabaseTab; import binnie.core.craftgui.database.PageSpecies; import binnie.core.craftgui.geometry.Area; import binnie.core.craftgui.geometry.TextJustification; +import binnie.core.util.I18N; +import binnie.genetics.genetics.AlleleHelper; public class PageSpeciesGenome extends PageSpecies { - ControlText pageSpeciesGenome_Title; - ControlText pageSpeciesGenome_SpeedText; - ControlText pageSpeciesGenome_LifespanText; - ControlText pageSpeciesGenome_FertilityText; - ControlText pageSpeciesGenome_FloweringText; - ControlText pageSpeciesGenome_TerritoryText; - ControlText pageSpeciesGenome_NocturnalText; - ControlText pageSpeciesGenome_CaveDwellingText; - ControlText pageSpeciesGenome_TolerantFlyerText; - ControlText pageSpeciesGenome_FlowerText; - ControlText pageSpeciesGenome_EffectText; + ControlText title; + ControlText speedText; + ControlText lifespanText; + ControlText fertilityText; + ControlText floweringText; + ControlText territoryText; + ControlText nocturnalText; + ControlText caveDwellingText; + ControlText tolerantFlyerText; + ControlText flowerText; + ControlText effectText; public PageSpeciesGenome(final IWidget parent, final DatabaseTab tab) { super(parent, tab); - this.pageSpeciesGenome_Title = new ControlTextCentered(this, 8, "Genome"); - new ControlText(this, new Area(0, 32, 68, 30), "Speed:", TextJustification.TopRight); - new ControlText(this, new Area(0, 44, 68, 30), "Lifespan:", TextJustification.TopRight); - new ControlText(this, new Area(0, 56, 68, 30), "Fertility:", TextJustification.TopRight); - new ControlText(this, new Area(0, 68, 68, 30), "Flowering:", TextJustification.TopRight); - new ControlText(this, new Area(0, 80, 68, 30), "Territory:", TextJustification.TopRight); - new ControlText(this, new Area(0, 97, 68, 30), "Behavior:", TextJustification.TopRight); - new ControlText(this, new Area(0, 109, 68, 30), "Sunlight:", TextJustification.TopRight); - new ControlText(this, new Area(0, 121, 68, 30), "Rain:", TextJustification.TopRight); - new ControlText(this, new Area(0, 138, 68, 30), "Flower:", TextJustification.TopRight); - new ControlText(this, new Area(0, 155, 68, 30), "Effect:", TextJustification.TopRight); + title = new ControlTextCentered(this, 8, I18N.localise("extrabees.gui.database.tab.species.genome")); + new ControlText(this, new Area(0, 32, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.speed"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 44, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.lifespan"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 56, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.fertility"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 68, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.flowering"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 80, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.territory"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 97, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.behavior"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 109, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.sunlight"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 121, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.rain"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 138, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.flower"), TextJustification.TOP_RIGHT); + new ControlText(this, new Area(0, 155, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.effect"), TextJustification.TOP_RIGHT); final int x = 72; - this.pageSpeciesGenome_SpeedText = new ControlText(this, new Area(x, 32, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_LifespanText = new ControlText(this, new Area(x, 44, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_FertilityText = new ControlText(this, new Area(x, 56, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_FloweringText = new ControlText(this, new Area(x, 68, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_TerritoryText = new ControlText(this, new Area(x, 80, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_NocturnalText = new ControlText(this, new Area(x, 97, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_CaveDwellingText = new ControlText(this, new Area(x, 109, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_TolerantFlyerText = new ControlText(this, new Area(x, 121, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_FlowerText = new ControlText(this, new Area(x, 138, 72, 30), "", TextJustification.TopLeft); - this.pageSpeciesGenome_EffectText = new ControlText(this, new Area(x, 155, 72, 30), "", TextJustification.TopLeft); + this.speedText = new ControlText(this, new Area(x, 32, 72, 30), "", TextJustification.TOP_LEFT); + this.lifespanText = new ControlText(this, new Area(x, 44, 72, 30), "", TextJustification.TOP_LEFT); + this.fertilityText = new ControlText(this, new Area(x, 56, 72, 30), "", TextJustification.TOP_LEFT); + this.floweringText = new ControlText(this, new Area(x, 68, 72, 30), "", TextJustification.TOP_LEFT); + this.territoryText = new ControlText(this, new Area(x, 80, 72, 30), "", TextJustification.TOP_LEFT); + this.nocturnalText = new ControlText(this, new Area(x, 97, 72, 30), "", TextJustification.TOP_LEFT); + this.caveDwellingText = new ControlText(this, new Area(x, 109, 72, 30), "", TextJustification.TOP_LEFT); + this.tolerantFlyerText = new ControlText(this, new Area(x, 121, 72, 30), "", TextJustification.TOP_LEFT); + this.flowerText = new ControlText(this, new Area(x, 138, 72, 30), "", TextJustification.TOP_LEFT); + this.effectText = new ControlText(this, new Area(x, 155, 72, 30), "", TextJustification.TOP_LEFT); } public static String rateFlowering(final int flowering) { if (flowering >= 99) { - return "Maximum"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.MAXIMUM); } if (flowering >= 35) { - return "Fastest"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.FASTEST); } if (flowering >= 30) { - return "Faster"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.FASTER); } if (flowering >= 25) { - return "Fast"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.FAST); } if (flowering >= 20) { - return "Normal"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.AVERAGE); } if (flowering >= 15) { - return "Slow"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.SLOW); } if (flowering >= 10) { - return "Slower"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.SLOWER); } - return "Slowest"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.SLOWEST); } public static String rateSpeed(final float speed) { if (speed >= 1.7f) { - return "Fastest"; + return AlleleHelper.toDisplay(EnumAllele.Speed.FASTEST); } if (speed >= 1.4f) { - return "Faster"; + return AlleleHelper.toDisplay(EnumAllele.Speed.FASTER); } if (speed >= 1.2f) { - return "Fast"; + return AlleleHelper.toDisplay(EnumAllele.Speed.FAST); } if (speed >= 1.0f) { - return "Normal"; + return AlleleHelper.toDisplay(EnumAllele.Speed.NORMAL); } if (speed >= 0.8f) { - return "Slow"; + return AlleleHelper.toDisplay(EnumAllele.Speed.SLOW); } if (speed >= 0.6f) { - return "Slower"; + return AlleleHelper.toDisplay(EnumAllele.Speed.SLOWER); } - return "Slowest"; + return AlleleHelper.toDisplay(EnumAllele.Speed.SLOWEST); } public static String rateLifespan(final int life) { if (life >= 70) { - return "Longest"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.LONGEST); } if (life >= 60) { - return "Longer"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.LONGER); } if (life >= 50) { - return "Long"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.LONG); } if (life >= 45) { - return "Elongated"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.ELONGATED); } if (life >= 40) { - return "Normal"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.NORMAL); } if (life >= 35) { - return "Shortened"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORTENED); } if (life >= 30) { - return "Short"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORT); } if (life >= 20) { - return "Shorter"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORTER); } - return "Shortest"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORTEST); } public static String tolerated(final boolean t) { if (t) { - return "Tolerated"; + return I18N.localise("extrabees.gui.database.tab.species.genome.tolerated"); } - return "Not Tolerated"; + return AlleleHelper.toDisplay(EnumTolerance.NONE); } @Override @@ -143,32 +147,32 @@ public class PageSpeciesGenome extends PageSpecies { if (template != null) { final IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); final IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); - this.pageSpeciesGenome_SpeedText.setValue(rateSpeed(genome.getSpeed())); - this.pageSpeciesGenome_LifespanText.setValue(rateLifespan(genome.getLifespan())); - this.pageSpeciesGenome_FertilityText.setValue(genome.getFertility() + " children"); - this.pageSpeciesGenome_FloweringText.setValue(rateFlowering(genome.getFlowering())); + this.speedText.setValue(rateSpeed(genome.getSpeed())); + this.lifespanText.setValue(rateLifespan(genome.getLifespan())); + this.fertilityText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.children", genome.getFertility())); + this.floweringText.setValue(rateFlowering(genome.getFlowering())); final Vec3i area = genome.getTerritory(); - this.pageSpeciesGenome_TerritoryText.setValue(area.getX() + "x" + area.getY() + "x" + area.getZ()); - String behavior = "Daytime"; + this.territoryText.setValue(area.getX() + "x" + area.getY() + "x" + area.getZ()); + String behavior = I18N.localise("extrabees.gui.database.tab.species.genome.daytime"); if (genome.getPrimary().isNocturnal()) { - behavior = "Nighttime"; + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.nighttime"); } if (genome.getNeverSleeps()) { - behavior = "All Day"; + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.allDay"); } - this.pageSpeciesGenome_NocturnalText.setValue(behavior); + this.nocturnalText.setValue(behavior); if (genome.getCaveDwelling()) { - this.pageSpeciesGenome_CaveDwellingText.setValue("Not Needed"); + this.caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.notNeeded")); } else { - this.pageSpeciesGenome_CaveDwellingText.setValue("Required"); + this.caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.required")); } - this.pageSpeciesGenome_TolerantFlyerText.setValue(tolerated(genome.getToleratesRain())); + this.tolerantFlyerText.setValue(tolerated(genome.getToleratesRain())); if (genome.getFlowerProvider() != null) { - this.pageSpeciesGenome_FlowerText.setValue(genome.getFlowerProvider().getDescription()); + this.flowerText.setValue(genome.getFlowerProvider().getDescription()); } else { - this.pageSpeciesGenome_FlowerText.setValue("None"); + this.flowerText.setValue(AlleleHelper.toDisplay(EnumTolerance.NONE)); } - this.pageSpeciesGenome_EffectText.setValue(genome.getEffect().getName()); + this.effectText.setValue(genome.getEffect().getName()); } } } diff --git a/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java b/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java index cde60f6b..27e0da36 100644 --- a/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java +++ b/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java @@ -64,14 +64,14 @@ public class ControlPunnett extends Control { for (final IAllele allele3 : alleles) { text.append(allele3.getName()).append(": ").append(25.0f / alleles.size()).append("%\n"); } - new ControlText(this, new Area(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text.toString(), TextJustification.TopCenter).setColour(11184810); + new ControlText(this, new Area(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text.toString(), TextJustification.TOP_CENTER).setColour(11184810); ++y; } ++x; } - new ControlText(this, new Area(ControlPunnett.boxWidth, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TopCenter).setColour(11184810); - new ControlText(this, new Area(ControlPunnett.boxWidth * 2, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TopCenter).setColour(11184810); - new ControlText(this, new Area(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColour(11184810); - new ControlText(this, new Area(0, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColour(11184810); + new ControlText(this, new Area(ControlPunnett.boxWidth, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TOP_CENTER).setColour(11184810); + new ControlText(this, new Area(ControlPunnett.boxWidth * 2, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TOP_CENTER).setColour(11184810); + new ControlText(this, new Area(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColour(11184810); + new ControlText(this, new Area(0, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColour(11184810); } } diff --git a/src/main/java/binnie/genetics/machine/GeneticsErrorCode.java b/src/main/java/binnie/genetics/machine/GeneticsErrorCode.java index b6d45a68..cb2c946a 100644 --- a/src/main/java/binnie/genetics/machine/GeneticsErrorCode.java +++ b/src/main/java/binnie/genetics/machine/GeneticsErrorCode.java @@ -10,6 +10,13 @@ import binnie.core.util.I18N; public enum GeneticsErrorCode implements IErrorStateDefinition { NO_OWNER("no.owner"), NO_INDIVIDUAL("no.individual", CoreErrorCode.NO_ITEM), + NO_SERUM("no.serum", CoreErrorCode.NO_ITEM), + INVALID_SERUM("invalid.serum", CoreErrorCode.INVALID_ITEM), + INVALID_SERUM_MISMATCH("invalid.serum.mismatch", INVALID_SERUM), + INVALID_SERUM_NO("invalid.serum.no.genes", INVALID_SERUM), + DEFUNCT_SERUM("defunct.serum", CoreErrorCode.INVALID_ITEM), + EMPTY_SERUM("empty.serum", CoreErrorCode.INVALID_ITEM), + NO_ENZYME("no.enzyme", CoreErrorCode.NO_ITEM), //Acclimatiser ACCLIMATISER_NO_ITEM("acclimatiser.no.item", CoreErrorCode.NO_ITEM), ACCLIMATISER_CAN_NOT_WORK(".acclimatiser.can.not.acclimatise", CoreErrorCode.INVALID_ITEM), @@ -21,7 +28,23 @@ public enum GeneticsErrorCode implements IErrorStateDefinition { GENEPOOL_INSUFFICIENT_ETHANOL("genepool.insufficient.ethanol", CoreErrorCode.INSUFFICIENT_LIQUID), GENEPOOL_INSUFFICIENT_ENZYME("genepool.insufficient.enzyme", CoreErrorCode.NO_ITEM), //Incubator - INCUBATOR_INSUFFICIENT_LIQUID("incubator.insufficient.liquid"); + INCUBATOR_INSUFFICIENT_LIQUID("incubator.insufficient.liquid", CoreErrorCode.INSUFFICIENT_LIQUID), + //Inoculator + INOCULATOR_INSUFFICIENT_VECTOR("insufficient.vector", CoreErrorCode.INSUFFICIENT_LIQUID), + //Isolator + ISOLATOR_INSUFFICIENT_ETHANOL("isolator.insufficient.ethanol", CoreErrorCode.INSUFFICIENT_LIQUID), + ISOLATOR_NO_ROOM("isolator.no.room", CoreErrorCode.NO_SPACE), + ISOLATOR_NO_EMPTY_SEQUENCER("isolator.no.empty.sequencer", CoreErrorCode.NO_ITEM), + //Polymeriser + POLYMERISER_NO_ITEM("polymeriser.no.item", CoreErrorCode.NO_ITEM), + POLYMERISER_ITEM_FILLED("polymeriser.item.filled", CoreErrorCode.INVALID_ITEM), + POLYMERISER_INSUFFICIENT_DNA("polymeriser.insufficient.dna", CoreErrorCode.INSUFFICIENT_LIQUID), + POLYMERISER_INSUFFICIENT_BACTERIA("polymeriser.insufficient.bacteria", CoreErrorCode.INSUFFICIENT_LIQUID), + //Sequencer + SEQUENCER_INSUFFICIENT_DYE("sequencer.insufficient.dye", CoreErrorCode.NO_ITEM), + SEQUENCER_NO_SPACE("sequencer.no.space", CoreErrorCode.NO_SPACE), + SEQUENCER_NO_DNA("sequencer.no.dna", CoreErrorCode.NO_ITEM) + ; String name; @Nullable diff --git a/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java b/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java index e8f7affa..9596e72e 100644 --- a/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java +++ b/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java @@ -49,7 +49,7 @@ public class WindowAcclimatiser extends WindowMachine { @Override public String getTitle() { - return I18N.localise("genetics.lab_machine.acclimatiser"); + return I18N.localise("genetics.machine.lab_machine.acclimatiser"); } @Override diff --git a/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java b/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java index 81c3a53a..6915ec91 100644 --- a/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java +++ b/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java @@ -63,7 +63,7 @@ public class WindowAnalyser extends WindowMachine { @Override public String getTitle() { - return I18N.localise("genetics.lab_machine.analyser"); + return I18N.localise("genetics.machine.lab_machine.analyser"); } @Override diff --git a/src/main/java/binnie/genetics/machine/inoculator/InoculatorLogic.java b/src/main/java/binnie/genetics/machine/inoculator/InoculatorLogic.java index 5eca6b25..6462e54b 100644 --- a/src/main/java/binnie/genetics/machine/inoculator/InoculatorLogic.java +++ b/src/main/java/binnie/genetics/machine/inoculator/InoculatorLogic.java @@ -21,6 +21,7 @@ import binnie.core.util.I18N; import binnie.genetics.api.IGene; import binnie.genetics.api.IItemSerum; import binnie.genetics.genetics.Engineering; +import binnie.genetics.machine.GeneticsErrorCode; public class InoculatorLogic extends ComponentProcess implements IProcess { public static final int PROCESS_BASE_LENGTH = 12000; @@ -85,19 +86,19 @@ public class InoculatorLogic extends ComponentProcess implements IProcess { ItemStack stack = this.getUtil().getStack(0); int n = getNumberOfGenes(stack); if (n > 1) { - return String.format(I18N.localise("genetics.genetics.machine.machine.inoculator.tooltips.logic.genes"), Integer.valueOf(n).toString()); + return String.format(I18N.localise("genetics.machine.machine.inoculator.tooltips.logic.genes"), Integer.valueOf(n).toString()); } else { - return I18N.localise("genetics.genetics.machine.machine.inoculator.tooltips.logic.gene"); + return I18N.localise("genetics.machine.machine.inoculator.tooltips.logic.gene"); } } @Override public ErrorState canWork() { if (this.getUtil().isSlotEmpty(Inoculator.SLOT_TARGET)) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.machine.inoculator.errors.no.individual.desc"), Inoculator.SLOT_TARGET); + return new ErrorState(GeneticsErrorCode.NO_INDIVIDUAL, Inoculator.SLOT_TARGET); } if (this.getUtil().isSlotEmpty(Inoculator.SLOT_SERUM_VIAL)) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.errors.no.serum.desc"), Inoculator.SLOT_SERUM_VIAL); + return new ErrorState(GeneticsErrorCode.NO_SERUM, Inoculator.SLOT_SERUM_VIAL); } final ErrorState state = this.isValidSerum(); if (state != null) { @@ -105,10 +106,10 @@ public class InoculatorLogic extends ComponentProcess implements IProcess { } ItemStack serum = this.getUtil().getStack(Inoculator.SLOT_SERUM_VIAL); if (!serum.isEmpty() && Engineering.getCharges(serum) == 0) { - return new ErrorState(I18N.localise("genetics.machine.errors.empty.serum.desc"), I18N.localise("genetics.machine.errors.empty.serum.info")); + return new ErrorState(GeneticsErrorCode.EMPTY_SERUM, Inoculator.SLOT_SERUM_VIAL); } if (getUtil().isTankEmpty(Inoculator.TANK_VEKTOR)) { - return new ErrorState.InsufficientLiquid(I18N.localise("genetics.machine.machine.inoculator.errors.insufficient.vector"), Inoculator.TANK_VEKTOR); + return new ErrorState(GeneticsErrorCode.INOCULATOR_INSUFFICIENT_VECTOR, Inoculator.TANK_VEKTOR); } return super.canWork(); } @@ -119,10 +120,10 @@ public class InoculatorLogic extends ComponentProcess implements IProcess { final ItemStack target = this.getUtil().getStack(Inoculator.SLOT_TARGET); final IGene[] genes = Engineering.getGenes(serum); if (genes.length == 0) { - return new ErrorState(I18N.localise("genetics.machine.errors.invalid.serum.desc"), I18N.localise("genetics.machine.errors.invalid.serum.no.genes.info")); + return new ErrorState(GeneticsErrorCode.INVALID_SERUM_NO); } if (!genes[0].getSpeciesRoot().isMember(target)) { - return new ErrorState(I18N.localise("genetics.machine.errors.invalid.serum.desc"), I18N.localise("genetics.machine.errors.invalid.serum.mismatch.info")); + return new ErrorState(GeneticsErrorCode.INVALID_SERUM_MISMATCH); } final IIndividual individual = genes[0].getSpeciesRoot().getMember(target); if (individual != null) { @@ -135,7 +136,7 @@ public class InoculatorLogic extends ComponentProcess implements IProcess { } } } - return new ErrorState(I18N.localise("genetics.genetics.machine.errors.defunct.serum.desc"), I18N.localise("genetics.genetics.machine.errors.defunct.serum.info")); + return new ErrorState(GeneticsErrorCode.DEFUNCT_SERUM); } @Override diff --git a/src/main/java/binnie/genetics/machine/isolator/IsolatorLogic.java b/src/main/java/binnie/genetics/machine/isolator/IsolatorLogic.java index 5a055f0e..1ab454f3 100644 --- a/src/main/java/binnie/genetics/machine/isolator/IsolatorLogic.java +++ b/src/main/java/binnie/genetics/machine/isolator/IsolatorLogic.java @@ -18,8 +18,8 @@ import binnie.core.machines.inventory.IChargedSlots; import binnie.core.machines.power.ComponentProcessSetCost; import binnie.core.machines.power.ErrorState; import binnie.core.machines.power.IProcess; -import binnie.core.util.I18N; import binnie.genetics.item.ItemSequence; +import binnie.genetics.machine.GeneticsErrorCode; public class IsolatorLogic extends ComponentProcessSetCost implements IProcess { public static final float ENZYME_PER_PROCESS = 0.5f; @@ -33,13 +33,13 @@ public class IsolatorLogic extends ComponentProcessSetCost implements IProcess { @Override public ErrorState canWork() { if (this.getUtil().isSlotEmpty(Isolator.SLOT_TARGET)) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.machine.isolator.errors.no.individual.desc"), Isolator.SLOT_TARGET); + return new ErrorState(GeneticsErrorCode.NO_INDIVIDUAL, Isolator.SLOT_TARGET); } if (!this.getUtil().isSlotEmpty(Isolator.SLOT_RESULUT)) { - return new ErrorState.NoSpace(I18N.localise("genetics.machine.machine.isolator.errors.no.room.desc"), Isolator.SLOT_FINISHED); + return new ErrorState(GeneticsErrorCode.ISOLATOR_NO_ROOM, Isolator.SLOT_FINISHED); } if (this.getUtil().isSlotEmpty(Isolator.SLOT_SEQUENCER_VIAL)) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.machine.isolator.errors.no.empty.sequencer.desc"), Isolator.SLOT_SEQUENCER_VIAL); + return new ErrorState(GeneticsErrorCode.ISOLATOR_NO_EMPTY_SEQUENCER, Isolator.SLOT_SEQUENCER_VIAL); } return super.canWork(); } @@ -47,10 +47,10 @@ public class IsolatorLogic extends ComponentProcessSetCost implements IProcess { @Override public ErrorState canProgress() { if (!this.getUtil().liquidInTank(Isolator.TANK_ETHANOL, ETHANOL_PER_PROCESS)) { - return new ErrorState.InsufficientLiquid(I18N.localise("genetics.machine.machine.isolator.errors.insufficient.ethanol.desc"), Isolator.TANK_ETHANOL); + return new ErrorState(GeneticsErrorCode.ISOLATOR_INSUFFICIENT_ETHANOL, Isolator.TANK_ETHANOL); } if (this.getUtil().getSlotCharge(Isolator.SLOT_ENZYME) == 0.0f) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.errors.no.enzyme.desc"), Isolator.SLOT_ENZYME); + return new ErrorState(GeneticsErrorCode.NO_ENZYME, Isolator.SLOT_ENZYME); } return super.canProgress(); } diff --git a/src/main/java/binnie/genetics/machine/polymeriser/PolymeriserLogic.java b/src/main/java/binnie/genetics/machine/polymeriser/PolymeriserLogic.java index 06919195..0c78104a 100644 --- a/src/main/java/binnie/genetics/machine/polymeriser/PolymeriserLogic.java +++ b/src/main/java/binnie/genetics/machine/polymeriser/PolymeriserLogic.java @@ -10,6 +10,7 @@ import binnie.core.machines.power.ErrorState; import binnie.core.machines.power.IProcess; import binnie.core.util.I18N; import binnie.genetics.genetics.Engineering; +import binnie.genetics.machine.GeneticsErrorCode; public class PolymeriserLogic extends ComponentProcessSetCost implements IProcess { private static float chargePerProcess = 0.4f; @@ -86,10 +87,10 @@ public class PolymeriserLogic extends ComponentProcessSetCost implements IProces public ErrorState canWork() { ItemStack serumStack = this.getUtil().getStack(Polymeriser.SLOT_SERUM); if (serumStack.isEmpty()) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.machine.polymeriser.errors.item.no"), Polymeriser.SLOT_SERUM); + return new ErrorState(GeneticsErrorCode.POLYMERISER_NO_ITEM, Polymeriser.SLOT_SERUM); } if (!serumStack.isItemDamaged()) { - return new ErrorState.InvalidItem(I18N.localise("genetics.machine.machine.polymeriser.errors.item.filled"), Polymeriser.SLOT_SERUM); + return new ErrorState(GeneticsErrorCode.POLYMERISER_ITEM_FILLED, Polymeriser.SLOT_SERUM); } return super.canWork(); } @@ -97,10 +98,10 @@ public class PolymeriserLogic extends ComponentProcessSetCost implements IProces @Override public ErrorState canProgress() { if (this.getUtil().getFluid(Polymeriser.TANK_BACTERIA) == null) { - return new ErrorState.InsufficientLiquid(I18N.localise("genetics.machine.machine.polymeriser.errors.insufficient.bacteria"), Polymeriser.TANK_BACTERIA); + return new ErrorState(GeneticsErrorCode.POLYMERISER_INSUFFICIENT_BACTERIA, Polymeriser.TANK_BACTERIA); } if (this.getUtil().getFluid(Polymeriser.TANK_DNA) == null) { - return new ErrorState.InsufficientLiquid(I18N.localise("genetics.machine.machine.polymeriser.errors.insufficient.dna"), Polymeriser.TANK_DNA); + return new ErrorState(GeneticsErrorCode.POLYMERISER_INSUFFICIENT_DNA, Polymeriser.TANK_DNA); } return super.canProgress(); } diff --git a/src/main/java/binnie/genetics/machine/sequencer/SequencerLogic.java b/src/main/java/binnie/genetics/machine/sequencer/SequencerLogic.java index 9b5bb89e..125e456f 100644 --- a/src/main/java/binnie/genetics/machine/sequencer/SequencerLogic.java +++ b/src/main/java/binnie/genetics/machine/sequencer/SequencerLogic.java @@ -8,10 +8,10 @@ import binnie.core.machines.Machine; import binnie.core.machines.power.ComponentProcess; import binnie.core.machines.power.ErrorState; import binnie.core.machines.power.IProcess; -import binnie.core.util.I18N; import binnie.genetics.genetics.GeneTracker; import binnie.genetics.genetics.SequencerItem; import binnie.genetics.item.GeneticsItems; +import binnie.genetics.machine.GeneticsErrorCode; public class SequencerLogic extends ComponentProcess implements IProcess { public SequencerLogic(final Machine machine) { @@ -40,7 +40,7 @@ public class SequencerLogic extends ComponentProcess implements IProcess { @Override public ErrorState canWork() { if (this.getUtil().isSlotEmpty(Sequencer.SLOT_TARGET)) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.machine.sequencer.errors.no.dna"), 5); + return new ErrorState(GeneticsErrorCode.SEQUENCER_NO_DNA, 5); } return super.canWork(); } @@ -48,14 +48,14 @@ public class SequencerLogic extends ComponentProcess implements IProcess { @Override public ErrorState canProgress() { if (this.getMachine().getOwner() == null) { - return new ErrorState(I18N.localise("genetics.machine.errors.no.owner.desc"), I18N.localise("genetics.machine.errors.no.owner.info")); + return new ErrorState(GeneticsErrorCode.NO_OWNER); } if (this.getUtil().getSlotCharge(Sequencer.SLOT_DYE) == 0.0f) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.machine.sequencer.errors.insufficient.dye"), Sequencer.SLOT_DYE); + return new ErrorState(GeneticsErrorCode.SEQUENCER_INSUFFICIENT_DYE, Sequencer.SLOT_DYE); } ItemStack stackDone = this.getUtil().getStack(Sequencer.SLOT_DONE); if (!stackDone.isEmpty() && stackDone.getCount() >= 64) { - return new ErrorState.NoSpace(I18N.localise("genetics.machine.machine.sequencer.errors.no.space"), new int[]{Sequencer.SLOT_DONE}); + return new ErrorState(GeneticsErrorCode.SEQUENCER_NO_SPACE, new int[]{Sequencer.SLOT_DONE}); } return super.canProgress(); } diff --git a/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java b/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java index 66102ed8..2c27ffc8 100644 --- a/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java +++ b/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java @@ -42,7 +42,7 @@ public class PackageSplicer extends AdvGeneticMachine.PackageAdvGeneticBase impl @Override public String getTooltip() { - return I18N.localise("genetics.machine.advMachine.splicer.tooltips.slots.serum"); + return I18N.localise("genetics.machine.adv_machine.splicer.tooltips.slots.serum"); } }; slotSerumVial.setValidator(serumValid); diff --git a/src/main/java/binnie/genetics/machine/splicer/SplicerLogic.java b/src/main/java/binnie/genetics/machine/splicer/SplicerLogic.java index 0902f47b..1063f91b 100644 --- a/src/main/java/binnie/genetics/machine/splicer/SplicerLogic.java +++ b/src/main/java/binnie/genetics/machine/splicer/SplicerLogic.java @@ -15,10 +15,10 @@ import binnie.core.machines.Machine; import binnie.core.machines.power.ComponentProcess; import binnie.core.machines.power.ErrorState; import binnie.core.machines.power.IProcess; -import binnie.core.util.I18N; import binnie.genetics.api.IGene; import binnie.genetics.api.IItemSerum; import binnie.genetics.genetics.Engineering; +import binnie.genetics.machine.GeneticsErrorCode; public class SplicerLogic extends ComponentProcess implements IProcess { public static int PROCESS_ENERGY = 12000000; @@ -108,12 +108,12 @@ public class SplicerLogic extends ComponentProcess implements IProcess { @Override public ErrorState canWork() { if (this.getUtil().isSlotEmpty(Splicer.SLOT_TARGET)) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.advMachine.splicer.errors.no.individual.desc"), Splicer.SLOT_TARGET); + return new ErrorState(GeneticsErrorCode.NO_INDIVIDUAL, Splicer.SLOT_TARGET); } ItemStack serum = this.getUtil().getStack(Splicer.SLOT_SERUM_VIAL); if (serum.isEmpty()) { - return new ErrorState.NoItem(I18N.localise("genetics.machine.errors.no.serum.desc"), Splicer.SLOT_SERUM_VIAL); + return new ErrorState(GeneticsErrorCode.NO_SERUM, Splicer.SLOT_SERUM_VIAL); } final ErrorState state = this.isValidSerum(); @@ -122,7 +122,7 @@ public class SplicerLogic extends ComponentProcess implements IProcess { } if (Engineering.getCharges(serum) == 0) { - return new ErrorState(I18N.localise("genetics.machine.errors.empty.serum.desc"), I18N.localise("genetics.machine.errors.empty.serum.info")); + return new ErrorState(GeneticsErrorCode.EMPTY_SERUM); } return super.canWork(); } @@ -136,10 +136,10 @@ public class SplicerLogic extends ComponentProcess implements IProcess { final ItemStack target = this.getUtil().getStack(Splicer.SLOT_TARGET); final IGene[] genes = Engineering.getGenes(serum); if (genes.length == 0) { - return new ErrorState(I18N.localise("genetics.machine.errors.invalid.serum.desc"), I18N.localise("genetics.machine.errors.invalid.serum.no.genes.info")); + return new ErrorState(GeneticsErrorCode.INVALID_SERUM_NO); } if (!genes[0].getSpeciesRoot().isMember(target)) { - return new ErrorState(I18N.localise("genetics.machine.errors.invalid.serum.desc"), I18N.localise("genetics.machine.errors.invalid.serum.mismatch.info")); + return new ErrorState(GeneticsErrorCode.INVALID_SERUM_MISMATCH); } final IIndividual individual = genes[0].getSpeciesRoot().getMember(target); boolean hasAll = true; @@ -151,7 +151,7 @@ public class SplicerLogic extends ComponentProcess implements IProcess { } } if (hasAll) { - return new ErrorState(I18N.localise("genetics.genetics.machine.errors.defunct.serum.desc"), I18N.localise("genetics.machine.errors.defunct.serum.info")); + return new ErrorState(GeneticsErrorCode.DEFUNCT_SERUM); } return null; } diff --git a/src/main/java/binnie/genetics/machine/splicer/ValidatorIndividualInoculate.java b/src/main/java/binnie/genetics/machine/splicer/ValidatorIndividualInoculate.java index 8872dca4..85fa6923 100644 --- a/src/main/java/binnie/genetics/machine/splicer/ValidatorIndividualInoculate.java +++ b/src/main/java/binnie/genetics/machine/splicer/ValidatorIndividualInoculate.java @@ -22,6 +22,6 @@ public class ValidatorIndividualInoculate extends SlotValidator { @Override public String getTooltip() { - return I18N.localise("genetics.machine.advMachine.splicer.tooltips.slots.individual"); + return I18N.localise("genetics.machine.adv_machine.splicer.tooltips.slots.individual"); } } diff --git a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java index 78e86110..6b202f6b 100644 --- a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java +++ b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java @@ -61,7 +61,7 @@ public class WindowSplicer extends WindowMachine { @Override public String getTitle() { - return I18N.localise("genetics.machine.advMachine.splicer"); + return I18N.localise("genetics.machine.adv_machine.splicer"); } @Override diff --git a/src/main/resources/assets/binniecore/lang/en_US.lang b/src/main/resources/assets/binniecore/lang/en_US.lang index ec11a73a..53d99195 100644 --- a/src/main/resources/assets/binniecore/lang/en_US.lang +++ b/src/main/resources/assets/binniecore/lang/en_US.lang @@ -306,7 +306,7 @@ binniecore.gui.slot.frame=Frame Slot binniecore.gui.slot.mutator=Mutator Slot binniecore.gui.slot.circuit=Circuit Slot binniecore.gui.slot.grain=Grain Slot -binniecore.gui.slot.inventory=Inventory Slot +binniecore.gui.slot.tile=Inventory Slot binniecore.gui.slot.caterpillar=Caterpillar Slot binniecore.gui.slot.polish=Polish Slot binniecore.gui.slot.wood=Wood Slot diff --git a/src/main/resources/assets/genetics/lang/en_US.lang b/src/main/resources/assets/genetics/lang/en_US.lang index d06bbe68..a2d70b09 100644 --- a/src/main/resources/assets/genetics/lang/en_US.lang +++ b/src/main/resources/assets/genetics/lang/en_US.lang @@ -6,54 +6,50 @@ genetics.tab.genetics=Genetaics genetics.errors.no.owner.name=No Owner genetics.errors.no.owner.desc=Replace this block to claim this machine genetics.errors.no.individual.desc=No Individual -genetics.machine.errors.no.serum.desc=No Serum -genetics.machine.errors.no.enzyme.desc=No enzyme -genetics.machine.errors.no.recipe.desc=No Recipe -genetics.machine.errors.no.recipe.info=There is no valid recipe -genetics.machine.errors.empty.serum.desc=Empty Serum -genetics.machine.errors.empty.serum.info=Serum is empty -genetics.machine.errors.invalid.serum.desc=Invalid Serum -genetics.machine.errors.invalid.serum.mismatch.info=Mismatch of Serum Type and Target -genetics.machine.errors.invalid.serum.no.genes.info=Serum does not hold any genes -genetics.machine.errors.defunct.serum.desc=Defunct Serum -genetics.machine.errors.defunct.serum.info=Individual already possesses this allele -genetics.machine.errors.tanks.no.room.desc=Not enough room in Tank +genetics.errors.no.serum.desc=No Serum +genetics.errors.empty.serum.name=Empty Serum +genetics.errors.empty.serum.desc=Serum is empty +genetics.errors.invalid.serum.name=Invalid Serum +genetics.errors.invalid.serum.mismatch.desc=Mismatch of Serum Type and Target +genetics.errors.invalid.serum.no.genes.desc=Serum does not hold any genes +genetics.errors.defunct.serum.name=Defunct Serum +genetics.errors.defunct.serum.desc=Individual already possesses this allele +genetics.errors.no.enzyme.desc=No enzyme genetics.machine.machine.isolator=Isolator genetics.machine.machine.isolator.info=The Isolator takes a random allele from a bee, tree or other individual and copies it into an empty sequence vial. This requires the use of ethanol as a solvent and an enzyme to cut up the DNA. The unsequenced serums can then be amplified in a Polymeriser and sequenced in a Sequencer. -genetics.machine.machine.isolator.errors.no.individual.desc=No individual to isolate -genetics.machine.machine.isolator.errors.no.room.desc=No room for DNA sequences -genetics.machine.machine.isolator.errors.no.empty.sequencer.desc=No empty sequencer vials -genetics.machine.machine.isolator.errors.insufficient.ethanol.desc=Insufficient ethanol +genetics.errors.isolator.no.room.desc=No room for DNA sequences +genetics.errors.isolator.no.empty.sequencer.desc=No empty sequencer vials +genetics.errors.isolator.insufficient.ethanol.desc=Insufficient Ethanol genetics.machine.machine.sequencer=Sequencer genetics.machine.machine.sequencer.info=The Sequencer takes unsequenced serums and determines which allele is present in them. This process is slow and requires the use of fluorescent dye. -genetics.machine.machine.sequencer.errors.insufficient.dye=Insufficient Dye -genetics.machine.machine.sequencer.errors.no.space=No space for empty sequences -genetics.machine.machine.sequencer.errors.no.dna=No DNA sequence +genetics.errors.sequencer.insufficient.dye.desc=Insufficient Dye +genetics.errors.sequencer.no.space.desc=No space for empty sequences +genetics.errors.sequencer.no.dna.desc=No DNA sequence genetics.machine.machine.sequencer.texts.userless=Userless. Will not save sequences genetics.machine.machine.sequencer.texts.sequenced.by=Genes will be sequenced by %s genetics.machine.machine.sequencer.tooltips.slots.unsequenced.dna=Unsequenced DNA genetics.machine.machine.polymeriser=Polymeriser -genetics.machine.machine.polymeriser.info=The Polymeriser fills empty serums with Raw DNA and replicating bacteria. This process can be accelerated using gold nuggets. -genetics.machine.machine.polymeriser.errors.item.no=No item to replicate -genetics.machine.machine.polymeriser.errors.item.filled=Item filled -genetics.machine.machine.polymeriser.errors.insufficient.bacteria=Insufficient Bacteria -genetics.machine.machine.polymeriser.errors.insufficient.dna=Insufficient DNA +genetics.machine.machine.polymeriser.info=The Polymeriser fills empty serums with Raw DNA and replicating bacteria. This process can be accelerated using gold nuggets. genetics.machine.machine.polymeriser.tooltips.logic.gene=Replicating 1 genes genetics.machine.machine.polymeriser.tooltips.logic.genes=Replicating %s geness genetics.machine.machine.polymeriser.tooltips.slots.unfilled=Unfilled Serum +genetics.errors.polymeriser.item.no.desc=No item to replicate +genetics.errors.polymeriser.item.filled.desc=Item filled +genetics.errors.polymeriser.insufficient.bacteria.desc=Insufficient Bacteria +genetics.errors.polymeriser.insufficient.dna.desc=Insufficient DNA genetics.machine.machine.inoculator=Inoculator genetics.machine.machine.inoculator.info=The Inoculator uses serums to add genes to breedable individuals. This process is very slow and requires a Bacteria Vector, but is always successful. -genetics.machine.machine.inoculator.errors.no.individual.desc=No Individual to Inoculate genetics.machine.machine.inoculator.tooltips.logic.gene=Inoculating with 1 gene genetics.machine.machine.inoculator.tooltips.logic.genes=Inoculating with %s genes +genetics.errors.inoculator.insufficient.vector=Not enough Vector genetics.machine.lab_machine.genepool=Genepool genetics.machine.lab_machine.genepool.info=The Genepool uses enzymes and ethanol to break down living things into DNA. During this process, all genetic information is lost and the source of the DNA is destroyed. -genetics.errors.genepool.insufficient.ethanol.desc=Not enough Ethanol +genetics.errors.genepool.insufficient.ethanol.desc=Insufficient Ethanol genetics.errors.genepool.insufficient.enzyme.desc=Insufficient Enzyme genetics.machine.lab_machine.lab_machine=Lab Stand @@ -81,7 +77,6 @@ genetics.machine.adv_machine.splicer=Splicer genetics.machine.adv_machine.splicer.info=The Splicer is an incredibly powerful machine that is used to insert genes into individuals. This process is fast, but requires monumental amounts of power. genetics.machine.adv_machine.splicer.tooltips.slots.serum=Serum Vials & Arrays genetics.machine.adv_machine.splicer.tooltips.slots.individual=Splicable Individual -genetics.machine.adv_machine.splicer.errors.no.individual.desc=No Individual to Splice genetics.gui.analyst.biology.title=Biology genetics.gui.analyst.biology.bee.allday=Active all day and night