mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 19:59:49 +00:00
Added missed localization
This commit is contained in:
1 parent
4d1d3d1cca
commit
b5989356ce
3 files changed
+102
-61
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user