More localisation

This commit is contained in:
Nedelosk committed 2017-07-10 00:47:53 +02:00
1 parent b6d5901f07
commit 808b04c3b8
24 files changed
+400 -155

No files matched your search

@@ -16,7 +16,7 @@ public class ControlText extends Control implements IControlValue<String> {
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) {
@@ -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);
}
}
@@ -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),
@@ -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) {
@@ -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);
@@ -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);
}
}
@@ -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;
}
@@ -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());
@@ -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));
@@ -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());
}
}
}
@@ -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);
}
}
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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();
}
@@ -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();
}
@@ -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();
}
@@ -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);
@@ -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;
}
@@ -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");
}
}
@@ -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