diff --git a/src/main/java/binnie/genetics/gui/AnalystPageAppearance.java b/src/main/java/binnie/genetics/gui/AnalystPageAppearance.java index e2dc4c51..af4d54dc 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageAppearance.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageAppearance.java @@ -9,28 +9,32 @@ import binnie.core.craftgui.controls.ControlTextCentered; import binnie.core.craftgui.geometry.IArea; import binnie.core.craftgui.geometry.IPoint; import binnie.core.craftgui.minecraft.control.ControlIconDisplay; -import forestry.api.genetics.IAlleleSpecies; +import binnie.core.util.I18N; import net.minecraft.util.EnumChatFormatting; import org.lwjgl.opengl.GL11; public class AnalystPageAppearance extends ControlAnalystPage { public AnalystPageAppearance(IWidget parent, IArea area, IFlower ind) { super(parent, area); - setColor(3355443); + setColor(0x333333); int y = 4; - IAlleleSpecies species = ind.getGenome().getPrimary(); - new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Appearance").setColor(getColor()); + new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()) + .setColor(getColor()); y += 12; + ControlColorDisplay a = new ControlColorDisplay(this, w() / 2.0f - 28.0f, y); a.setValue(ind.getGenome().getPrimaryColor()); - a.addTooltip("Primary Petal Colour"); + a.addTooltip(I18N.localise("genetics.gui.analyst.primaryColor")); + ControlColorDisplay b = new ControlColorDisplay(this, w() / 2.0f - 8.0f, y); b.setValue(ind.getGenome().getSecondaryColor()); - b.addTooltip("Secondary Petal Colour"); + b.addTooltip(I18N.localise("genetics.gui.analyst.secondaryColor")); + ControlColorDisplay c = new ControlColorDisplay(this, w() / 2.0f + 12.0f, y); c.setValue(ind.getGenome().getStemColor()); - c.addTooltip("Stem Colour"); + c.addTooltip(I18N.localise("genetics.gui.analyst.stemColor")); y += 26; + int sections = ind.getGenome().getType().getSections(); int w = (sections > 1) ? 50 : 100; @@ -66,6 +70,6 @@ public class AnalystPageAppearance extends ControlAnalystPage { @Override public String getTitle() { - return "Appearance"; + return I18N.localise("genetics.gui.analyst.appearance"); } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java b/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java index 145aee6c..79cdd8cc 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java @@ -20,54 +20,75 @@ import net.minecraft.util.EnumChatFormatting; public class AnalystPageBehaviour extends ControlAnalystPage { public AnalystPageBehaviour(IWidget parent, IArea area, IIndividual ind) { super(parent, area); - setColor(6684723); + setColor(0x660033); int y = 4; - new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Behaviour").setColor(getColor()); + new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()) + .setColor(getColor()); y += 12; if (ind instanceof IBee) { IBee bee = (IBee) ind; y += 8; int fertility = bee.getGenome().getFlowering(); - new ControlTextCentered(this, y, "Pollinates nearby\n" + bee.getGenome().getFlowerProvider().getDescription()).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n" + bee.getGenome().getFlowerProvider().getDescription()) + .setColor(getColor()); y += 20; - new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Every " + getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100.0f / fertility)).setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.everyTime", getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100.0f / fertility))) + .setColor(getColor()); y += 22; + IAlleleBeeEffect effect = bee.getGenome().getEffect(); int[] t = bee.getGenome().getTerritory(); if (!effect.getUID().contains("None")) { 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.TOP_CENTER).setColor(getColor()); + String loc = effectDesc.isEmpty() + ? I18N.localise("genetics.gui.analyst.behaviour.effect", effect.getName()) + : effectDesc; + + 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()); + + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.withinBlocks", (int) (t[0] / 2.0f))) + .setColor(getColor()); y += 22; } - new ControlTextCentered(this, y, "Territory: " + EnumChatFormatting.ITALIC + t[0] + "x" + t[1] + "x" + t[2]).setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.territory", t[0], t[1], t[2])) + .setColor(getColor()); y += 22; } if (ind instanceof IButterfly) { IButterfly bee2 = (IButterfly) ind; - new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Metabolism: " + Binnie.Genetics.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))).setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.metabolism", Binnie.Genetics.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM)))) + .setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "Pollinates nearby\n" + bee2.getGenome().getFlowerProvider().getDescription()).setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n" + bee2.getGenome().getFlowerProvider().getDescription()) + .setColor(getColor()); y += 20; - new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Every " + getTimeString(1500.0f)).setColor(getColor()); + + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.everyTime", getTimeString(1500.0f))) + .setColor(getColor()); y += 22; + IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect(); if (!effect2.getUID().contains("None")) { 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.TOP_CENTER).setColor(getColor()); - y += (int) (CraftGUI.Render.textHeight(loc2, w() - 8.0f) + 1.0f); - y += 22; + String loc2 = effectDesc2.isEmpty() + ? I18N.localise("genetics.gui.analyst.behaviour.effect", effect2.getName()) + : effectDesc2; + + new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc2, TextJustification.TOP_CENTER) + .setColor(getColor()); } } } @Override public String getTitle() { - return "Behaviour"; + return I18N.localise("genetics.gui.analyst.behaviour"); } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java b/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java index a24d2f18..b6f26432 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java @@ -16,6 +16,7 @@ import binnie.core.craftgui.minecraft.MinecraftGUI; import binnie.core.craftgui.resource.minecraft.CraftGUITexture; import binnie.core.craftgui.window.Panel; import binnie.core.genetics.BreedingSystem; +import binnie.core.util.I18N; import forestry.api.arboriculture.EnumTreeChromosome; import forestry.api.genetics.IAlleleSpecies; import forestry.api.genetics.IIndividual; @@ -44,7 +45,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness); setColor(newColour); int y = 4; - new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Registry").setColor(getColor()); + new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; new ControlTextEdit(this, 20.0f, y, w() - 40.0f, 16.0f) { @Override @@ -63,7 +64,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { @Override public void onRenderBackground() { - CraftGUI.Render.color(5592405); + CraftGUI.Render.color(0x555555); CraftGUI.Render.texture(CraftGUITexture.TabSolid, getArea().inset(1)); CraftGUI.Render.color(AnalystPageDatabase.this.getColor()); CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea()); @@ -97,13 +98,14 @@ public class AnalystPageDatabase extends ControlAnalystPage { @Override public void onRenderBackground() { - CraftGUI.Render.text(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 16777215); + CraftGUI.Render.text(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 0xffffff); } }; } }; } else { - (scroll = new ControlScrollableContent(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f, 0.0f)).setScrollableContent(getItemScrollList(system, options)); + scroll = new ControlScrollableContent(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f, 0.0f); + scroll.setScrollableContent(getItemScrollList(system, options)); } new ControlScrollBar(this, scroll.x() + scroll.w() - 6.0f, scroll.y() + 3.0f, 3.0f, scroll.h() - 6.0f, scroll) { @Override @@ -111,7 +113,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { if (!isEnabled()) { return; } - CraftGUI.Render.gradientRect(getArea(), 1140850688 + AnalystPageDatabase.this.getColor(), 1140850688 + AnalystPageDatabase.this.getColor()); + CraftGUI.Render.gradientRect(getArea(), 0x44000000 + AnalystPageDatabase.this.getColor(), 0x44000000 + AnalystPageDatabase.this.getColor()); CraftGUI.Render.solid(getRenderArea(), AnalystPageDatabase.this.getColor()); } }; @@ -143,12 +145,12 @@ public class AnalystPageDatabase extends ControlAnalystPage { public void onRenderBackground() { WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent(); if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) { - CraftGUI.Render.color(15658734); + CraftGUI.Render.color(0xeeeeee); CraftGUI.Render.texture(CraftGUITexture.TabSolid, getArea().outset(1)); CraftGUI.Render.color(AnalystPageDatabase.this.getColor()); CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea().outset(1)); } else if (calculateIsMouseOver()) { - CraftGUI.Render.color(15658734); + CraftGUI.Render.color(0xeeeeee); CraftGUI.Render.texture(CraftGUITexture.TabSolid, getArea().outset(1)); } super.onRenderBackground(); @@ -167,7 +169,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { @Override public String getTitle() { - return "Registry"; + return I18N.localise("genetics.gui.analyst.registry"); } private Collection getSpecies(BreedingSystem system) { diff --git a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java index c7c62469..98353e91 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java @@ -10,6 +10,7 @@ import binnie.core.craftgui.geometry.IArea; import binnie.core.craftgui.geometry.IPoint; import binnie.core.craftgui.geometry.TextJustification; import binnie.core.genetics.BreedingSystem; +import binnie.core.util.I18N; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IAllele; import forestry.api.genetics.IChromosomeType; @@ -24,7 +25,7 @@ public class AnalystPageGenome extends ControlAnalystPage { public AnalystPageGenome(IWidget parent, IArea area, boolean active, IIndividual ind) { super(parent, area); this.active = active; - setColor(26265); + setColor(0x006699); int y = 4; new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; @@ -43,12 +44,15 @@ public class AnalystPageGenome extends ControlAnalystPage { GL11.glPopMatrix(); } }; + for (IChromosomeType chromo : system.getActiveKaryotype()) { 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.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()); + 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)); @@ -56,6 +60,9 @@ public class AnalystPageGenome extends ControlAnalystPage { @Override public String getTitle() { - return (active ? "Active" : "Inactive") + " Genome"; + if (active) { + return I18N.localise("genetics.gui.analyst.genome.active"); + } + return I18N.localise("genetics.gui.analyst.genome.inactive"); } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java b/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java index 8bd041f8..008a7376 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java @@ -5,6 +5,7 @@ import binnie.core.craftgui.IWidget; import binnie.core.craftgui.controls.ControlTextCentered; import binnie.core.craftgui.geometry.IArea; import binnie.core.genetics.BreedingSystem; +import binnie.core.util.I18N; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IChromosomeType; import forestry.api.genetics.IIndividual; @@ -14,11 +15,12 @@ import net.minecraft.util.EnumChatFormatting; public class AnalystPageKaryogram extends ControlAnalystPage { public AnalystPageKaryogram(IWidget parent, IArea area, IIndividual ind) { super(parent, area); - setColor(10040319); + setColor(0x9933ff); int y = 4; - new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Karyogram").setColor(getColor()); - y += 16; - y += 8; + new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()) + .setColor(getColor()); + + y += 24; ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass()); BreedingSystem system = Binnie.Genetics.getSystem(root); int maxBiomePerLine = (int) ((w() + 4.0f - 16.0f) / 22.0f); @@ -42,6 +44,6 @@ public class AnalystPageKaryogram extends ControlAnalystPage { @Override public String getTitle() { - return "Karyogram"; + return I18N.localise("genetics.gui.analyst.karyogram"); } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageProduce.java b/src/main/java/binnie/genetics/gui/AnalystPageProduce.java index 8c6cb984..fd5ca84f 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageProduce.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageProduce.java @@ -45,6 +45,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { isRecipe = true; } } + if (isRecipe) { for (Object obj : recipe.getValue()) { if (obj instanceof ItemStack) { @@ -65,6 +66,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { isRecipe = true; } } + if (isRecipe) { for (Object obj : recipe.getValue()) { if (obj instanceof ItemStack) { @@ -87,10 +89,12 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { match = false; } } + if (match) { products.add(recipe.getRecipeOutput()); } } + if (recipeO instanceof ShapedRecipes) { ShapedRecipes recipe2 = (ShapedRecipes) recipeO; boolean match = true; @@ -99,10 +103,12 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { match = false; } } + if (match) { products.add(recipe2.getRecipeOutput()); } } + if (recipeO instanceof ShapelessOreRecipe) { ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO; boolean match = true; @@ -111,6 +117,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { match = false; } } + if (!match) { continue; } @@ -135,6 +142,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { isRecipe = true; } } + if (isRecipe) { for (Object obj : recipe.getValue()) { if (obj instanceof FluidStack) { @@ -147,8 +155,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { } protected Collection getAllProducts(FluidStack stack) { - Collection fluids = new UniqueFluidStackSet(); - return fluids; + return new UniqueFluidStackSet(); } protected Collection getAllProductsAndFluids(Collection collection) { @@ -156,28 +163,34 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { for (ItemStack stack : collection) { products.addAll(getAllProducts(stack)); } + Collection products2 = new UniqueItemStackSet(); for (ItemStack stack2 : products) { products2.addAll(getAllProducts(stack2)); } + Collection products3 = new UniqueItemStackSet(); for (ItemStack stack3 : products2) { products3.addAll(getAllProducts(stack3)); } + products.addAll(products2); products.addAll(products3); Collection allFluids = new UniqueFluidStackSet(); for (ItemStack stack4 : collection) { allFluids.addAll(getAllFluids(stack4)); } + Collection fluids2 = new UniqueFluidStackSet(); for (FluidStack stack5 : allFluids) { fluids2.addAll(getAllProducts(stack5)); } + Collection fluids3 = new UniqueFluidStackSet(); for (FluidStack stack6 : fluids2) { fluids3.addAll(getAllProducts(stack6)); } + allFluids.addAll(fluids2); allFluids.addAll(fluids3); for (FluidStack fluid : allFluids) { @@ -187,10 +200,12 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { container = data.filledContainer; break; } + if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket)) && data.fluid.isFluidEqual(fluid)) { container = data.filledContainer; break; } + if (data.fluid.isFluidEqual(fluid)) { container = data.filledContainer; break; @@ -215,6 +230,7 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { dx = 0; dy += 18; } + FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(soilStack); soilStack.stackSize = 1; ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null); @@ -223,10 +239,10 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { } dx += 18; } + if (dx != 0) { dy += 18; } - y += dy; - return y; + return y + dy; } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageSoil.java b/src/main/java/binnie/genetics/gui/AnalystPageSoil.java index b00820ce..573cfd4a 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageSoil.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageSoil.java @@ -12,6 +12,7 @@ import binnie.core.craftgui.geometry.IArea; import binnie.core.craftgui.geometry.TextJustification; import binnie.core.craftgui.minecraft.control.ControlItemDisplay; import binnie.core.genetics.Tolerance; +import binnie.core.util.I18N; import binnie.genetics.genetics.AlleleHelper; import forestry.api.genetics.EnumTolerance; import net.minecraft.item.ItemStack; @@ -30,17 +31,27 @@ public class AnalystPageSoil extends ControlAnalystPage { EnumAcidity pH = flower.getGenome().getPrimary().getPH(); EnumTolerance pHTol = flower.getGenome().getTolerancePH(); int y = 4; - new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Soil").setColor(getColor()); + new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()) + .setColor(getColor()); + y += 16; - new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Moisture Tolerance", TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.moistureTolerance"), 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.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.pHTolerance"), 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.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.recommendedSoil"), TextJustification.MIDDLE_CENTER) + .setColor(getColor()); + y += 12; EnumMoisture recomMoisture = EnumMoisture.NORMAL; boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol); @@ -59,6 +70,7 @@ public class AnalystPageSoil extends ControlAnalystPage { recomMoisture = EnumMoisture.DAMP; } } + EnumAcidity recomPH = EnumAcidity.NEUTRAL; boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.NEUTRAL, pHTol); boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.ACID, pHTol); @@ -77,12 +89,15 @@ public class AnalystPageSoil extends ControlAnalystPage { recomPH = EnumAcidity.ALKALINE; } } + ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture)); ControlItemDisplay recomSoil = new ControlItemDisplay(this, (w() - 24.0f) / 2.0f, y, 24.0f); recomSoil.setItemStack(stack); recomSoil.setTooltip(); y += 32; - new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Other Soils", TextJustification.MIDDLE_CENTER).setColor(getColor()); + new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.otherSoils"), TextJustification.MIDDLE_CENTER) + .setColor(getColor()); + y += 12; List stacks = new ArrayList<>(); for (EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) { @@ -92,6 +107,7 @@ public class AnalystPageSoil extends ControlAnalystPage { } } } + float soilListWidth = 17 * stacks.size() - 1; float soilListX = (w() - soilListWidth) / 2.0f; int t = 0; @@ -110,7 +126,7 @@ public class AnalystPageSoil extends ControlAnalystPage { } @Override - protected int getColour(EnumMoisture value) { + protected int getColor(EnumMoisture value) { return (new int[]{0xccffcc, 0x66ccff, 0x3366ff})[value.ordinal()]; } }.setValues(value, tol); @@ -124,7 +140,7 @@ public class AnalystPageSoil extends ControlAnalystPage { } @Override - protected int getColour(EnumAcidity value) { + protected int getColor(EnumAcidity value) { return (new int[]{0xff0066, 0x00ff00, 0x0066ff})[value.ordinal()]; } }.setValues(value, tol); @@ -132,6 +148,6 @@ public class AnalystPageSoil extends ControlAnalystPage { @Override public String getTitle() { - return "Soil"; + return I18N.localise("genetics.gui.analyst.soil"); } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageSpecimen.java b/src/main/java/binnie/genetics/gui/AnalystPageSpecimen.java index 32d36cc7..a7524e26 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageSpecimen.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageSpecimen.java @@ -3,15 +3,18 @@ package binnie.genetics.gui; import binnie.core.craftgui.IWidget; import binnie.core.craftgui.controls.ControlTextCentered; import binnie.core.craftgui.geometry.IArea; +import binnie.core.util.I18N; import forestry.api.lepidopterology.IButterfly; import net.minecraft.util.EnumChatFormatting; public class AnalystPageSpecimen extends ControlAnalystPage { public AnalystPageSpecimen(IWidget parent, IArea area, IButterfly ind) { super(parent, area); - setColor(3355443); + setColor(0x333333); int y = 4; - new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Specimen").setColor(getColor()); + new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()) + .setColor(getColor()); + y += 12; float w = (w() - 16.0f) * ind.getSize(); new ControlIndividualDisplay(this, (w() - w) / 2.0f, y + (w() - w) / 2.0f, w, ind); @@ -19,6 +22,6 @@ public class AnalystPageSpecimen extends ControlAnalystPage { @Override public String getTitle() { - return "Specimen"; + return I18N.localise("genetics.gui.analyst.specimen"); } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageWood.java b/src/main/java/binnie/genetics/gui/AnalystPageWood.java index 3c4b8a57..d1148130 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageWood.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageWood.java @@ -6,6 +6,7 @@ import binnie.core.craftgui.geometry.IArea; import binnie.core.craftgui.geometry.IPoint; import binnie.core.craftgui.minecraft.control.ControlIconDisplay; import binnie.core.craftgui.minecraft.control.ControlItemDisplay; +import binnie.core.util.I18N; import binnie.core.util.UniqueItemStackSet; import binnie.extratrees.FakeWorld; import binnie.genetics.item.ModuleItem; @@ -22,15 +23,19 @@ import java.util.Collection; public class AnalystPageWood extends AnalystPageProduce { public AnalystPageWood(IWidget parent, IArea area, ITree ind) { super(parent, area); - setColor(6697728); + setColor(0x663300); ITreeGenome genome = ind.getGenome(); int y = 4; - new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Wood").setColor(getColor()); + new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()) + .setColor(getColor()); y += 12; + if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) { - new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconNoFire.getIcon()).addTooltip("Fireproof"); + new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconNoFire.getIcon()) + .addTooltip(I18N.localise("genetics.gui.analyst.wood.fireproof")); } else { - new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconFire.getIcon()).addTooltip("Flammable"); + new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconFire.getIcon()) + .addTooltip(I18N.localise("genetics.gui.analyst.wood.flammable")); } y += 30; Collection products = new UniqueItemStackSet(); @@ -40,12 +45,15 @@ public class AnalystPageWood extends AnalystPageProduce { if (stackWood != null) { products.add(stackWood); } + // for (ItemStack stack : // ind.getGenome().getFruitProvider().getProducts()) { // products.add(stack); // } + if (products.size() > 0) { - new ControlTextCentered(this, y, "Logs").setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs")) + .setColor(getColor()); y += 10; int w = products.size() * 18 - 2; int i = 0; @@ -56,18 +64,22 @@ public class AnalystPageWood extends AnalystPageProduce { } y += 26; } + Collection allProducts = new UniqueItemStackSet(); for (ItemStack stack2 : products) { allProducts.add(stack2); } + Collection refinedProducts = new UniqueItemStackSet(); refinedProducts.addAll(getAllProductsAndFluids(allProducts)); if (refinedProducts.size() > 0) { - y = getRefined("Refined Products", y, refinedProducts); + y = getRefined(I18N.localise("genetics.gui.analyst.wood.products"), y, refinedProducts); y += 8; } + if (products.size() == 0) { - new ControlTextCentered(this, y, "This tree has no \nfruits or nuts").setColor(getColor()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits")) + .setColor(getColor()); y += 28; } setSize(new IPoint(w(), y + 8)); @@ -75,6 +87,6 @@ public class AnalystPageWood extends AnalystPageProduce { @Override public String getTitle() { - return "Wood"; + return I18N.localise("genetics.gui.analyst.wood"); } } diff --git a/src/main/java/binnie/genetics/gui/ControlBiome.java b/src/main/java/binnie/genetics/gui/ControlBiome.java index a936d8f6..65019f2c 100644 --- a/src/main/java/binnie/genetics/gui/ControlBiome.java +++ b/src/main/java/binnie/genetics/gui/ControlBiome.java @@ -24,10 +24,8 @@ public class ControlBiome extends Control implements ITooltip { @Override public void onRenderBackground() { - if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MOUNTAIN)) { - iconCategory = "hills"; - } - if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.HILLS)) { + if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MOUNTAIN) || + BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.HILLS)) { iconCategory = "hills"; } if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)) { @@ -45,7 +43,8 @@ public class ControlBiome extends Control implements ITooltip { if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.JUNGLE)) { iconCategory = "jungle"; } - if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.COLD) && BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) { + if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.COLD) && + BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) { iconCategory = "taiga"; } if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) { diff --git a/src/main/java/binnie/genetics/gui/ControlGenesisOption.java b/src/main/java/binnie/genetics/gui/ControlGenesisOption.java index 11b5837f..b61fe620 100644 --- a/src/main/java/binnie/genetics/gui/ControlGenesisOption.java +++ b/src/main/java/binnie/genetics/gui/ControlGenesisOption.java @@ -26,6 +26,5 @@ public class ControlGenesisOption extends ControlOption { 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()); - } } diff --git a/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java b/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java index d8b0bfb1..8d3329b2 100644 --- a/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java +++ b/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java @@ -28,6 +28,7 @@ public class ControlIndividualDisplay extends ControlItemDisplay implements IToo if (stack == null) { return; } + IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); if (ind == null) { return; diff --git a/src/main/java/binnie/genetics/gui/ControlToleranceBar.java b/src/main/java/binnie/genetics/gui/ControlToleranceBar.java index 5b14cbcd..1e1a90ac 100644 --- a/src/main/java/binnie/genetics/gui/ControlToleranceBar.java +++ b/src/main/java/binnie/genetics/gui/ControlToleranceBar.java @@ -44,15 +44,15 @@ public abstract class ControlToleranceBar> extends Control imp protected abstract String getName(T p0); - protected abstract int getColour(T p0); + protected abstract int getColor(T p0); @Override public void onRenderBackground() { - CraftGUI.Render.gradientRect(getArea(), -1431655766, -1431655766); + CraftGUI.Render.gradientRect(getArea(), 0xaaaaaaaa, 0xaaaaaaaa); float w = getArea().w() / fullSet.size(); int t = 0; for (T value : fullSet) { - int col = (tolerated.contains(value) ? -16777216 : 855638016) + getColour(value); + int col = (tolerated.contains(value) ? 0xff000000 : 0x33000000) + getColor(value); IBorder inset = new IBorder(tolerated.contains(value) ? 1.0f : 3.0f); CraftGUI.Render.gradientRect(new IArea(w * t, 0.0f, w, h()).inset(inset), col, col); ++t; diff --git a/src/main/java/binnie/genetics/gui/WindowAnalyst.java b/src/main/java/binnie/genetics/gui/WindowAnalyst.java index 76c32c3b..97645156 100644 --- a/src/main/java/binnie/genetics/gui/WindowAnalyst.java +++ b/src/main/java/binnie/genetics/gui/WindowAnalyst.java @@ -27,6 +27,7 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture; import binnie.core.craftgui.window.Panel; import binnie.core.genetics.BreedingSystem; import binnie.core.machines.inventory.SlotValidator; +import binnie.core.util.I18N; import binnie.genetics.Genetics; import binnie.genetics.item.GeneticsItems; import binnie.genetics.machine.ModuleMachine; @@ -113,14 +114,21 @@ public class WindowAnalyst extends Window { @Override public void initialiseClient() { - setTitle(isDatabase ? (isMaster ? "Master Registry" : "Registry") : "Analyst"); - BreedingSystem system = Binnie.Genetics.beeBreedingSystem; - IIndividual ind = system.getDefaultIndividual(); - ItemStack stack = system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()); + if (isDatabase) { + setTitle(I18N.localise("genetics.item.analyst.name")); + } else { + if (isMaster) { + setTitle(I18N.localise("genetics.item.registry.1.name")); + } else { + setTitle(I18N.localise("genetics.item.registry.0.name")); + } + } + getWindowInventory().createSlot(0); baseWidget = new Widget(this); int x = 16; int y = 28; + if (isDatabase) { for (BreedingSystem syst : Binnie.Genetics.getActiveSystems()) { new Control(this, x, y, 20.0f, 20.0f) { @@ -222,6 +230,7 @@ public class WindowAnalyst extends Window { analystPageSize = new IArea(1.0f, 1.0f, sectionWidth, h() - 8.0f); } }; + if (!isDatabase) { slideUpInv = new ControlSlide(this, (getSize().x() - 244.0f) / 2.0f, getSize().y() - 80.0f + 1.0f, 244.0f, 80.0f, Position.BOTTOM); new ControlPlayerInventory(slideUpInv, true); @@ -238,11 +247,12 @@ public class WindowAnalyst extends Window { } } }); + if (!isDatabase) { analystNone = new Control(analystPanel, 0.0f, 0.0f, analystPanel.w(), analystPanel.h()) { @Override public void initialise() { - new ControlTextCentered(this, 20.0f, "Add a bee, tree, flower or butterfly to the top left slot. DNA Dye is required if it has not been analysed yet. This dye can also convert vanilla items to breedable individuals.").setColor(4473924); + new ControlTextCentered(this, 20.0f, I18N.localise("genetics.gui.analyst.info")).setColor(0x444444); new ControlPlayerInventory(this); } }; @@ -258,16 +268,19 @@ public class WindowAnalyst extends Window { oldLeft = analystPages.indexOf(leftPage.getContent()); oldRight = analystPages.indexOf(rightPage.getContent()); } + ControlAnalystPage databasePage = null; if (isDatabase && !systemChange) { databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null); } + analystPages.clear(); setPage(leftPage, null); setPage(rightPage, null); if (isDatabase) { analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster)); } + if (current != null) { analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current)); analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current)); @@ -275,9 +288,11 @@ public class WindowAnalyst extends Window { analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, false, current)); analystPages.add(new AnalystPageKaryogram(analystPanel, analystPageSize, current)); } + if (!(current instanceof ITree)) { analystPages.add(new AnalystPageClimate(analystPanel, analystPageSize, current)); } + if (current instanceof IBee) { analystPages.add(new AnalystPageProducts(analystPanel, analystPageSize, (IBee) current)); } else if (current instanceof ITree) { @@ -288,6 +303,7 @@ public class WindowAnalyst extends Window { } else if (current instanceof IButterfly) { analystPages.add(new AnalystPageSpecimen(analystPanel, analystPageSize, (IButterfly) current)); } + analystPages.add(new AnalystPageBiology(analystPanel, analystPageSize, current)); if (current instanceof IBee || current instanceof IButterfly) { analystPages.add(new AnalystPageBehaviour(analystPanel, analystPageSize, current)); @@ -298,9 +314,11 @@ public class WindowAnalyst extends Window { } analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster)); } + tabBar.deleteAllChildren(); float width = tabBar.w() / analystPages.size(); float x = 0.0f; + for (ControlAnalystPage page : analystPages) { new ControlTooltip(tabBar, x, 0.0f, width, tabBar.h()) { ControlAnalystPage value; @@ -352,6 +370,7 @@ public class WindowAnalyst extends Window { }; x += width; } + if (analystPages.size() > 0) { setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0)); } @@ -419,6 +438,7 @@ public class WindowAnalyst extends Window { getWindowInventory().setInventorySlotContents(0, Analyser.analyse(getWindowInventory().getStackInSlot(0))); getWindowInventory().decrStackSize(1, 1); } + IIndividual ind = AlleleManager.alleleRegistry.getIndividual(getWindowInventory().getStackInSlot(0)); if (ind != null) { ind.getGenome().getSpeciesRoot().getBreedingTracker(getWorld(), getUsername()).registerBirth(ind); diff --git a/src/main/resources/assets/genetics/lang/en_GB.lang b/src/main/resources/assets/genetics/lang/en_GB.lang index 0b8a4b3e..bc1dd9c2 100644 --- a/src/main/resources/assets/genetics/lang/en_GB.lang +++ b/src/main/resources/assets/genetics/lang/en_GB.lang @@ -20,3 +20,7 @@ genetics.machine.acclimatiser.error.noAcclimatizingItems=No Acclimatising Items genetics.machine.acclimatiser.error.invalidAcclimatizingItems=Cannot Acclimatise this individual with these items genetics.machine.advMachine.splicer.info=The Splicer is an incredibly powerful machine to insert genes into individuals. It is fast, but needs insane amounts of power. + +genetics.gui.analyst.appearance.primaryColor=Primary Petal Colour +genetics.gui.analyst.appearance.secondColor=Secondary Petal Colour +genetics.gui.analyst.appearance.stemColor=Stem Colour diff --git a/src/main/resources/assets/genetics/lang/en_US.lang b/src/main/resources/assets/genetics/lang/en_US.lang index 661f3f44..5f8510dd 100644 --- a/src/main/resources/assets/genetics/lang/en_US.lang +++ b/src/main/resources/assets/genetics/lang/en_US.lang @@ -153,3 +153,48 @@ genetics.gui.geneBank.ranking=Ranking genetics.gui.geneBank.project=Full Genome Project genetics.gui.geneBank.sequencedGenes=Sequenced %d/%d Genes genetics.gui.geneBank.sequencedGenes.short=%d/%d Genes + +genetics.gui.analyst.info=Add a bee, tree, flower or butterfly to the top left slot. DNA Dye is required if it has not been analysed yet. This dye can also convert vanilla items to breedable individuals. +genetics.gui.analyst.registry=Registry + +genetics.gui.analyst.appearance=Appearance +genetics.gui.analyst.appearance.primaryColor=Primary Petal Color +genetics.gui.analyst.appearance.secondColor=Secondary Petal Color +genetics.gui.analyst.appearance.stemColor=Stem Color + +genetics.gui.analyst.behaviour=Behaviour +genetics.gui.analyst.behaviour.effect=Effect: %s +genetics.gui.analyst.behaviour.pollinatesNearby=Pollinates nearby +genetics.gui.analyst.behaviour.withinBlocks=Within %d blocks +genetics.gui.analyst.behaviour.everyTime=Every %s +genetics.gui.analyst.behaviour.territory=Territory: %dx%dx%d +genetics.gui.analyst.behaviour.metabolism=Metabolism: %s + +genetics.gui.analyst.biology=Biology + +genetics.gui.analyst.soil=Soil +genetics.gui.analyst.soil.moistureTolerance=Moisture Tolerance +genetics.gui.analyst.soil.pHTolerance=pH Tolerance +genetics.gui.analyst.soil.recommendedSoil=Recommended Soil +genetics.gui.analyst.soil.otherSoils=Other Soils + +genetics.gui.analyst.genome.active=Active Genome +genetics.gui.analyst.genome.inactive=Inactive Genome + +genetics.gui.analyst.growth=Growth + +genetics.gui.analyst.karyogram=Karyogram + +genetics.gui.analyst.mutations=Mutations +genetics.gui.analyst.specimen=Specimen + +genetics.gui.analyst.description=Description + +genetics.gui.analyst.produce=Produce + +genetics.gui.analyst.wood=Wood +genetics.gui.analyst.wood.fireproof=Fireproof +genetics.gui.analyst.wood.flammable=Flammable +genetics.gui.analyst.wood.logs=Logs +genetics.gui.analyst.wood.products=Refined Products +genetics.gui.analyst.wood.noFruits=This tree has no\nfruits or nuts