Removed LanguageManager

Added I18N static class
Some code reformatting
This commit is contained in:
kordum committed 2017-05-09 20:07:11 +03:00
1 parent 1ffe80b8c9
commit 186cbda444
62 files changed
+360 -375

No files matched your search

@@ -8,9 +8,10 @@ import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.controls.core.IControlValue;
import binnie.core.craftgui.geometry.IArea;
public class ControlColorDisplay extends Control implements IControlValue<IFlowerColor>, ITooltip {
IFlowerColor value;
private IFlowerColor value;
public ControlColorDisplay(IWidget parent, float x, float y) {
super(parent, x, y, 16.0f, 16.0f);
@@ -29,8 +30,9 @@ public class ControlColorDisplay extends Control implements IControlValue<IFlowe
@Override
public void onRenderBackground() {
CraftGUI.Render.solid(getArea(), -1);
CraftGUI.Render.solid(getArea().inset(1), 0xff000000 + getValue().getColor(false));
IArea area = getArea();
CraftGUI.Render.solid(area, -1);
CraftGUI.Render.solid(area.inset(1), 0xff000000 + getValue().getColor(false));
}
@Override
@@ -1,6 +1,5 @@
package binnie.botany.craftgui;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.IColourMix;
import binnie.core.craftgui.CraftGUI;
@@ -13,6 +12,7 @@ import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.CraftGUITextureSheet;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.util.I18N;
public class ControlColourMixSymbol extends Control implements ITooltip {
protected static Texture MutationPlus = new StandardTexture(2, 94, 16, 16, CraftGUITextureSheet.Controls2);
@@ -47,7 +47,7 @@ public class ControlColourMixSymbol extends Control implements ITooltip {
public void getTooltip(Tooltip tooltip) {
if (type == 1) {
float chance = value.getChance();
tooltip.add(Binnie.I18N.localise(Botany.instance, "gui.controls.colorMixSymbol.chance", chance));
tooltip.add(I18N.localise(Botany.instance, "gui.controls.colorMixSymbol.chance", chance));
}
}
}
@@ -1,6 +1,5 @@
package binnie.botany.craftgui;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.IColourMix;
import binnie.botany.api.IFlowerColor;
@@ -10,6 +9,7 @@ import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.database.PageAbstract;
import binnie.core.util.I18N;
import java.util.ArrayList;
import java.util.List;
@@ -20,7 +20,7 @@ public class PageColorMixResultant extends PageAbstract<IFlowerColor> {
public PageColorMixResultant(IWidget parent, DatabaseTab tab) {
super(parent, tab);
pageSpeciesFurtherTitle = new ControlTextCentered(this, 8.0f, Binnie.I18N.localise(Botany.instance, "gui.controls.pageSpeciesFurtherTitle"));
pageSpeciesFurtherTitle = new ControlTextCentered(this, 8.0f, I18N.localise(Botany.instance, "gui.controls.pageSpeciesFurtherTitle"));
pageSpeciesFurtherList = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Resultant);
}
@@ -1,6 +1,5 @@
package binnie.botany.craftgui;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.IColourMix;
import binnie.botany.api.IFlowerColor;
@@ -10,6 +9,7 @@ import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.database.PageAbstract;
import binnie.core.util.I18N;
import java.util.ArrayList;
import java.util.List;
@@ -20,7 +20,7 @@ public class PageColourMix extends PageAbstract<IFlowerColor> {
public PageColourMix(IWidget parent, DatabaseTab tab) {
super(parent, tab);
pageSpeciesFurtherTitle = new ControlTextCentered(this, 8.0f, Binnie.I18N.localise(Botany.instance, "gui.controls.pageColorFurtherTitle"));
pageSpeciesFurtherTitle = new ControlTextCentered(this, 8.0f, I18N.localise(Botany.instance, "gui.controls.pageColorFurtherTitle"));
pageSpeciesFurtherList = new ControlColorMixBox(this, 4, 20, 136, 152, ControlColorMixBox.Type.Further);
}
@@ -18,6 +18,7 @@ import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.util.I18N;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
@@ -46,7 +47,7 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
int w = 144;
int h = 176;
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome"), TextJustification.MiddleCenter);
new ControlText(this, new IArea(0.0f, 4.0f, w, 16.0f), I18N.localise(Botany.instance, "gui.database.tab.genome"), TextJustification.MiddleCenter);
ControlScrollableContent scrollable = new ControlScrollableContent(this, 4.0f, 20.0f, w - 8, h - 8 - 16, 12.0f);
Control contents = new Control(scrollable, 0.0f, 0.0f, w - 8 - 12, h - 8 - 16);
@@ -56,29 +57,30 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
int y = 0;
int th = 14;
int valueX = w2 + 4;
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.temp"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise(Botany.instance, "gui.database.tab.genome.temp"), TextJustification.MiddleRight);
// TODO localized temperature
new ControlText(contents, new IArea(valueX, y, w3, th), treeSpecies.getTemperature().getName(), TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.moist"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(valueX, y, w3, th), Binnie.I18N.localise(treeSpecies.getMoisture()), TextJustification.MiddleLeft);
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise(Botany.instance, "gui.database.tab.genome.moist"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(valueX, y, w3, th), treeSpecies.getMoisture().getLocalisedName(), TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.ph"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(valueX, y, w3, th), Binnie.I18N.localise(treeSpecies.getPH()), TextJustification.MiddleLeft);
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise(Botany.instance, "gui.database.tab.genome.ph"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(valueX, y, w3, th), treeSpecies.getPH().getLocalisedName(), TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.fertility"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise(Botany.instance, "gui.database.tab.genome.fertility"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getFertility() + "x", TextJustification.MiddleLeft);
y += th;
float lifespan = genome.getLifespan() * 68.27f / genome.getAgeChance() / 24000.0f;
String lifespanValue = String.format("%.2f", lifespan);
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.lifespan"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(valueX, y, w3, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.lifespan.value", lifespanValue), TextJustification.MiddleLeft);
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise(Botany.instance, "gui.database.tab.genome.lifespan"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(valueX, y, w3, th), I18N.localise(Botany.instance, "gui.database.tab.genome.lifespan.value", lifespanValue), TextJustification.MiddleLeft);
y += th;
new ControlText(contents, new IArea(0.0f, y, w2, th), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.nectar"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(0.0f, y, w2, th), I18N.localise(Botany.instance, "gui.database.tab.genome.nectar"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(valueX, y, w3, th), genome.getActiveAllele(EnumFlowerChromosome.SAPPINESS).getName(), TextJustification.MiddleLeft);
y += th;
@@ -99,7 +101,7 @@ public class PageSpeciesFlowerGenome extends PageSpecies {
}
int numOfLines = 1 + (tot - 1) / 3;
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), Binnie.I18N.localise(Botany.instance, "gui.database.tab.genome.varieties"), TextJustification.MiddleRight);
new ControlText(contents, new IArea(0.0f, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), I18N.localise(Botany.instance, "gui.database.tab.genome.varieties"), TextJustification.MiddleRight);
y += th;
contents.setSize(new IPoint(contents.size().x(), y));
scrollable.setScrollableContent(contents);
@@ -19,6 +19,7 @@ import binnie.core.craftgui.database.PageSpeciesResultant;
import binnie.core.craftgui.database.WindowAbstractDatabase;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.util.I18N;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
@@ -57,7 +58,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
@Override
protected String getName() {
return Binnie.I18N.localise(Botany.instance, "gui.database.name");
return I18N.localise(Botany.instance, "gui.database.name");
}
enum FlowerMode implements IDatabaseMode {