Skip to content

Commit

Permalink
Clean Up
Browse files Browse the repository at this point in the history
  • Loading branch information
Nedelosk committed Jul 30, 2017
1 parent 687c440 commit afb9460
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 29 deletions.
Expand Up @@ -67,9 +67,7 @@ public void onRenderBackground(int guiWidth, int guiHeight) {
RenderUtil.drawItem(Point.ZERO, this.itemStack, this.rotating);
GlStateManager.popMatrix();
} else {
GlStateManager.disableBlend();
RenderUtil.drawItem(Point.ZERO, this.itemStack, this.rotating);
GlStateManager.enableBlend();
}
GlStateManager.enableAlpha();
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/binnie/genetics/gui/WindowAnalyst.java
Expand Up @@ -4,6 +4,7 @@
import java.util.ArrayList;
import java.util.List;

import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -395,7 +396,11 @@ public void onEvent(EventMouse.Down event) {
public void onRenderBackground(int guiWidth, int guiHeight) {
boolean active = value == leftPage.getContent() || value == rightPage.getContent();
RenderUtil.setColour((active ? -16777216 : 1140850688) + value.getColor());
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
GlStateManager.disableBlend();
GlStateManager.popMatrix();
RenderUtil.setColour(value.getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().inset(1));
super.onRenderBackground(guiWidth, guiHeight);
Expand Down
Expand Up @@ -12,4 +12,8 @@ public class AnalystConstants {
public static final String KARYOGRAM_KEY = KEY + ".karyogram";
public static final String MUTATIONS_KEY = KEY + ".mutations";
public static final String SPECIMEN_KEY = KEY + ".specimen";
public static final String WOOD_KEY = KEY + ".wood";
public static final String GROWTH_KEY = KEY + ".growth";
public static final String FRUIT_KEY = KEY + ".fruit";
public static final String CLIMATE_KEY = KEY + ".climate";
}
@@ -1,7 +1,6 @@
package binnie.genetics.gui.analyst;

import java.text.DecimalFormat;
import java.util.Locale;

import net.minecraft.util.text.TextFormatting;

Expand Down Expand Up @@ -174,10 +173,10 @@ public AnalystPageBiology(IWidget parent, Area area, IIndividual ind) {
.setColor(getColor());

y += 34;
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".planTypes")).setColor(getColor());
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".plantTypes")).setColor(getColor());

y += 12;
new ControlTextCentered(this, y, TextFormatting.ITALIC + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH))
new ControlTextCentered(this, y, TextFormatting.ITALIC + tree.getGenome().getPrimary().getPlantType().toString())
.setColor(getColor());
}
if (ind instanceof IFlower) {
Expand Down
Expand Up @@ -27,6 +27,7 @@
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.genetics.Tolerance;
import binnie.core.util.I18N;
import binnie.genetics.gui.analyst.AnalystConstants;
import binnie.genetics.gui.analyst.ControlAnalystPage;
import binnie.genetics.gui.analyst.ControlBiome;
import binnie.genetics.gui.analyst.ControlToleranceBar;
Expand Down Expand Up @@ -54,17 +55,17 @@ public AnalystPageClimate(IWidget parent, Area area, IIndividual ind) {
int y = 4;
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 16;
new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.temp"), TextJustification.MIDDLE_CENTER).setColor(getColor());
new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".temp"), TextJustification.MIDDLE_CENTER).setColor(getColor());
y += 12;
createTemperatureBar(this, (width() - 100) / 2, y, 100, 10, temp, tempTol);
y += 16;
if (!(ind instanceof IFlower)) {
new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.hum"), TextJustification.MIDDLE_CENTER).setColor(getColor());
new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".hum"), TextJustification.MIDDLE_CENTER).setColor(getColor());
y += 12;
createHumidity(this, (width() - 100) / 2, y, 100, 10, humid, humidTol);
y += 16;
}
new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER).setColor(getColor());
new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".biomes"), TextJustification.MIDDLE_CENTER).setColor(getColor());
y += 12;
List<Biome> biomes = new ArrayList<>();
for (Biome biome : Biome.EXPLORATION_BIOMES_LIST) { //TODO check
Expand Down Expand Up @@ -128,6 +129,6 @@ protected int getColour(EnumHumidity value) {

@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.climate.title");
return I18N.localise(AnalystConstants.CLIMATE_KEY + ".title");
}
}
Expand Up @@ -27,6 +27,7 @@
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.util.I18N;
import binnie.core.util.UniqueItemStackSet;
import binnie.genetics.gui.analyst.AnalystConstants;
import binnie.genetics.gui.analyst.AnalystPageProduce;

