From 1b722df37a662b17220d20717debea47c0e1ea26 Mon Sep 17 00:00:00 2001 From: Nedelosk Date: Sun, 30 Jul 2017 23:34:07 +0200 Subject: [PATCH] More localisation --- .../gui/analyst/AnalystConstants.java | 9 + .../gui/analyst/AnalystPageBehaviour.java | 59 ++++-- .../gui/analyst/AnalystPageBiology.java | 194 ++++++++++++------ .../gui/analyst/AnalystPageDescription.java | 6 +- .../gui/analyst/AnalystPageGenome.java | 8 +- .../gui/analyst/AnalystPageKaryogram.java | 2 +- .../gui/analyst/AnalystPageMutations.java | 34 +-- .../butterfly/AnalystPageSpecimen.java | 3 +- .../analyst/flower/AnalystPageAppearance.java | 9 +- .../gui/analyst/flower/AnalystPageSoil.java | 11 +- .../resources/assets/genetics/lang/en_US.lang | 50 ++++- 11 files changed, 263 insertions(+), 122 deletions(-) diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystConstants.java b/src/main/java/binnie/genetics/gui/analyst/AnalystConstants.java index a21048fa..674e3ef9 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystConstants.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystConstants.java @@ -3,4 +3,13 @@ package binnie.genetics.gui.analyst; public class AnalystConstants { public static final String KEY = "genetics.gui.analyst"; public static final String PRODUCTS_KEY = KEY + ".products"; + public static final String APPEARANCE_KEY = KEY + ".appearance"; + public static final String SOIL_KEY = KEY + ".soil"; + public static final String BIOLOGY_KEY = KEY + ".biology"; + public static final String BEHAVIOUR_KEY = KEY + ".behaviour"; + public static final String DESCRIPTION_KEY = KEY + ".description"; + public static final String GENOME_KEY = KEY + ".genome"; + public static final String KARYOGRAM_KEY = KEY + ".karyogram"; + public static final String MUTATIONS_KEY = KEY + ".mutations"; + public static final String SPECIMEN_KEY = KEY + ".specimen"; } diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageBehaviour.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageBehaviour.java index 8c13cbec..d800333d 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageBehaviour.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageBehaviour.java @@ -1,6 +1,7 @@ package binnie.genetics.gui.analyst; import net.minecraft.util.math.Vec3i; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -22,57 +23,79 @@ import binnie.core.craftgui.geometry.Area; import binnie.core.craftgui.geometry.TextJustification; import binnie.core.util.I18N; -//TODO:localise @SideOnly(Side.CLIENT) public class AnalystPageBehaviour extends ControlAnalystPage { public AnalystPageBehaviour(IWidget parent, Area area, IIndividual ind) { super(parent, area); - setColor(6684723); + setColor(0x660033); int y = 4; - new ControlTextCentered(this, y, "§nBehaviour").setColor(getColor()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()) + .setColor(getColor()); y += 12; + if (ind instanceof IBee) { IBee bee = (IBee) ind; y += 8; int fertility = bee.getGenome().getFlowering(); - new ControlTextCentered(this, y, "Pollinates nearby\n" + bee.getGenome().getFlowerProvider().getDescription()).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".pollinatesNearby") + "\n" + bee.getGenome().getFlowerProvider().getDescription()) + .setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "§oEvery " + getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100 / fertility)).setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".everyTime", getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100 / fertility))) + .setColor(getColor()); y += 22; + IAlleleBeeEffect effect = bee.getGenome().getEffect(); Vec3i t = bee.getGenome().getTerritory(); if (!effect.getUID().contains("None")) { String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc"); - String loc = effectDesc.equals("") ? ("Effect: " + effect.getName()) : effectDesc; - new ControlText(this, new Area(4, y, width() - 8, 0), loc, TextJustification.TOP_CENTER).setColor(getColor()); - y += CraftGUI.render.textHeight(loc, width() - 8) + 1; - new ControlTextCentered(this, y, "§oWithin " + t.getX() / 2 + " blocks").setColor(getColor()); + String loc = effectDesc.isEmpty() + ? I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".effect", effect.getName()) + : effectDesc; + + new ControlText(this, new Area(4, y, width() - 8, 0), loc, TextJustification.TOP_CENTER) + .setColor(getColor()); + y += (int) (CraftGUI.render.textHeight(loc, width() - 8) + 1.0f); + + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".withinBlocks", (int) (t.getX() / 2.0f))) + .setColor(getColor()); y += 22; } - new ControlTextCentered(this, y, "Territory: §o" + t.getX() + "x" + t.getY() + "x" + t.getZ()).setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".territory", t.getX(), t.getY(), t.getZ())) + .setColor(getColor()); y += 22; } + if (ind instanceof IButterfly) { IButterfly bee2 = (IButterfly) ind; - new ControlTextCentered(this, y, "§oMetabolism: " + Binnie.GENETICS.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".metabolism", Binnie.GENETICS.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM)))) + .setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "Pollinates nearby\n" + bee2.getGenome().getFlowerProvider().getDescription()).setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".pollinatesNearby") + "\n" + bee2.getGenome().getFlowerProvider().getDescription()) + .setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "§oEvery " + getTimeString(1500)).setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".everyTime", getTimeString(1500))) + .setColor(getColor()); y += 22; + IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect(); if (!effect2.getUID().contains("None")) { String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc"); - String loc2 = effectDesc2.equals("") ? ("Effect: " + effect2.getName()) : effectDesc2; - new ControlText(this, new Area(4, y, width() - 8, 0), loc2, TextJustification.TOP_CENTER).setColor(getColor()); - y += CraftGUI.render.textHeight(loc2, width() - 8) + 1; - y += 22; + String loc2 = effectDesc2.isEmpty() + ? I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".effect", effect2.getName()) + : effectDesc2; + + new ControlText(this, new Area(4, y, width() - 8, 0), loc2, TextJustification.TOP_CENTER) + .setColor(getColor()); } } } @Override public String getTitle() { - return "Behaviour"; + return I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ""); } } diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageBiology.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageBiology.java index 63dda628..f4eb1725 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageBiology.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageBiology.java @@ -25,132 +25,210 @@ import binnie.core.craftgui.minecraft.control.ControlIconDisplay; import binnie.core.util.I18N; import binnie.genetics.item.ModuleItems; -//TODO:localise @SideOnly(Side.CLIENT) public class AnalystPageBiology extends ControlAnalystPage { + private static final float SPAWN_KOEF = 1365.3999f; + public AnalystPageBiology(IWidget parent, Area area, IIndividual ind) { super(parent, area); - setColor(26214); + setColor(0x006666); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()) + .setColor(getColor()); y += 12; + if (ind instanceof IBee) { IBee bee = (IBee) ind; if (bee.getGenome().getNeverSleeps()) { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.allday")); + new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".allDay")); } else if (bee.getGenome().getPrimary().isNocturnal()) { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconNight).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.night")); + new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconNight) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".night")); } else { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconDaytime).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.day")); + new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconDaytime) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".day")); } + if (!bee.getGenome().getToleratesRain()) { - new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconNoRain).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.norain")); + new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconNoRain) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notRain")); } else { - new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconRain).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.rain")); + new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconRain) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".rain")); } + if (bee.getGenome().getCaveDwelling()) { - new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconNoSky).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.nosky")); + new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconNoSky) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".underground")); } else { - new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconSky).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.sky")); + new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconSky) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notUnderground")); } y += 30; } else if (ind instanceof IButterfly) { IButterfly moth = (IButterfly) ind; if (moth.getGenome().getNocturnal()) { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay).addTooltip("Active all day and night"); + new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".allDay")); } else if (moth.getGenome().getPrimary().isNocturnal()) { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconNight).addTooltip("Active at night"); + new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconNight) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".night")); } else { - new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconDaytime).addTooltip("Active during the day"); + new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconDaytime) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".day")); } + if (!moth.getGenome().getTolerantFlyer()) { - new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconNoRain).addTooltip("Cannot work during rain"); + new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconNoRain) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notRain")); } else { - new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconRain).addTooltip("Can work during rain"); + new ControlIconDisplay(this, (width() - 64) / 2 + 24, y, ModuleItems.iconRain) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".rain")); } + if (moth.getGenome().getFireResist()) { - new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconNoFire).addTooltip("Nonflammable"); + new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconNoFire) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".nonflammable")); } else { - new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconFire).addTooltip("Flammable"); + new ControlIconDisplay(this, (width() - 64) / 2 + 48, y, ModuleItems.iconFire) + .addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".flammable")); } y += 30; } else if (ind instanceof ITree) { - new ControlTextCentered(this, y, "§oSappiness: " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColor(getColor()); + String alleleName = Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS)); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".sappiness", alleleName)) + .setColor(getColor()); y += 20; } else { y += 10; } + if (ind instanceof IBee) { IBee bee = (IBee) ind; int fertility = bee.getGenome().getFertility(); - new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColor(getColor()); + if (fertility > 1) { + new ControlTextCentered(this, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.drones", fertility)) + .setColor(getColor()); + } else { + new ControlTextCentered(this, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.drone")) + .setColor(getColor()); + } + y += 22; - int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle; - new ControlTextCentered(this, y, "Average Lifespan").setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".averageLifespan")) + .setColor(getColor()); + y += 12; - new ControlTextCentered(this, y, "§l" + getMCDayString(lifespan * (bee.getGenome().getNeverSleeps() ? 1.0f : 2.0f))).setColor(getColor()); + int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle; + new ControlTextCentered(this, y, TextFormatting.BOLD + getMCDayString(lifespan * (bee.getGenome().getNeverSleeps() ? 1.0f : 2.0f))) + .setColor(getColor()); y += 22; } + if (ind instanceof IButterfly) { IButterfly bee2 = (IButterfly) ind; int fertility = bee2.getGenome().getFertility(); - new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColor(getColor()); + if (fertility > 1) { + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.moths", fertility)) + .setColor(getColor()); + } else { + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.moth")) + .setColor(getColor()); + } + y += 32; - float caterpillarMatureTime = 1365.3999f * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2)); - new ControlTextCentered(this, y, "Caterpillar Gestation").setColor(getColor()); + float caterpillarMatureTime = SPAWN_KOEF * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2)); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".caterpillarGestation")) + .setColor(getColor()); + y += 12; - new ControlTextCentered(this, y, "§l" + getMCDayString(caterpillarMatureTime)).setColor(getColor()); + new ControlTextCentered(this, y, TextFormatting.BOLD + getMCDayString(caterpillarMatureTime)) + .setColor(getColor()); + y += 22; int speed = (int) (20.0f * bee2.getGenome().getSpeed()); - new ControlTextCentered(this, y, "Flight Speed").setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".flightSpeed")) + .setColor(getColor()); + y += 12; - new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColor(getColor()); + new ControlTextCentered(this, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".blocksPerSec", speed)) + .setColor(getColor()); y += 22; } + if (ind instanceof ITree) { ITree tree = (ITree) ind; int fertility = (int) (1.0f / tree.getGenome().getFertility()); - new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColor(getColor()); + if (fertility > 1) { + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.leaves", fertility)) + .setColor(getColor()); + } else { + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.leaf")) + .setColor(getColor()); + } + y += 22; - int butterflySpawn = Math.round(1365.3999f / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f)); - new ControlTextCentered(this, y, "Butterfies spawn every\n" + getTimeString(butterflySpawn) + " per leaf").setColor(getColor()); + int butterflySpawn = Math.round(SPAWN_KOEF / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f)); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".mothSpawn.perLeaf", getTimeString(butterflySpawn))) + .setColor(getColor()); + y += 34; - new ControlTextCentered(this, y, "Plant Type").setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".planTypes")).setColor(getColor()); + y += 12; - new ControlTextCentered(this, y, "§o" + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)).setColor(getColor()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)) + .setColor(getColor()); } if (ind instanceof IFlower) { IFlower flower = (IFlower) ind; - int butterflySpawn2 = Math.round(1365.3999f / (flower.getGenome().getSappiness() * 0.2f)); - new ControlTextCentered(this, y, "Butterfies spawn every\n" + getTimeString(butterflySpawn2)).setColor(getColor()); + int butterflySpawn2 = Math.round(SPAWN_KOEF / (flower.getGenome().getSappiness() * 0.2f)); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".mothSpawn", getTimeString(butterflySpawn2))) + .setColor(getColor()); y += 30; - float CHANCE_DISPERSAL = 0.8f; - CHANCE_DISPERSAL += 0.2f * flower.getGenome().getFertility(); - float CHANCE_POLLINATE = 0.6f; - CHANCE_POLLINATE += 0.25f * flower.getGenome().getFertility(); - float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE; - if (CHANCE_DISPERSAL > 1.0f) { - CHANCE_DISPERSAL = 1.0f; + + int fertility = flower.getGenome().getFertility(); + float chanceDispersal = 0.8f; + chanceDispersal += 0.2f * fertility; + if (chanceDispersal > 1.0f) { + chanceDispersal = 1.0f; } - if (CHANCE_POLLINATE > 1.0f) { - CHANCE_POLLINATE = 1.0f; + + float chancePollinate = 0.6f; + chancePollinate += 0.25f * fertility; + if (chancePollinate > 1.0f) { + chancePollinate = 1.0f; } - float dispersalTime = 1365.3999f / CHANCE_DISPERSAL; - float pollinateTime = 1365.3999f / CHANCE_POLLINATE; - float lifespan2 = flower.getMaxAge() * 20.0f * 68.27f / flower.getGenome().getAgeChance(); - float floweringLifespan = (flower.getMaxAge() - 1) * 20.0f * 68.27f / flower.getGenome().getAgeChance(); - floweringLifespan -= 1365.3999f; - new ControlTextCentered(this, y, "Average Lifespan").setColor(getColor()); + + float maxAge = flower.getMaxAge(); + float ageChance = flower.getGenome().getAgeChance(); + float dispersalTime = SPAWN_KOEF / chanceDispersal; + float pollinateTime = SPAWN_KOEF / chancePollinate; + float lifespan2 = maxAge * 20.0f * 68.27f / ageChance; + float floweringLifespan = (maxAge - 1) * 20.0f * 68.27f / ageChance - SPAWN_KOEF; + + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".averageLifespan")) + .setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + getMCDayString(lifespan2)).setColor(getColor()); + + new ControlTextCentered(this, y, TextFormatting.BOLD + getMCDayString(lifespan2)) + .setColor(getColor()); y += 22; - new ControlTextCentered(this, y, "Seed Dispersal").setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".seedDispersal")) + .setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColor(getColor()); + + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".perLifetime", (int) (floweringLifespan / dispersalTime))) + .setColor(getColor()); y += 22; - new ControlTextCentered(this, y, "Pollination").setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".pollination")) + .setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColor(getColor()); + + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".perLifetime", (int) (floweringLifespan / pollinateTime))) + .setColor(getColor()); y += 22; } setSize(new Point(width(), y)); @@ -160,12 +238,12 @@ public class AnalystPageBiology extends ControlAnalystPage { float seconds = time / 20.0f; float minutes = seconds / 60.0f; float days = minutes / 20.0f; - DecimalFormat df = new DecimalFormat("#.0"); - return df.format(days) + " MC days"; + DecimalFormat df = new DecimalFormat("#.#"); + return I18N.localise(AnalystConstants.BIOLOGY_KEY + ".mcDays", df.format(days)); } @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.biology.title"); + return I18N.localise(AnalystConstants.BIOLOGY_KEY + ""); } } diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageDescription.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageDescription.java index 92d75f73..b15fa805 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageDescription.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageDescription.java @@ -59,10 +59,10 @@ public class AnalystPageDescription extends ControlAnalystPage { y += 10; new ControlTextCentered(this, y, TextFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + TextFormatting.RESET).setColor(getColor()); y += 20; - String discovered = I18N.localise("genetics.gui.analyst.desc.discovered") + " " + TextFormatting.BOLD + authority + TextFormatting.RESET; + String discovered = I18N.localise(AnalystConstants.DESCRIPTION_KEY + ".discovered") + " " + TextFormatting.BOLD + authority + TextFormatting.RESET; new ControlTextCentered(this, y, discovered).setColor(getColor()); y += (int) (3.0f + CraftGUI.render.textHeight(discovered, width())); - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.desc.complexity") + ": " + species.getComplexity()).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.DESCRIPTION_KEY + ".complexity") + ": " + species.getComplexity()).setColor(getColor()); y += 26; ControlText descText = new ControlText(this, new Area(8, y, width() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); IWidget signatureText = new ControlText(this, new Area(8, y, width() - 16, 0), descSig + "§r", TextJustification.BOTTOM_RIGHT); @@ -75,6 +75,6 @@ public class AnalystPageDescription extends ControlAnalystPage { @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.desc.title"); + return I18N.localise(AnalystConstants.DESCRIPTION_KEY + ".title"); } } diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageGenome.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageGenome.java index ebbaafac..33d38069 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageGenome.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageGenome.java @@ -67,12 +67,12 @@ public class AnalystPageGenome extends ControlAnalystPage { @Override public String getTitle() { - String stateKey = "genetics.gui.analyst.genome."; + String stateKey = AnalystConstants.GENOME_KEY; if(active){ - stateKey+="active"; + stateKey+=".active"; }else{ - stateKey+="inactive"; + stateKey+=".inactive"; } - return I18N.localise("genetics.gui.analyst.genome.title", I18N.localise(stateKey)); + return I18N.localise(AnalystConstants.GENOME_KEY + ".title", I18N.localise(stateKey)); } } diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageKaryogram.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageKaryogram.java index 711bbfdd..b1001630 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageKaryogram.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageKaryogram.java @@ -45,6 +45,6 @@ public class AnalystPageKaryogram extends ControlAnalystPage { @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.karyogram.title"); + return I18N.localise(AnalystConstants.KARYOGRAM_KEY+ ".title"); } } diff --git a/src/main/java/binnie/genetics/gui/analyst/AnalystPageMutations.java b/src/main/java/binnie/genetics/gui/analyst/AnalystPageMutations.java index 9ab20b03..850afaa4 100644 --- a/src/main/java/binnie/genetics/gui/analyst/AnalystPageMutations.java +++ b/src/main/java/binnie/genetics/gui/analyst/AnalystPageMutations.java @@ -89,21 +89,21 @@ public class AnalystPageMutations extends ControlAnalystPage { hive = new ItemStack(Blocks.CHEST); } if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Valiant.getAllele()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".bee.natural")).setColor(getColor()); y += 10; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.hive")).setColor(getColor()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".bee.hive")).setColor(getColor()); y += 22; } else if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Monastic.getAllele()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".bee.natural")).setColor(getColor()); y += 10; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.villager")).setColor(getColor()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".bee.villager")).setColor(getColor()); y += 22; } else if (hive != null) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".bee.natural")).setColor(getColor()); y += 10; ControlItemDisplay display = new ControlItemDisplay(this, (width() - 16) / 2, y); if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Steadfast.getAllele()) { - display.addTooltip(I18N.localise("genetics.gui.analyst.mutations.bee.dungeon")); + display.addTooltip(I18N.localise(AnalystConstants.MUTATIONS_KEY + ".bee.dungeon")); } else { display.setTooltip(); } @@ -117,7 +117,7 @@ public class AnalystPageMutations extends ControlAnalystPage { if (resultant.size() == 1) { ox = (width() - 44) / 2; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultant")).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".resultant")).setColor(getColor()); y += 10; for (IMutation mutation : resultant) { float specificChance = getSpecificChance(ind, mutation, system); @@ -131,9 +131,9 @@ public class AnalystPageMutations extends ControlAnalystPage { IAlleleSpecies species2 = mutation.getAllele1(); String comb = species0.getName() + " + " + species2.getName(); addTooltip(comb); - String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise("genetics.gui.analyst.mutations.chance"); + String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".chance"); if (specificChance != mutation.getBaseChance()) { - chance = chance + getMutationColour(specificChance).getCode() + " (" + (int) specificChance + "% " + I18N.localise("genetics.gui.analyst.mutations.currently") + ")"; + chance = chance + getMutationColour(specificChance).getCode() + " (" + (int) specificChance + "% " + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".currently") + ")"; } addTooltip(chance); for (String s : mutation.getSpecialConditions()) { @@ -174,7 +174,7 @@ public class AnalystPageMutations extends ControlAnalystPage { if (further.size() == 1) { ox = (width() - 44) / 2; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.further")).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".further")).setColor(getColor()); y += 10; for (IMutation mutation : further) { IAllele speciesComb = mutation.getPartner(speciesCurrent); @@ -187,12 +187,12 @@ public class AnalystPageMutations extends ControlAnalystPage { public void initialise() { IAlleleSpecies species0 = (IAlleleSpecies) speciesComb; IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0]; - addTooltip(species2.getName()); - String comb = speciesCurrent.getName() + " + " + species0.getName(); + addTooltip(species2.getAlleleName()); + String comb = speciesCurrent.getAlleleName() + " + " + species0.getAlleleName(); addTooltip(comb); - String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise("genetics.gui.analyst.mutations.chance"); + String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".chance"); if (specificChance2 != mutation.getBaseChance()) { - chance = chance + getMutationColour(specificChance2).getCode() + " (" + (int) specificChance2 + "% " + I18N.localise("genetics.gui.analyst.mutations.currently") + ")"; + chance = chance + getMutationColour(specificChance2).getCode() + " (" + (int) specificChance2 + "% " + I18N.localise(AnalystConstants.MUTATIONS_KEY + ".currently") + ")"; } addTooltip(chance); for (String s : mutation.getSpecialConditions()) { @@ -246,7 +246,7 @@ public class AnalystPageMutations extends ControlAnalystPage { @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.mutations.title"); + return I18N.localise(AnalystConstants.MUTATIONS_KEY + ".title"); } protected EnumColor getMutationColour(float percent) { @@ -272,13 +272,13 @@ public class AnalystPageMutations extends ControlAnalystPage { public ControlUnknownMutation(IWidget parent, int x, int y, int w, int h) { super(parent, x, y, w, h); addAttribute(Attribute.MouseOver); - addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknown.tooltip")); + addTooltip(I18N.localise(AnalystConstants.MUTATIONS_KEY + ".unknown.tooltip")); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 11184810); + RenderUtil.drawText(getArea(), TextJustification.MIDDLE_CENTER, I18N.localise(AnalystConstants.MUTATIONS_KEY + ".unknown"), 11184810); } } } diff --git a/src/main/java/binnie/genetics/gui/analyst/butterfly/AnalystPageSpecimen.java b/src/main/java/binnie/genetics/gui/analyst/butterfly/AnalystPageSpecimen.java index 0bbde17f..ee8925a4 100644 --- a/src/main/java/binnie/genetics/gui/analyst/butterfly/AnalystPageSpecimen.java +++ b/src/main/java/binnie/genetics/gui/analyst/butterfly/AnalystPageSpecimen.java @@ -8,6 +8,7 @@ import binnie.core.craftgui.IWidget; import binnie.core.craftgui.controls.ControlTextCentered; import binnie.core.craftgui.geometry.Area; import binnie.core.util.I18N; +import binnie.genetics.gui.analyst.AnalystConstants; import binnie.genetics.gui.analyst.ControlAnalystPage; import binnie.genetics.gui.analyst.ControlIndividualDisplay; @@ -24,6 +25,6 @@ public class AnalystPageSpecimen extends ControlAnalystPage { @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.specimen.title"); + return I18N.localise(AnalystConstants.SPECIMEN_KEY + ".title"); } } diff --git a/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageAppearance.java b/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageAppearance.java index d842c350..03735dde 100644 --- a/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageAppearance.java +++ b/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageAppearance.java @@ -20,6 +20,7 @@ import binnie.core.craftgui.geometry.Point; import binnie.core.craftgui.minecraft.control.ControlIconDisplay; import binnie.core.craftgui.renderer.RenderUtil; import binnie.core.util.I18N; +import binnie.genetics.gui.analyst.AnalystConstants; import binnie.genetics.gui.analyst.ControlAnalystPage; public class AnalystPageAppearance extends ControlAnalystPage { @@ -32,11 +33,11 @@ public class AnalystPageAppearance extends ControlAnalystPage { new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; ControlColorDisplay a = new ControlColorDisplay(this, width() / 2 - 28, y, genome.getPrimaryColor()); - a.addTooltip(I18N.localise("genetics.gui.analyst.appearance.primary")); + a.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".primary")); ControlColorDisplay b = new ControlColorDisplay(this, width() / 2 - 8, y, genome.getSecondaryColor()); - b.addTooltip(I18N.localise("genetics.gui.analyst.appearance.secondary")); + b.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".secondary")); ControlColorDisplay c = new ControlColorDisplay(this, width() / 2 + 12, y, genome.getStemColor()); - c.addTooltip(I18N.localise("genetics.gui.analyst.appearance.stem")); + c.addTooltip(I18N.localise(AnalystConstants.APPEARANCE_KEY + ".stem")); y += 26; IFlowerType type = genome.getType(); int sections = type.getSections(); @@ -71,6 +72,6 @@ public class AnalystPageAppearance extends ControlAnalystPage { @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.appearance.title"); + return I18N.localise(AnalystConstants.APPEARANCE_KEY + ".title"); } } diff --git a/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageSoil.java b/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageSoil.java index 7bc9c9fd..e8877498 100644 --- a/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageSoil.java +++ b/src/main/java/binnie/genetics/gui/analyst/flower/AnalystPageSoil.java @@ -22,6 +22,7 @@ import binnie.core.craftgui.geometry.TextJustification; import binnie.core.craftgui.minecraft.control.ControlItemDisplay; import binnie.core.genetics.Tolerance; import binnie.core.util.I18N; +import binnie.genetics.gui.analyst.AnalystConstants; import binnie.genetics.gui.analyst.ControlAnalystPage; import binnie.genetics.gui.analyst.ControlToleranceBar; @@ -36,15 +37,15 @@ public class AnalystPageSoil extends ControlAnalystPage { int y = 4; new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; createMoisture(this, (width() - 100) / 2, y, 100, 10, moisture, moistureTol); y += 16; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.ph"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".tolerance.ph"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; createAcidity(this, (width() - 100) / 2, y, 100, 10, pH, pHTol); y += 16; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.recommended"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".recommended"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; EnumMoisture recomMoisture = EnumMoisture.NORMAL; boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol); @@ -87,7 +88,7 @@ public class AnalystPageSoil extends ControlAnalystPage { recomSoil.setItemStack(stack); recomSoil.setTooltip(); y += 32; - new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.other"), TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.SOIL_KEY + ".other"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; List stacks = new ArrayList<>(); for (EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) { @@ -137,6 +138,6 @@ public class AnalystPageSoil extends ControlAnalystPage { @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.soil.title"); + return I18N.localise(AnalystConstants.SOIL_KEY + ".title"); } } diff --git a/src/main/resources/assets/genetics/lang/en_US.lang b/src/main/resources/assets/genetics/lang/en_US.lang index 7ca28abe..41062f89 100644 --- a/src/main/resources/assets/genetics/lang/en_US.lang +++ b/src/main/resources/assets/genetics/lang/en_US.lang @@ -79,14 +79,42 @@ genetics.machine.adv_machine.splicer.info=The Splicer is an incredibly powerful genetics.machine.adv_machine.splicer.tooltips.slots.serum=Serum Vials & Arrays genetics.machine.adv_machine.splicer.tooltips.slots.individual=Splicable Individual -genetics.gui.analyst.biology.title=Biology -genetics.gui.analyst.biology.bee.allday=Active all day and night -genetics.gui.analyst.biology.bee.day=Active during the day -genetics.gui.analyst.biology.bee.night=Active at night -genetics.gui.analyst.biology.bee.norain=Cannot work during rain -genetics.gui.analyst.biology.bee.rain=Can work during rain -genetics.gui.analyst.biology.bee.nosky=Can work underground -genetics.gui.analyst.biology.bee.sky=Cannot work underground +genetics.gui.analyst.biology=Biology +genetics.gui.analyst.biology.allDay=Active all day and night +genetics.gui.analyst.biology.night=Active at night +genetics.gui.analyst.biology.day=Active during the day +genetics.gui.analyst.biology.notRain=Cannot work during rain +genetics.gui.analyst.biology.rain=Can work during rain +genetics.gui.analyst.biology.underground=Can work underground +genetics.gui.analyst.biology.notUnderground=Cannot work underground +genetics.gui.analyst.biology.flammable=Flammable +genetics.gui.analyst.biology.nonflammable=Nonflammable +genetics.gui.analyst.biology.sappiness=Sappiness: %s +genetics.gui.analyst.biology.fertility.drones=%d drones per hive +genetics.gui.analyst.biology.fertility.drone=1 drone per hive +genetics.gui.analyst.biology.fertility.moths=Lays %d caterpillars before dying +genetics.gui.analyst.biology.fertility.moth=Lays 1 caterpillar before dying +genetics.gui.analyst.biology.fertility.leaves=1 Sapling per %d leaves +genetics.gui.analyst.biology.fertility.leaf=1 Sapling per 1 leaf +genetics.gui.analyst.biology.caterpillarGestation=Caterpillar Gestation +genetics.gui.analyst.biology.flightSpeed=Flight Speed +genetics.gui.analyst.biology.blocksPerSec=%d blocks per second +genetics.gui.analyst.biology.mothSpawn.perLeaf=Butterflies spawn every\n%s per leaf +genetics.gui.analyst.biology.mothSpawn=Butterflies spawn every\n%s +genetics.gui.analyst.biology.plantTypes=Plant Types +genetics.gui.analyst.biology.averageLifespan=Average Lifespan +genetics.gui.analyst.biology.pollination=Pollination +genetics.gui.analyst.biology.seedDispersal=Seed Dispersal +genetics.gui.analyst.biology.perLifetime=%d per lifetime +genetics.gui.analyst.biology.mcDays=%s MC days + +genetics.gui.analyst.behaviour=Behaviour +genetics.gui.analyst.behaviour.effect=Effect: %s +genetics.gui.analyst.behaviour.pollinatesNearby=Pollinates nearby +genetics.gui.analyst.behaviour.withinBlocks=Within %d blocks +genetics.gui.analyst.behaviour.everyTime=Every %s +genetics.gui.analyst.behaviour.territory=Territory: %dx%dx%d +genetics.gui.analyst.behaviour.metabolism=Metabolism: %s genetics.gui.analyst.genome.title=%s Genome genetics.gui.analyst.genome.active=Active @@ -108,9 +136,9 @@ genetics.gui.analyst.mutations.bee.hive=Found in any Hive genetics.gui.analyst.mutations.bee.villager=Bought from Villagers genetics.gui.analyst.mutations.bee.dungeon=Dungeon Chests -genetics.gui.analyst.desc.title=Description -genetics.gui.analyst.desc.discovered=Discovered by -genetics.gui.analyst.desc.complexity=Genetic Complexity +genetics.gui.analyst.description.title=Description +genetics.gui.analyst.description.discovered=Discovered by +genetics.gui.analyst.description.complexity=Genetic Complexity //Flower genetics.gui.analyst.soil.title=Soil