Added missed localization

This commit is contained in:
kordum committed 2017-06-26 18:02:14 +03:00
1 parent 4d1d3d1cca
commit b5989356ce
3 files changed
+102 -61

No files matched your search

@@ -9,6 +9,7 @@ import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.genetics.Tolerance;
import binnie.core.util.I18N;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IBee;
import forestry.api.core.EnumHumidity;
@@ -28,39 +29,50 @@ import java.util.List;
public class AnalystPageClimate extends ControlAnalystPage {
public AnalystPageClimate(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(26163);
setColor(0x006633);
EnumTemperature temp = ind.getGenome().getPrimary().getTemperature();
EnumTolerance tempTol = EnumTolerance.NONE;
EnumHumidity humid = ind.getGenome().getPrimary().getHumidity();
EnumTolerance humidTol = EnumTolerance.NONE;
if (ind instanceof IBee) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE)).getValue();
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE)).getValue();
}
if (ind instanceof IFlower) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
humidTol = EnumTolerance.BOTH_5;
}
if (ind instanceof IButterfly) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE)).getValue();
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE)).getValue();
}
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Climate").setColor(getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Temp. Tolerance", TextJustification.MIDDLE_CENTER).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.temperature"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
createTemperatureBar(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, temp, tempTol);
y += 16;
if (!(ind instanceof IFlower)) {
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Humidity Tolerance", TextJustification.MIDDLE_CENTER).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.humidity"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
createHumidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, humid, humidTol);
y += 16;
}
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Biomes", TextJustification.MIDDLE_CENTER).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
List<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
List<BiomeGenBase> biomes = new ArrayList<>();
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
if (biome == null || !BiomeDictionary.isBiomeRegistered(biome) || biome == BiomeGenBase.frozenOcean) {
continue;
@@ -77,6 +89,7 @@ public class AnalystPageClimate extends ControlAnalystPage {
match = true;
}
}
if (!match) {
biomes.add(biome);
}
@@ -105,7 +118,7 @@ public class AnalystPageClimate extends ControlAnalystPage {
}
@Override
protected int getColour(EnumTemperature value) {
protected int getColor(EnumTemperature value) {
return (new int[]{0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000})[value.ordinal() - 1];
}
}.setValues(value, tol);
@@ -119,7 +132,7 @@ public class AnalystPageClimate extends ControlAnalystPage {
}
@Override
protected int getColour(EnumHumidity value) {
protected int getColor(EnumHumidity value) {
return (new int[]{0xffe7a3, 0x1aff00, 0x307cff})[value.ordinal()];
}
}.setValues(value, tol);
@@ -127,6 +140,6 @@ public class AnalystPageClimate extends ControlAnalystPage {
@Override
public String getTitle() {
return "Climate";
return I18N.localise("genetics.gui.analyst.climate");
}
}
@@ -11,9 +11,9 @@ import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.EnumColor;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.genetics.BreedingSystem;
import binnie.core.util.I18N;
import binnie.extrabees.ExtraBees;
import binnie.extrabees.genetics.ExtraBeeDefinition;
import binnie.genetics.item.ModuleItem;
@@ -28,88 +28,93 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import java.util.Collection;
import java.util.List;
public class AnalystPageMutations extends ControlAnalystPage {
public AnalystPageMutations(IWidget parent, IArea area, IIndividual ind, boolean isMaster) {
super(parent, area);
setColor(3355392);
setColor(0x333300);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Mutations").setColor(getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
y += 18;
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
List<IMutation> discovered = system.getDiscoveredMutations(Window.get(this).getWorld(), Window.get(this).getUsername());
IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary();
Collection<IMutation> resultant = system.getResultantMutations(speciesCurrent);
Collection<IMutation> further = system.getFurtherMutations(speciesCurrent);
if (ind instanceof IBee) {
ItemStack hive = null;
if (ind.getGenome().getPrimary() == ExtraBeeDefinition.WATER) {
IAlleleSpecies primary = ind.getGenome().getPrimary();
if (primary == ExtraBeeDefinition.WATER) {
hive = new ItemStack(ExtraBees.hive, 1, 0);
}
if (ind.getGenome().getPrimary() == ExtraBeeDefinition.ROCK) {
} else if (primary == ExtraBeeDefinition.ROCK) {
hive = new ItemStack(ExtraBees.hive, 1, 1);
}
if (ind.getGenome().getPrimary() == ExtraBeeDefinition.BASALT) {
} else if (primary == ExtraBeeDefinition.BASALT) {
hive = new ItemStack(ExtraBees.hive, 1, 2);
}
if (ind.getGenome().getPrimary() == BeeDefinition.FOREST.getGenome().getPrimary()) {
} else if (primary == BeeDefinition.FOREST.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 1);
}
if (ind.getGenome().getPrimary() == BeeDefinition.MEADOWS.getGenome().getPrimary()) {
} else if (primary == BeeDefinition.MEADOWS.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 2);
}
if (ind.getGenome().getPrimary() == BeeDefinition.MODEST.getGenome().getPrimary()) {
} else if (primary == BeeDefinition.MODEST.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 3);
}
if (ind.getGenome().getPrimary() == BeeDefinition.TROPICAL.getGenome().getPrimary()) {
} else if (primary == BeeDefinition.TROPICAL.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 4);
}
if (ind.getGenome().getPrimary() == BeeDefinition.ENDED.getGenome().getPrimary()) {
} else if (primary == BeeDefinition.ENDED.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 5);
}
if (ind.getGenome().getPrimary() == BeeDefinition.WINTRY.getGenome().getPrimary()) {
} else if (primary == BeeDefinition.WINTRY.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 6);
}
if (ind.getGenome().getPrimary() == BeeDefinition.MARSHY.getGenome().getPrimary()) {
} else if (primary == BeeDefinition.MARSHY.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 7);
}
if (ind.getGenome().getPrimary() == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
} else if (primary == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
hive = new ItemStack(Blocks.chest);
}
if (ind.getGenome().getPrimary() == BeeDefinition.VALIANT.getGenome().getPrimary()) {
new ControlTextCentered(this, y, "Natural Habitat").setColor(getColor());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
y += 10;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Found in any Hive").setColor(getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.habitat.any"))
.setColor(getColor());
y += 22;
} else if (ind.getGenome().getPrimary() == BeeDefinition.MONASTIC.getGenome().getPrimary()) {
new ControlTextCentered(this, y, "Natural Habitat").setColor(getColor());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
y += 10;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Bought from Villagers").setColor(getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.habitat.villagers"))
.setColor(getColor());
y += 22;
} else if (hive != null) {
new ControlTextCentered(this, y, "Natural Habitat").setColor(getColor());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
y += 10;
ControlItemDisplay display = new ControlItemDisplay(this, (w() - 16.0f) / 2.0f, y);
if (ind.getGenome().getPrimary() == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
display.addTooltip("Dungeon Chests");
display.addTooltip(I18N.localise("genetics.gui.analyst.mutations.habitat.chest"));
} else {
display.setTooltip();
}
display.setItemStack(hive);
y += 24;
}
}
float ox = (w() - 88.0f - 8.0f) / 2.0f;
float dx = 0.0f;
if (!resultant.isEmpty()) {
if (resultant.size() == 1) {
ox = (w() - 44.0f) / 2.0f;
}
new ControlTextCentered(this, y, "Resultant Mutations").setColor(getColor());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultantMutations"))
.setColor(getColor());
y += 10;
for (IMutation mutation : resultant) {
float specificChance = getSpecificChance(ind, mutation, system);
float specificChance = getSpecificChance(mutation, system);
if (!isMaster && !isKnown(system, mutation)) {
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
} else {
@@ -120,10 +125,11 @@ 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() + "% Chance";
String chance = getMutationColor(mutation.getBaseChance()).getCode() + I18N.localise("genetics.gui.analyst.mutations.chance", (int) mutation.getBaseChance());
if (specificChance != mutation.getBaseChance()) {
chance = chance + getMutationColour(specificChance).getCode() + " (" + (int) specificChance + "% currently)";
chance += getMutationColor(specificChance).getCode() + " " + I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance);
}
addTooltip(chance);
for (String s : mutation.getSpecialConditions()) {
addTooltip(s);
@@ -135,12 +141,12 @@ public class AnalystPageMutations extends ControlAnalystPage {
CraftGUI.Render.item(new IPoint(0.0f, 0.0f), system.getDefaultMember(mutation.getAllele0().getUID()));
CraftGUI.Render.item(new IPoint(28.0f, 0.0f), system.getDefaultMember(mutation.getAllele1().getUID()));
if (specificChance != mutation.getBaseChance()) {
CraftGUI.Render.color(getMutationColour(mutation.getBaseChance()).getColor());
CraftGUI.Render.color(getMutationColor(mutation.getBaseChance()).getColor());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd0.getIcon());
CraftGUI.Render.color(getMutationColour(specificChance).getColor());
CraftGUI.Render.color(getMutationColor(specificChance).getColor());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd1.getIcon());
} else {
CraftGUI.Render.color(getMutationColour(mutation.getBaseChance()).getColor());
CraftGUI.Render.color(getMutationColor(mutation.getBaseChance()).getColor());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd.getIcon());
}
}
@@ -151,22 +157,26 @@ public class AnalystPageMutations extends ControlAnalystPage {
y += 18;
}
}
if (dx != 0.0f && resultant.size() != 1) {
y += 18;
}
y += 10;
}
ox = (w() - 88.0f - 8.0f) / 2.0f;
dx = 0.0f;
if (!further.isEmpty()) {
if (further.size() == 1) {
ox = (w() - 44.0f) / 2.0f;
}
new ControlTextCentered(this, y, "Further Mutations").setColor(getColor());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.furtherMutations"))
.setColor(getColor());
y += 10;
for (IMutation mutation : further) {
IAllele speciesComb = mutation.getPartner(speciesCurrent);
float specificChance2 = getSpecificChance(ind, mutation, system);
float specificChance2 = getSpecificChance(mutation, system);
if (!isMaster && !isKnown(system, mutation)) {
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
} else {
@@ -178,9 +188,9 @@ public class AnalystPageMutations extends ControlAnalystPage {
addTooltip(species2.getName());
String comb = speciesCurrent.getName() + " + " + species0.getName();
addTooltip(comb);
String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% Chance";
String chance = getMutationColor(mutation.getBaseChance()).getCode() + I18N.localise("genetics.gui.analyst.mutations.chance", (int) mutation.getBaseChance());
if (specificChance2 != mutation.getBaseChance()) {
chance = chance + getMutationColour(specificChance2).getCode() + " (" + (int) specificChance2 + "% currently)";
chance = chance + getMutationColor(specificChance2).getCode() + " " + I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance2);
}
addTooltip(chance);
for (String s : mutation.getSpecialConditions()) {
@@ -192,24 +202,26 @@ public class AnalystPageMutations extends ControlAnalystPage {
public void onRenderBackground() {
CraftGUI.Render.item(new IPoint(0.0f, 0.0f), system.getDefaultMember(speciesComb.getUID()));
CraftGUI.Render.item(new IPoint(28.0f, 0.0f), system.getDefaultMember(mutation.getTemplate()[0].getUID()));
CraftGUI.Render.color(getMutationColour(mutation.getBaseChance()).getColor());
CraftGUI.Render.color(getMutationColor(mutation.getBaseChance()).getColor());
if (specificChance2 != mutation.getBaseChance()) {
CraftGUI.Render.color(getMutationColour(mutation.getBaseChance()).getColor());
CraftGUI.Render.color(getMutationColor(mutation.getBaseChance()).getColor());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow0.getIcon());
CraftGUI.Render.color(getMutationColour(specificChance2).getColor());
CraftGUI.Render.color(getMutationColor(specificChance2).getColor());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow1.getIcon());
} else {
CraftGUI.Render.color(getMutationColour(mutation.getBaseChance()).getColor());
CraftGUI.Render.color(getMutationColor(mutation.getBaseChance()).getColor());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow.getIcon());
}
}
};
}
dx = 52.0f - dx;
if (dx == 0.0f || further.size() == 1) {
y += 18;
}
}
if (dx != 0.0f && further.size() != 1) {
y += 18;
}
@@ -222,16 +234,16 @@ public class AnalystPageMutations extends ControlAnalystPage {
return system.getDiscoveredMutations(getWindow().getWorld(), getWindow().getPlayer().getGameProfile()).contains(mutation);
}
private float getSpecificChance(IIndividual ind, IMutation mutation, BreedingSystem system) {
private float getSpecificChance(IMutation mutation, BreedingSystem system) {
return system.getChance(mutation, getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1());
}
@Override
public String getTitle() {
return "Mutations";
return I18N.localise("genetics.gui.analyst.mutations");
}
protected EnumColor getMutationColour(float percent) {
protected EnumColor getMutationColor(float percent) {
if (percent >= 20.0f) {
return EnumColor.DarkGreen;
}
@@ -254,12 +266,12 @@ public class AnalystPageMutations extends ControlAnalystPage {
public ControlUnknownMutation(IWidget parent, float x, float y, float w, float h) {
super(parent, x, y, w, h);
addAttribute(WidgetAttribute.MOUSE_OVER);
addTooltip("Unknown Mutation");
addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknownMutation"));
}
@Override
public void onRenderBackground() {
CraftGUI.Render.text(getArea(), TextJustification.MIDDLE_CENTER, "UNKNOWN", 11184810);
CraftGUI.Render.text(getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 0xaaaaaa);
}
}
}