public class AnalystPageFruit extends AnalystPageProduce {
Expand All @@ -37,7 +38,7 @@ public AnalystPageFruit(IWidget parent, Area area, ITree ind) {
int y = 4;
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD))).setColor(getColor());
new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.FRUIT_KEY + ".yield") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD))).setColor(getColor());
y += 20;
Collection<ItemStack> products = new UniqueItemStackSet();
Collection<ItemStack> specialties = new UniqueItemStackSet();
Expand All @@ -55,7 +56,7 @@ public AnalystPageFruit(IWidget parent, Area area, ITree ind) {
throw Throwables.propagate(e);
}
if (products.size() > 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural")).setColor(getColor());
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.FRUIT_KEY + ".natural")).setColor(getColor());
y += 10;
int w = products.size() * 18 - 2;
int i = 0;
Expand All @@ -67,7 +68,7 @@ public AnalystPageFruit(IWidget parent, Area area, ITree ind) {
y += 26;
}
if (specialties.size() > 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.specialty")).setColor(getColor());
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.FRUIT_KEY + ".specialty")).setColor(getColor());
y += 10;
int w = products.size() * 18 - 2;
int i = 0;
Expand All @@ -84,14 +85,14 @@ public AnalystPageFruit(IWidget parent, Area area, ITree ind) {
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
if (refinedProducts.size() > 0) {
y = getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts);
y = getRefined(I18N.localise(AnalystConstants.FRUIT_KEY + ".refined"), y, refinedProducts);
y += 8;
}
if (products.size() == 0 && specialties.size() == 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.noFruits")).setColor(getColor());
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.FRUIT_KEY + ".noFruits")).setColor(getColor());
y += 28;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible")).setColor(getColor());
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.FRUIT_KEY + ".possible")).setColor(getColor());
y += 12;
Collection<IAllele> fruitAlleles = Binnie.GENETICS.getChromosomeMap(Binnie.GENETICS.getTreeRoot()).get(EnumTreeChromosome.FRUITS);
for (IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) {
Expand Down Expand Up @@ -125,6 +126,6 @@ public AnalystPageFruit(IWidget parent, Area area, ITree ind) {

@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.fruit.title");
return I18N.localise(AnalystConstants.FRUIT_KEY + ".title");
}
}
Expand Up @@ -12,6 +12,7 @@
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.geometry.Area;
import binnie.core.util.I18N;
import binnie.genetics.gui.analyst.AnalystConstants;
import binnie.genetics.gui.analyst.ControlAnalystPage;

public class AnalystPageGrowth extends ControlAnalystPage {
Expand All @@ -25,18 +26,18 @@ public AnalystPageGrowth(IWidget parent, Area area, IIndividual ind) {
if (ind instanceof ITree) {
ITree tree = (ITree) ind;
int mat = tree.getGenome().getMaturationTime();
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature")).setColor(getColor());
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.GROWTH_KEY + ".mature")).setColor(getColor());
y += 12;
new ControlTextCentered(this, y, TextFormatting.BOLD + getTimeString(Math.round(1373.3999f * mat))).setColor(getColor());
y += 22;
new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT))).setColor(getColor());
new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.GROWTH_KEY + ".height") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT))).setColor(getColor());
y += 12;
new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH))).setColor(getColor());
new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.GROWTH_KEY + ".girth") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH))).setColor(getColor());
}
}

