Localise three analyst pages and fix analyser

This commit is contained in:
Nedelosk committed 2016-10-28 13:31:40 +02:00
1 parent 489ce3dece
commit d77daf41d0
8 files changed
+46 -24

No files matched your search

@@ -12,6 +12,7 @@ import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.extratrees.kitchen.ControlFluidDisplay;
import binnie.craftgui.minecraft.control.ControlItemDisplay;
import binnie.genetics.Genetics;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
@@ -19,6 +20,7 @@ import forestry.apiculture.PluginApiculture;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
@@ -35,9 +37,9 @@ public class AnalystPageProducts extends AnalystPageProduce {
final float speed = genome.getSpeed();
final float modeSpeed = Binnie.Genetics.getBeeRoot().getBeekeepingMode(BinnieCore.proxy.getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f);
int y = 4;
new ControlTextCentered(this, y, "§nProduce").setColour(this.getColour());
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour());
y += 12;
new ControlTextCentered(this, y, "§oRate: " + Binnie.Genetics.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED))).setColour(this.getColour());
new ControlTextCentered(this, y, TextFormatting.ITALIC + Genetics.proxy.localise("gui.analyst.produces.rate") + ": " + Binnie.Genetics.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED))).setColour(this.getColour());
y += 20;
final Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
final Collection<ItemStack> productList = new UniqueItemStackSet();
@@ -46,7 +48,7 @@ public class AnalystPageProducts extends AnalystPageProduce {
products.putAll(genome.getPrimary().getProductChances());
products.putAll(genome.getSecondary().getProductChances());
if (!products.isEmpty()) {
new ControlTextCentered(this, y, "Natural Products").setColour(this.getColour());
new ControlTextCentered(this, y, Genetics.proxy.localise("gui.analyst.products.natural")).setColour(this.getColour());
y += 12;
for (final Map.Entry<ItemStack, Float> entry : products.entrySet()) {
if (!productList.add(entry.getKey())) {
@@ -60,7 +62,7 @@ public class AnalystPageProducts extends AnalystPageProduce {
}
products = genome.getPrimary().getSpecialtyChances();
if (!products.isEmpty()) {
new ControlTextCentered(this, y, "Specialty Products").setColour(this.getColour());
new ControlTextCentered(this, y, Genetics.proxy.localise("gui.analyst.products.specialty")).setColour(this.getColour());
y += 12;
for (final Map.Entry<ItemStack, Float> entry : products.entrySet()) {
refinedProducts.addAll(this.getAllProducts(entry.getKey()));
@@ -69,7 +71,7 @@ public class AnalystPageProducts extends AnalystPageProduce {
}
y += 12;
}
new ControlTextCentered(this, y, "Refined Products").setColour(this.getColour());
new ControlTextCentered(this, y, Genetics.proxy.localise("gui.analyst.products.refined")).setColour(this.getColour());
y += 12;
Collection<ItemStack> level2Products = new UniqueItemStackSet();
for (final ItemStack stack : refinedProducts) {
@@ -151,7 +153,7 @@ public class AnalystPageProducts extends AnalystPageProduce {
super.getTooltip(tooltip);
final Collection<ItemStack> products = AnalystPageProducts.this.getCentrifuge(key);
if (!products.isEmpty()) {
tooltip.add("Centrifuges to give: ");
tooltip.add(Genetics.proxy.localise("gui.analyst.products.centrifuges") + ": ");
for (final ItemStack prod : products) {
final NBTTagCompound nbt = new NBTTagCompound();
prod.writeToNBT(nbt);
@@ -160,7 +162,7 @@ public class AnalystPageProducts extends AnalystPageProduce {
}
final Collection<ItemStack> liquids = AnalystPageProducts.this.getSqueezer(key);
if (!liquids.isEmpty()) {
tooltip.add("Squeezes to give: ");
tooltip.add(Genetics.proxy.localise("gui.analyst.products.squeezes") + ": ");
for (final ItemStack prod2 : liquids) {
final NBTTagCompound nbt2 = new NBTTagCompound();
prod2.writeToNBT(nbt2);
@@ -175,11 +177,11 @@ public class AnalystPageProducts extends AnalystPageProduce {
CraftGUIUtil.moveWidget(textWidget, new IPoint(12.0f, 0.0f));
item.setItemStack(key);
final float time = (int) (PluginApiculture.ticksPerBeeWorkCycle * 100.0 / (speed * value));
textWidget.setValue("Every " + this.getTimeString(time));
textWidget.setValue(Genetics.proxy.localise("gui.analyst.products.every") + " " + this.getTimeString(time));
}
@Override
public String getTitle() {
return "Produce";
return Genetics.proxy.localise("gui.analyst.produces.tile");
}
}
@@ -1,6 +1,5 @@
package binnie.genetics.gui;
import binnie.Binnie;
import binnie.botany.Botany;
import binnie.botany.api.EnumAcidity;
import binnie.botany.api.EnumMoisture;
@@ -13,8 +12,10 @@ import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.TextJustification;
import binnie.craftgui.minecraft.control.ControlItemDisplay;
import binnie.genetics.Genetics;
import forestry.api.genetics.EnumTolerance;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList;
import java.util.EnumSet;
@@ -29,17 +30,17 @@ public class AnalystPageSoil extends ControlAnalystPage {
final EnumAcidity pH = flower.getGenome().getPrimary().getPH();
final EnumTolerance pHTol = flower.getGenome().getTolerancePH();
int y = 4;
new ControlTextCentered(this, y, "§nSoil").setColour(this.getColour());
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour());
y += 16;
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Moisture Tolerance", TextJustification.MiddleCenter).setColour(this.getColour());
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), Genetics.proxy.localise("gui.analyst.soil.tolerance.moisture"), TextJustification.MiddleCenter).setColour(this.getColour());
y += 12;
this.createMoisture(this, (this.w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
y += 16;
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "pH Tolerance", TextJustification.MiddleCenter).setColour(this.getColour());
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), Genetics.proxy.localise("gui.analyst.soil.tolerance.ph"), TextJustification.MiddleCenter).setColour(this.getColour());
y += 12;
this.createAcidity(this, (this.w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
y += 16;
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Recommended Soil", TextJustification.MiddleCenter).setColour(this.getColour());
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), Genetics.proxy.localise("gui.analyst.soil.recommended"), TextJustification.MiddleCenter).setColour(this.getColour());
y += 12;
EnumMoisture recomMoisture = EnumMoisture.Normal;
final boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.Normal, moistureTol);
@@ -82,7 +83,7 @@ public class AnalystPageSoil extends ControlAnalystPage {
recomSoil.setItemStack(stack);
recomSoil.setTooltip();
y += 32;
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Other Soils", TextJustification.MiddleCenter).setColour(this.getColour());
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), Genetics.proxy.localise("gui.analyst.soil.other"), TextJustification.MiddleCenter).setColour(this.getColour());
y += 12;
final List<ItemStack> stacks = new ArrayList<>();
for (final EnumAcidity a : EnumSet.range(EnumAcidity.Acid, EnumAcidity.Alkaline)) {
@@ -106,7 +107,7 @@ public class AnalystPageSoil extends ControlAnalystPage {
new ControlToleranceBar<EnumMoisture>(parent, x, y, w, h, EnumMoisture.class) {
@Override
protected String getName(final EnumMoisture value) {
return Binnie.Language.localise(value);
return value.getTranslated(false);
}
@Override
@@ -120,7 +121,7 @@ public class AnalystPageSoil extends ControlAnalystPage {
new ControlToleranceBar<EnumAcidity>(parent, x, y, w, h, EnumAcidity.class) {
@Override
protected String getName(final EnumAcidity value) {
return Binnie.Language.localise(value);
return value.getTranslated(false);
}
@Override
@@ -132,6 +133,6 @@ public class AnalystPageSoil extends ControlAnalystPage {
@Override
public String getTitle() {
return "Soil";
return Genetics.proxy.localise("gui.analyst.soil.title");
}
}
@@ -3,14 +3,16 @@ package binnie.genetics.gui;
import binnie.craftgui.controls.ControlTextCentered;
import binnie.craftgui.core.IWidget;
import binnie.craftgui.core.geometry.IArea;
import binnie.genetics.Genetics;
import forestry.api.lepidopterology.IButterfly;
import net.minecraft.util.text.TextFormatting;
public class AnalystPageSpecimen extends ControlAnalystPage {
public AnalystPageSpecimen(final IWidget parent, final IArea area, final IButterfly ind) {
super(parent, area);
this.setColour(3355443);
int y = 4;
new ControlTextCentered(this, y, "§nSpecimen").setColour(this.getColour());
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour());
y += 12;
final float w = (this.w() - 16.0f) * ind.getSize();
new ControlIndividualDisplay(this, (this.w() - w) / 2.0f, y + (this.w() - w) / 2.0f, w, ind);
@@ -18,6 +20,6 @@ public class AnalystPageSpecimen extends ControlAnalystPage {
@Override
public String getTitle() {
return "Specimen";
return Genetics.proxy.localise("gui.analyst.specimen.title");
}
}
@@ -11,6 +11,7 @@ import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.geometry.IBorder;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.EnumTolerance;
import net.minecraft.util.text.TextFormatting;
import java.util.EnumSet;
@@ -36,7 +37,7 @@ public abstract class ControlToleranceBar<T extends Enum<T>> extends Control imp
final int type = (int) ((int) this.getRelativeMousePosition().x() / (this.getSize().x() / types));
for (final T tol : this.fullSet) {
if (tol.ordinal() - ((this.enumClass == EnumTemperature.class) ? 1 : 0) == type) {
list.add((this.tolerated.contains(tol) ? "" : "§8") + this.getName(tol));
list.add((this.tolerated.contains(tol) ? "" : TextFormatting.DARK_GRAY ) + this.getName(tol));
}
}
}
@@ -133,7 +133,7 @@ public class ModuleItem implements IInitializable {
'c', GeneticsItems.IntegratedCircuit.get(itemGenetics, 1),
'a', Mods.Forestry.item("portableAlyzer"),
'd', new ItemStack(Items.DIAMOND));
final Item[] dbs = {ExtraBees.dictionary, ExtraTrees.itemDictionary, ExtraTrees.itemDictionaryLepi, Botany.database};
if (BinnieCore.isBotanyActive() && BinnieCore.isExtraBeesActive() && BinnieCore.isExtraTreesActive()) {
for (final Item a2 : dbs) {
@@ -32,7 +32,6 @@ public class PackageAnalyser extends GeneticMachine.PackageGeneticBase implement
slot.forbidExtraction();
}
InventorySlot slotTarget = inventory.addSlot(Analyser.SLOT_TARGET, "analyse");
slotTarget.setValidator(new SlotValidatorUnanalysed());
slotTarget.setReadOnly();
slotTarget.forbidInteraction();
InventorySlot slotDye = inventory.addSlot(Analyser.SLOT_DYE, "dye");
@@ -39,7 +39,7 @@ public class PackageSplicer extends AdvGeneticMachine.PackageAdvGeneticBase impl
@Override
public String getTooltip() {
return Genetics.proxy.localise("genetics.machine.advMachine.splicer.tooltips.slots.serum");
return Genetics.proxy.localise("machine.advMachine.splicer.tooltips.slots.serum");
}
};
slotSerumVial.setValidator(serumValid);