[1.7.10] Some refactoring (#102)

* Some refactoring

* Some refactoring
Added some localization

* Added some localization
Fix wrong branch localization in page branch overview
Simplify some localization

* Simplify some localization

* Removed unused localize method

* Simplify some localization

* Removed proxy.localise method

* Simplify localization
This commit is contained in:
Alexander Kornilov authored and mezz committed 2017-06-06 21:43:47 -07:00
1 parent 81301c3bd2
commit 1ffaad9fcd
232 files changed
+1947 -2054

No files matched your search

@@ -1,13 +1,13 @@
package binnie.genetics.gui;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.util.I18N;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IBee;
import forestry.api.genetics.IIndividual;
@@ -36,9 +36,9 @@ public class AnalystPageBehaviour extends ControlAnalystPage {
IAlleleBeeEffect effect = bee.getGenome().getEffect();
int[] t = bee.getGenome().getTerritory();
if (!effect.getUID().contains("None")) {
String effectDesc = BinnieCore.proxy.localiseOrBlank("allele." + effect.getUID() + ".desc");
String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc");
String loc = effectDesc.equals("") ? ("Effect: " + effect.getName()) : effectDesc;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc, TextJustification.TopCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc, TextJustification.TOP_CENTER).setColor(getColor());
y += (int) (CraftGUI.Render.textHeight(loc, w() - 8.0f) + 1.0f);
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Within " + (int) (t[0] / 2.0f) + " blocks").setColor(getColor());
y += 22;
@@ -57,9 +57,9 @@ public class AnalystPageBehaviour extends ControlAnalystPage {
y += 22;
IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect();
if (!effect2.getUID().contains("None")) {
String effectDesc2 = BinnieCore.proxy.localiseOrBlank("allele." + effect2.getUID() + ".desc");
String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc");
String loc2 = effectDesc2.equals("") ? ("Effect: " + effect2.getName()) : effectDesc2;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc2, TextJustification.TopCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc2, TextJustification.TOP_CENTER).setColor(getColor());
y += (int) (CraftGUI.Render.textHeight(loc2, w() - 8.0f) + 1.0f);
y += 22;
}
@@ -48,17 +48,17 @@ public class AnalystPageClimate extends ControlAnalystPage {
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Climate").setColor(getColor());
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Temp. Tolerance", TextJustification.MiddleCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Temp. Tolerance", 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.MiddleCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Humidity Tolerance", 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.MiddleCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Biomes", TextJustification.MIDDLE_CENTER).setColor(getColor());
y += 12;
List<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
@@ -97,7 +97,7 @@ public class AnalystPageDatabase extends ControlAnalystPage {
@Override
public void onRenderBackground() {
CraftGUI.Render.text(getArea(), TextJustification.MiddleCenter, value.getName(), 16777215);
CraftGUI.Render.text(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 16777215);
}
};
}
@@ -54,8 +54,8 @@ public class AnalystPageDescription extends ControlAnalystPage {
y += (int) (3.0f + CraftGUI.Render.textHeight("Discovered by " + EnumChatFormatting.BOLD + authority + EnumChatFormatting.RESET, w()));
new ControlTextCentered(this, y, "Genetic Complexity: " + species.getComplexity()).setColor(getColor());
y += 26;
ControlText descText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descBody + EnumChatFormatting.RESET, TextJustification.TopCenter);
IWidget signatureText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descSig + EnumChatFormatting.RESET, TextJustification.BottomRight);
ControlText descText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descBody + EnumChatFormatting.RESET, TextJustification.TOP_CENTER);
IWidget signatureText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descSig + EnumChatFormatting.RESET, TextJustification.BOTTOM_RIGHT);
descText.setColor(getColor());
signatureText.setColor(getColor());
float descHeight = CraftGUI.Render.textHeight(descText.getValue(), descText.getSize().x());
@@ -47,8 +47,8 @@ public class AnalystPageGenome extends ControlAnalystPage {
IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo);
String alleleName = system.getAlleleName(chromo, allele);
float height = CraftGUI.Render.textHeight(alleleName, w() / 2.0f - 2.0f);
new ControlText(scaled, new IArea(0.0f, y + (height - 9.0f) / 2.0f, w() / 2.0f - 2.0f, 0.0f), system.getChromosomeShortName(chromo) + " :", TextJustification.TopRight).setColor(getColor());
new ControlText(scaled, new IArea(w() / 2.0f + 2.0f, y, w() / 2.0f - 2.0f, 0.0f), alleleName, TextJustification.TopLeft).setColor(getColor());
new ControlText(scaled, new IArea(0.0f, y + (height - 9.0f) / 2.0f, w() / 2.0f - 2.0f, 0.0f), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT).setColor(getColor());
new ControlText(scaled, new IArea(w() / 2.0f + 2.0f, y, w() / 2.0f - 2.0f, 0.0f), alleleName, TextJustification.TOP_LEFT).setColor(getColor());
y += (int) (3.0f + height);
}
setSize(new IPoint(w(), y + 8));
@@ -259,7 +259,7 @@ public class AnalystPageMutations extends ControlAnalystPage {
@Override
public void onRenderBackground() {
CraftGUI.Render.text(getArea(), TextJustification.MiddleCenter, "UNKNOWN", 11184810);
CraftGUI.Render.text(getArea(), TextJustification.MIDDLE_CENTER, "UNKNOWN", 11184810);
}
}
}
@@ -32,15 +32,15 @@ public class AnalystPageSoil extends ControlAnalystPage {
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Soil").setColor(getColor());
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Moisture Tolerance", TextJustification.MiddleCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Moisture Tolerance", TextJustification.MIDDLE_CENTER).setColor(getColor());
y += 12;
createMoisture(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "pH Tolerance", TextJustification.MiddleCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "pH Tolerance", TextJustification.MIDDLE_CENTER).setColor(getColor());
y += 12;
createAcidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Recommended Soil", TextJustification.MiddleCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Recommended Soil", TextJustification.MIDDLE_CENTER).setColor(getColor());
y += 12;
EnumMoisture recomMoisture = EnumMoisture.NORMAL;
boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol);
@@ -82,7 +82,7 @@ public class AnalystPageSoil extends ControlAnalystPage {
recomSoil.setItemStack(stack);
recomSoil.setTooltip();
y += 32;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Other Soils", TextJustification.MiddleCenter).setColor(getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Other Soils", TextJustification.MIDDLE_CENTER).setColor(getColor());
y += 12;
List<ItemStack> stacks = new ArrayList<>();
for (EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) {
@@ -23,8 +23,8 @@ public class ControlGenesisOption extends ControlOption<Gene> {
@Override
public void onRenderBackground() {
super.onRenderBackground();
CraftGUI.Render.text(new IArea(0.0f, 0.0f, 70.0f, 22.0f), TextJustification.MiddleCenter, getChromosomeName(), getColor());
CraftGUI.Render.text(new IArea(75.0f, 0.0f, 80.0f, 22.0f), TextJustification.MiddleCenter, getAlleleName(), getColor());
CraftGUI.Render.text(new IArea(0.0f, 0.0f, 70.0f, 22.0f), TextJustification.MIDDLE_CENTER, getChromosomeName(), getColor());
CraftGUI.Render.text(new IArea(75.0f, 0.0f, 80.0f, 22.0f), TextJustification.MIDDLE_CENTER, getAlleleName(), getColor());
CraftGUI.Render.solid(new IArea(70.0f, 2.0f, 1.0f, 16.0f), 0xff000000 + getColor());
}
@@ -29,8 +29,8 @@ import binnie.core.genetics.BreedingSystem;
import binnie.core.machines.inventory.SlotValidator;
import binnie.genetics.Genetics;
import binnie.genetics.item.GeneticsItems;
import binnie.genetics.machine.analyser.Analyser;
import binnie.genetics.machine.ModuleMachine;
import binnie.genetics.machine.analyser.Analyser;
import cpw.mods.fml.relauncher.Side;
import forestry.api.apiculture.IBee;
import forestry.api.arboriculture.ITree;