[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,7 +1,5 @@
package binnie.extrabees.gui.database;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.IWidget;
@@ -11,8 +9,6 @@ import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import net.minecraft.world.biome.BiomeGenBase;
import java.util.ArrayList;
@@ -55,12 +51,5 @@ public class ControlBiomes extends Control implements ITooltip {
public void setSpecies(IAlleleBeeSpecies species) {
tolerated.clear();
if (species == null) {
return;
}
// TODO unused code?
IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
}
}
@@ -15,31 +15,36 @@ import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.EnumTolerance;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
public class ControlClimateBar extends Control implements ITooltip {
protected boolean isHumidity;
protected List<Integer> tolerated;
protected int[] tempColours;
protected int[] humidColours;
protected Color[] tempColours = new Color[]{
new Color(0x00fffb),
new Color(0x78bbff),
new Color(0x4fff30),
new Color(0xffff00),
new Color(0xffa200),
new Color(0xff0000)
};
protected Color[] humidColours = new Color[]{
new Color(0xffe7a3),
new Color(0x1aff00),
new Color(0x307cff)
};
public ControlClimateBar(IWidget parent, int x, int y, int width, int height) {
super(parent, x, y, width, height);
isHumidity = false;
tolerated = new ArrayList<>();
tempColours = new int[]{0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000};
humidColours = new int[]{0xffe7a3, 0x1aff00, 0x307cff};
addAttribute(WidgetAttribute.MOUSE_OVER);
this(parent, x, y, width, height, false);
}
public ControlClimateBar(IWidget parent, int x, int y, int width, int height, boolean humidity) {
super(parent, x, y, width, height);
tolerated = new ArrayList<>();
tempColours = new int[]{0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000};
humidColours = new int[]{0xffe7a3, 0x1aff00, 0x307cff};
addAttribute(WidgetAttribute.MOUSE_OVER);
isHumidity = true;
isHumidity = humidity;
}
@Override
@@ -69,13 +74,13 @@ public class ControlClimateBar extends Control implements ITooltip {
for (int i = 0; i < types; ++i) {
int x = i * w;
if (tolerated.contains(i)) {
int colour;
Color color;
if (isHumidity) {
colour = humidColours[i];
color = humidColours[i];
} else {
colour = tempColours[i];
color = tempColours[i];
}
CraftGUI.Render.solid(new IArea(x + 1, 1.0f, w, getSize().y() - 2.0f), colour);
CraftGUI.Render.solid(new IArea(x + 1, 1.0f, w, getSize().y() - 2.0f), color.getRGB());
}
}
CraftGUI.Render.texture(CraftGUITexture.EnergyBarGlass, getArea());
@@ -7,6 +7,7 @@ import binnie.core.craftgui.controls.listbox.ControlOption;
import binnie.core.craftgui.geometry.CraftGUIUtil;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.util.I18N;
import java.text.DecimalFormat;
@@ -31,11 +32,11 @@ public class ControlProductsItem extends ControlOption<ControlProductsBox.Produc
DecimalFormat df = new DecimalFormat("#.0");
if (hours > 1.0f) {
textWidget.setValue("Every " + df.format(hours) + " hours");
textWidget.setValue(I18N.localise("extrabees.gui.database.tab.species.products.everyHours", df.format(hours)));
} else if (minutes > 1.0f) {
textWidget.setValue("Every " + df.format(minutes) + " min.");
textWidget.setValue(I18N.localise("extrabees.gui.database.tab.species.products.everyMins", df.format(minutes)));
} else {
textWidget.setValue("Every " + df.format(seconds) + " sec.");
textWidget.setValue(I18N.localise("extrabees.gui.database.tab.species.products.everySecs", df.format(seconds)));
}
}
}
@@ -1,7 +1,6 @@
package binnie.extrabees.gui.database;
import binnie.Binnie;
import binnie.core.BinnieCore;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.controls.ControlTextCentered;
@@ -9,7 +8,6 @@ import binnie.core.craftgui.database.DatabaseTab;
import binnie.core.craftgui.database.PageSpecies;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.TextJustification;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
@@ -30,28 +28,28 @@ public class PageSpeciesGenome extends PageSpecies {
public PageSpeciesGenome(IWidget parent, DatabaseTab tab) {
super(parent, tab);
title = new ControlTextCentered(this, 8.0f, "Genome");
new ControlText(this, new IArea(0.0f, 32.0f, 68.0f, 30.0f), "Speed:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 44.0f, 68.0f, 30.0f), "Lifespan:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 56.0f, 68.0f, 30.0f), "Fertility:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 68.0f, 68.0f, 30.0f), "Flowering:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 80.0f, 68.0f, 30.0f), "Territory:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 97.0f, 68.0f, 30.0f), "Behavior:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 109.0f, 68.0f, 30.0f), "Sunlight:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 121.0f, 68.0f, 30.0f), "Rain:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 138.0f, 68.0f, 30.0f), "Flower:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 155.0f, 68.0f, 30.0f), "Effect:", TextJustification.TopRight);
new ControlText(this, new IArea(0.0f, 32.0f, 68.0f, 30.0f), "Speed:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 44.0f, 68.0f, 30.0f), "Lifespan:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 56.0f, 68.0f, 30.0f), "Fertility:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 68.0f, 68.0f, 30.0f), "Flowering:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 80.0f, 68.0f, 30.0f), "Territory:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 97.0f, 68.0f, 30.0f), "Behavior:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 109.0f, 68.0f, 30.0f), "Sunlight:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 121.0f, 68.0f, 30.0f), "Rain:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 138.0f, 68.0f, 30.0f), "Flower:", TextJustification.TOP_RIGHT);
new ControlText(this, new IArea(0.0f, 155.0f, 68.0f, 30.0f), "Effect:", TextJustification.TOP_RIGHT);
int x = 72;
speedText = new ControlText(this, new IArea(x, 32.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
lifespanText = new ControlText(this, new IArea(x, 44.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
fertilityText = new ControlText(this, new IArea(x, 56.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
floweringText = new ControlText(this, new IArea(x, 68.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
territoryText = new ControlText(this, new IArea(x, 80.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
nocturnalText = new ControlText(this, new IArea(x, 97.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
caveDwellingText = new ControlText(this, new IArea(x, 109.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
tolerantFlyerText = new ControlText(this, new IArea(x, 121.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
flowerText = new ControlText(this, new IArea(x, 138.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
effectText = new ControlText(this, new IArea(x, 155.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
speedText = new ControlText(this, new IArea(x, 32.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
lifespanText = new ControlText(this, new IArea(x, 44.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
fertilityText = new ControlText(this, new IArea(x, 56.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
floweringText = new ControlText(this, new IArea(x, 68.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
territoryText = new ControlText(this, new IArea(x, 80.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
nocturnalText = new ControlText(this, new IArea(x, 97.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
caveDwellingText = new ControlText(this, new IArea(x, 109.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
tolerantFlyerText = new ControlText(this, new IArea(x, 121.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
flowerText = new ControlText(this, new IArea(x, 138.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
effectText = new ControlText(this, new IArea(x, 155.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT);
}
public static String rateFlowering(int flowering) {
@@ -144,7 +142,6 @@ public class PageSpeciesGenome extends PageSpecies {
}
IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
speedText.setValue(rateSpeed(genome.getSpeed()));
lifespanText.setValue(rateLifespan(genome.getLifespan()));
fertilityText.setValue(genome.getFertility() + " children");