@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.growth.title");
return I18N.localise(AnalystConstants.GROWTH_KEY + ".title");
}
}
Expand Up @@ -22,6 +22,7 @@
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.util.I18N;
import binnie.core.util.UniqueItemStackSet;
import binnie.genetics.gui.analyst.AnalystConstants;
import binnie.genetics.gui.analyst.AnalystPageProduce;
import binnie.genetics.item.ModuleItems;

Expand All @@ -35,9 +36,9 @@ public AnalystPageWood(IWidget parent, Area area, ITree ind) {
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) {
new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconNoFire).addTooltip(I18N.localise("genetics.gui.analyst.wood.fireproof"));
new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconNoFire).addTooltip(I18N.localise(AnalystConstants.WOOD_KEY + ".fireproof"));
} else {
new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconFire).addTooltip(I18N.localise("genetics.gui.analyst.wood.flammable"));
new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconFire).addTooltip(I18N.localise(AnalystConstants.WOOD_KEY + ".flammable"));
}
y += 30;
Collection<ItemStack> products = new UniqueItemStackSet();
Expand All @@ -47,16 +48,18 @@ public AnalystPageWood(IWidget parent, Area area, ITree ind) {
if (!stackWood.isEmpty()) {
products.add(stackWood);
}
products.addAll(ind.getGenome().getFruitProvider().getProducts().keySet());
//Why ?
//products.addAll(ind.getGenome().getFruitProvider().getProducts().keySet());
if (products.size() > 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs")).setColor(getColor());
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.WOOD_KEY + ".logs")).setColor(getColor());
y += 10;
int w = products.size() * 18 - 2;
int i = 0;
for (ItemStack stack : products) {
ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y);
d.setTooltip();
d.setItemStack(stack);
i++;
}
y += 26;
}
Expand All @@ -65,18 +68,18 @@ public AnalystPageWood(IWidget parent, Area area, ITree ind) {
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
if (refinedProducts.size() > 0) {
y = getRefined(I18N.localise("genetics.gui.analyst.wood.refined"), y, refinedProducts);
y = getRefined(I18N.localise(AnalystConstants.WOOD_KEY + ".refined"), y, refinedProducts);
y += 8;
}
if (products.size() == 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits")).setColor(getColor());
new ControlTextCentered(this, y, I18N.localise(AnalystConstants.WOOD_KEY + ".noFruits")).setColor(getColor());
y += 28;
}
setSize(new Point(width(), y + 8));
}

@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.wood.title");
return I18N.localise(AnalystConstants.WOOD_KEY + ".title");
}
}
4 changes: 2 additions & 2 deletions src/main/resources/assets/genetics/lang/en_US.lang
Expand Up @@ -99,8 +99,8 @@ genetics.gui.analyst.biology.fertility.leaf=1 Sapling per 1 leaf
genetics.gui.analyst.biology.caterpillarGestation=Caterpillar Gestation
genetics.gui.analyst.biology.flightSpeed=Flight Speed
genetics.gui.analyst.biology.blocksPerSec=%d blocks per second
genetics.gui.analyst.biology.mothSpawn.perLeaf=Butterflies spawn every\n%s per leaf
genetics.gui.analyst.biology.mothSpawn=Butterflies spawn every\n%s
genetics.gui.analyst.biology.mothSpawn.perLeaf=Butterflies spawn every %s per leaf
genetics.gui.analyst.biology.mothSpawn=Butterflies spawn every %s
genetics.gui.analyst.biology.plantTypes=Plant Types
genetics.gui.analyst.biology.averageLifespan=Average Lifespan
genetics.gui.analyst.biology.pollination=Pollination
Expand Down

0 comments on commit afb9460

Please sign in to comment.