Improve code readability in binnie.genetics package

Drop unused (empty) method MachinePackage#register() from all classes
This commit is contained in:
kordum authored and mezz committed 2017-04-27 14:48:45 -07:00
1 parent 856f08b752
commit 730043ba9c
112 files changed
+4354 -4697

No files matched your search

@@ -1,64 +1,63 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import forestry.api.genetics.IAlleleSpecies;
import binnie.botany.api.EnumFlowerStage;
import binnie.core.craftgui.geometry.IPoint;
import binnie.botany.api.IFlower;
import binnie.botany.craftgui.ControlColourDisplay;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.IWidget;
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 net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;
import binnie.core.craftgui.minecraft.control.ControlIconDisplay;
import binnie.botany.craftgui.ControlColourDisplay;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.botany.api.IFlower;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
public class AnalystPageAppearance extends ControlAnalystPage
{
public AnalystPageAppearance(final IWidget parent, final IArea area, final IFlower ind) {
public class AnalystPageAppearance extends ControlAnalystPage {
public AnalystPageAppearance(IWidget parent, IArea area, IFlower ind) {
super(parent, area);
this.setColor(3355443);
setColor(3355443);
int y = 4;
final IAlleleSpecies species = ind.getGenome().getPrimary();
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Appearance").setColor(this.getColor());
IAlleleSpecies species = ind.getGenome().getPrimary();
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Appearance").setColor(getColor());
y += 12;
final ControlColourDisplay a = new ControlColourDisplay(this, this.w() / 2.0f - 28.0f, y);
ControlColourDisplay a = new ControlColourDisplay(this, w() / 2.0f - 28.0f, y);
a.setValue(ind.getGenome().getPrimaryColor());
a.addTooltip("Primary Petal Colour");
final ControlColourDisplay b = new ControlColourDisplay(this, this.w() / 2.0f - 8.0f, y);
ControlColourDisplay b = new ControlColourDisplay(this, w() / 2.0f - 8.0f, y);
b.setValue(ind.getGenome().getSecondaryColor());
b.addTooltip("Secondary Petal Colour");
final ControlColourDisplay c = new ControlColourDisplay(this, this.w() / 2.0f + 12.0f, y);
ControlColourDisplay c = new ControlColourDisplay(this, w() / 2.0f + 12.0f, y);
c.setValue(ind.getGenome().getStemColor());
c.addTooltip("Stem Colour");
y += 26;
final int sections = ind.getGenome().getType().getSections();
final int w = (sections > 1) ? 50 : 100;
new ControlIconDisplay(this, (this.w() - w) / 2.0f, y - ((sections == 1) ? 0 : 0), null) {
int sections = ind.getGenome().getType().getSections();
int w = (sections > 1) ? 50 : 100;
new ControlIconDisplay(this, (w() - w) / 2.0f, y - ((sections == 1) ? 0 : 0), null) {
@Override
public void onRenderForeground() {
GL11.glPushMatrix();
final float scale = w / 16.0f;
final float dy = (sections > 1) ? 16.0f : 0.0f;
float scale = w / 16.0f;
float dy = (sections > 1) ? 16.0f : 0.0f;
GL11.glScalef(scale, scale, 1.0f);
CraftGUI.Render.colour(ind.getGenome().getStemColor().getColor(false));
if (sections > 1) {
CraftGUI.Render.iconBlock(new IPoint(0.0f, 0.0f), ind.getGenome().getType().getStem(EnumFlowerStage.FLOWER, true, 1));
}
CraftGUI.Render.iconBlock(new IPoint(0.0f, dy), ind.getGenome().getType().getStem(EnumFlowerStage.FLOWER, true, 0));
CraftGUI.Render.colour(ind.getGenome().getPrimaryColor().getColor(false));
if (sections > 1) {
CraftGUI.Render.iconBlock(new IPoint(0.0f, 0.0f), ind.getGenome().getType().getPetalIcon(EnumFlowerStage.FLOWER, true, 1));
}
CraftGUI.Render.iconBlock(new IPoint(0.0f, dy), ind.getGenome().getType().getPetalIcon(EnumFlowerStage.FLOWER, true, 0));
CraftGUI.Render.colour(ind.getGenome().getSecondaryColor().getColor(false));
if (sections > 1) {
CraftGUI.Render.iconBlock(new IPoint(0.0f, 0.0f), ind.getGenome().getType().getVariantIcon(EnumFlowerStage.FLOWER, true, 1));
}
CraftGUI.Render.iconBlock(new IPoint(0.0f, dy), ind.getGenome().getType().getVariantIcon(EnumFlowerStage.FLOWER, true, 0));
GL11.glPopMatrix();
}
@@ -1,69 +1,66 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import forestry.api.lepidopterology.IAlleleButterflyEffect;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import binnie.Binnie;
import forestry.api.lepidopterology.IButterfly;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.BinnieCore;
import forestry.plugins.PluginApiculture;
import forestry.api.apiculture.IBee;
import binnie.core.craftgui.controls.ControlTextCentered;
import forestry.api.genetics.IIndividual;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.TextJustification;
import forestry.api.apiculture.IAlleleBeeEffect;
import forestry.api.apiculture.IBee;
import forestry.api.genetics.IIndividual;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.lepidopterology.IAlleleButterflyEffect;
import forestry.api.lepidopterology.IButterfly;
import forestry.plugins.PluginApiculture;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageBehaviour extends ControlAnalystPage
{
public AnalystPageBehaviour(final IWidget parent, final IArea area, final IIndividual ind) {
public class AnalystPageBehaviour extends ControlAnalystPage {
public AnalystPageBehaviour(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
this.setColor(6684723);
setColor(6684723);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Behaviour").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Behaviour").setColor(getColor());
y += 12;
if (ind instanceof IBee) {
final IBee bee = (IBee) ind;
IBee bee = (IBee) ind;
y += 8;
final int fertility = bee.getGenome().getFlowering();
new ControlTextCentered(this, y, "Pollinates nearby\n" + bee.getGenome().getFlowerProvider().getDescription()).setColor(this.getColor());
int fertility = bee.getGenome().getFlowering();
new ControlTextCentered(this, y, "Pollinates nearby\n" + bee.getGenome().getFlowerProvider().getDescription()).setColor(getColor());
y += 20;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Every " + this.getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100.0f / fertility)).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Every " + getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100.0f / fertility)).setColor(getColor());
y += 22;
final IAlleleBeeEffect effect = bee.getGenome().getEffect();
final int[] t = bee.getGenome().getTerritory();
IAlleleBeeEffect effect = bee.getGenome().getEffect();
int[] t = bee.getGenome().getTerritory();
if (!effect.getUID().contains("None")) {
final String effectDesc = BinnieCore.proxy.localiseOrBlank("allele." + effect.getUID() + ".desc");
final String loc = effectDesc.equals("") ? ("Effect: " + effect.getName()) : effectDesc;
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 0.0f), loc, TextJustification.TopCenter).setColor(this.getColor());
y += (int) (CraftGUI.Render.textHeight(loc, this.w() - 8.0f) + 1.0f);
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Within " + (int) (t[0] / 2.0f) + " blocks").setColor(this.getColor());
String effectDesc = BinnieCore.proxy.localiseOrBlank("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.TopCenter).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());
y += 22;
}
new ControlTextCentered(this, y, "Territory: " + EnumChatFormatting.ITALIC + t[0] + "x" + t[1] + "x" + t[2]).setColor(this.getColor());
new ControlTextCentered(this, y, "Territory: " + EnumChatFormatting.ITALIC + t[0] + "x" + t[1] + "x" + t[2]).setColor(getColor());
y += 22;
}
if (ind instanceof IButterfly) {
final IButterfly bee2 = (IButterfly) ind;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Metabolism: " + Binnie.Genetics.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))).setColor(this.getColor());
IButterfly bee2 = (IButterfly) ind;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "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(this.getColor());
new ControlTextCentered(this, y, "Pollinates nearby\n" + bee2.getGenome().getFlowerProvider().getDescription()).setColor(getColor());
y += 20;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Every " + this.getTimeString(1500.0f)).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Every " + getTimeString(1500.0f)).setColor(getColor());
y += 22;
final IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect();
IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect();
if (!effect2.getUID().contains("None")) {
final String effectDesc2 = BinnieCore.proxy.localiseOrBlank("allele." + effect2.getUID() + ".desc");
final String loc2 = effectDesc2.equals("") ? ("Effect: " + effect2.getName()) : effectDesc2;
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 0.0f), loc2, TextJustification.TopCenter).setColor(this.getColor());
y += (int) (CraftGUI.Render.textHeight(loc2, this.w() - 8.0f) + 1.0f);
String effectDesc2 = BinnieCore.proxy.localiseOrBlank("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.TopCenter).setColor(getColor());
y += (int) (CraftGUI.Render.textHeight(loc2, w() - 8.0f) + 1.0f);
y += 22;
}
}
@@ -1,175 +1,160 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import java.text.DecimalFormat;
import binnie.core.craftgui.geometry.IPoint;
import binnie.botany.api.IFlower;
import net.minecraftforge.common.EnumPlantType;
import forestry.plugins.PluginApiculture;
import forestry.api.arboriculture.EnumTreeChromosome;
import binnie.Binnie;
import forestry.api.arboriculture.ITree;
import forestry.api.lepidopterology.IButterfly;
import binnie.botany.api.IFlower;
import binnie.core.craftgui.IWidget;
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 binnie.genetics.item.ModuleItem;
import forestry.api.apiculture.IBee;
import binnie.core.craftgui.controls.ControlTextCentered;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.arboriculture.ITree;
import forestry.api.genetics.IIndividual;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
import forestry.api.lepidopterology.IButterfly;
import forestry.plugins.PluginApiculture;
import net.minecraftforge.common.EnumPlantType;
public class AnalystPageBiology extends ControlAnalystPage
{
public AnalystPageBiology(final IWidget parent, final IArea area, final IIndividual ind) {
import java.text.DecimalFormat;
public class AnalystPageBiology extends ControlAnalystPage {
public AnalystPageBiology(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
this.setColor(26214);
setColor(26214);
int y = 4;
new ControlTextCentered(this, y, "§nBiology").setColor(this.getColor());
new ControlTextCentered(this, y, "§nBiology").setColor(getColor());
y += 12;
if (ind instanceof IBee) {
final IBee bee = (IBee) ind;
IBee bee = (IBee) ind;
if (bee.getGenome().getNocturnal()) {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon()).addTooltip("Active all day and night");
}
else if (bee.getGenome().getPrimary().isNocturnal()) {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon()).addTooltip("Active at night");
}
else {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon()).addTooltip("Active during the day");
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon()).addTooltip("Active all day and night");
} else if (bee.getGenome().getPrimary().isNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon()).addTooltip("Active at night");
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon()).addTooltip("Active during the day");
}
if (!bee.getGenome().getTolerantFlyer()) {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon()).addTooltip("Cannot work during rain");
}
else {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon()).addTooltip("Can work during rain");
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon()).addTooltip("Cannot work during rain");
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon()).addTooltip("Can work during rain");
}
if (bee.getGenome().getCaveDwelling()) {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoSky.getIcon()).addTooltip("Can work underground");
}
else {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconSky.getIcon()).addTooltip("Cannot work underground");
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoSky.getIcon()).addTooltip("Can work underground");
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconSky.getIcon()).addTooltip("Cannot work underground");
}
y += 30;
}
else if (ind instanceof IButterfly) {
final IButterfly moth = (IButterfly) ind;
} else if (ind instanceof IButterfly) {
IButterfly moth = (IButterfly) ind;
if (moth.getGenome().getNocturnal()) {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon()).addTooltip("Active all day and night");
}
else if (moth.getGenome().getPrimary().isNocturnal()) {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon()).addTooltip("Active at night");
}
else {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon()).addTooltip("Active during the day");
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon()).addTooltip("Active all day and night");
} else if (moth.getGenome().getPrimary().isNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon()).addTooltip("Active at night");
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon()).addTooltip("Active during the day");
}
if (!moth.getGenome().getTolerantFlyer()) {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon()).addTooltip("Cannot work during rain");
}
else {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon()).addTooltip("Can work during rain");
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon()).addTooltip("Cannot work during rain");
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon()).addTooltip("Can work during rain");
}
if (moth.getGenome().getFireResist()) {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoFire.getIcon()).addTooltip("Nonflammable");
}
else {
new ControlIconDisplay(this, (this.w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconFire.getIcon()).addTooltip("Flammable");
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoFire.getIcon()).addTooltip("Nonflammable");
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconFire.getIcon()).addTooltip("Flammable");
}
y += 30;
}
else if (ind instanceof ITree) {
new ControlTextCentered(this, y, "§oSappiness: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColor(this.getColor());
} else if (ind instanceof ITree) {
new ControlTextCentered(this, y, "§oSappiness: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColor(getColor());
y += 20;
}
else {
} else {
y += 10;
}
if (ind instanceof IBee) {
final IBee bee = (IBee) ind;
final int fertility = bee.getGenome().getFertility();
new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColor(this.getColor());
IBee bee = (IBee) ind;
int fertility = bee.getGenome().getFertility();
new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColor(getColor());
y += 22;
final int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
new ControlTextCentered(this, y, "Average Lifespan").setColor(this.getColor());
int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
new ControlTextCentered(this, y, "Average Lifespan").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan * (bee.getGenome().getNocturnal() ? 1.0f : 2.0f))).setColor(this.getColor());
new ControlTextCentered(this, y, "§l" + getMCDayString(lifespan * (bee.getGenome().getNocturnal() ? 1.0f : 2.0f))).setColor(getColor());
y += 22;
}
if (ind instanceof IButterfly) {
final IButterfly bee2 = (IButterfly) ind;
final int fertility = bee2.getGenome().getFertility();
new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColor(this.getColor());
IButterfly bee2 = (IButterfly) ind;
int fertility = bee2.getGenome().getFertility();
new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColor(getColor());
y += 32;
final float caterpillarMatureTime = 1365.3999f * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2));
new ControlTextCentered(this, y, "Caterpillar Gestation").setColor(this.getColor());
float caterpillarMatureTime = 1365.3999f * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2));
new ControlTextCentered(this, y, "Caterpillar Gestation").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, "§l" + this.getMCDayString(caterpillarMatureTime)).setColor(this.getColor());
new ControlTextCentered(this, y, "§l" + getMCDayString(caterpillarMatureTime)).setColor(getColor());
y += 22;
final int speed = (int) (20.0f * bee2.getGenome().getSpeed());
new ControlTextCentered(this, y, "Flight Speed").setColor(this.getColor());
int speed = (int) (20.0f * bee2.getGenome().getSpeed());
new ControlTextCentered(this, y, "Flight Speed").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColor(this.getColor());
new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColor(getColor());
y += 22;
}
if (ind instanceof ITree) {
final ITree tree = (ITree) ind;
final int fertility = (int) (1.0f / tree.getGenome().getFertility());
new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColor(this.getColor());
ITree tree = (ITree) ind;
int fertility = (int) (1.0f / tree.getGenome().getFertility());
new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColor(getColor());
y += 22;
final float butterflySpawn = 1365.3999f / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f);
new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn) + " per leaf").setColor(this.getColor());
float butterflySpawn = 1365.3999f / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f);
new ControlTextCentered(this, y, "Butterfies spawn every\n" + getTimeString(butterflySpawn) + " per leaf").setColor(getColor());
y += 34;
new ControlTextCentered(this, y, "Plant Types").setColor(this.getColor());
new ControlTextCentered(this, y, "Plant Types").setColor(getColor());
y += 12;
for (final EnumPlantType type : tree.getGenome().getPlantTypes()) {
new ControlTextCentered(this, y, "§o" + type.name()).setColor(this.getColor());
for (EnumPlantType type : tree.getGenome().getPlantTypes()) {
new ControlTextCentered(this, y, "§o" + type.name()).setColor(getColor());
y += 12;
}
}
if (ind instanceof IFlower) {
final IFlower flower = (IFlower) ind;
final float butterflySpawn2 = 1365.3999f / (flower.getGenome().getSappiness() * 0.2f);
new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn2)).setColor(this.getColor());
IFlower flower = (IFlower) ind;
float butterflySpawn2 = 1365.3999f / (flower.getGenome().getSappiness() * 0.2f);
new ControlTextCentered(this, y, "Butterfies spawn every\n" + getTimeString(butterflySpawn2)).setColor(getColor());
y += 30;
float CHANCE_DISPERSAL = 0.8f;
CHANCE_DISPERSAL += 0.2f * flower.getGenome().getFertility();
float CHANCE_POLLINATE = 0.6f;
CHANCE_POLLINATE += 0.25f * flower.getGenome().getFertility();
final float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE;
float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE;
if (CHANCE_DISPERSAL > 1.0f) {
CHANCE_DISPERSAL = 1.0f;
}
if (CHANCE_POLLINATE > 1.0f) {
CHANCE_POLLINATE = 1.0f;
}
final float dispersalTime = 1365.3999f / CHANCE_DISPERSAL;
final float pollinateTime = 1365.3999f / CHANCE_POLLINATE;
final float lifespan2 = flower.getMaxAge() * 20.0f * 68.27f / flower.getGenome().getAgeChance();
float dispersalTime = 1365.3999f / CHANCE_DISPERSAL;
float pollinateTime = 1365.3999f / CHANCE_POLLINATE;
float lifespan2 = flower.getMaxAge() * 20.0f * 68.27f / flower.getGenome().getAgeChance();
float floweringLifespan = (flower.getMaxAge() - 1) * 20.0f * 68.27f / flower.getGenome().getAgeChance();
floweringLifespan -= 1365.3999f;
new ControlTextCentered(this, y, "Average Lifespan").setColor(this.getColor());
new ControlTextCentered(this, y, "Average Lifespan").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan2)).setColor(this.getColor());
new ControlTextCentered(this, y, "§l" + getMCDayString(lifespan2)).setColor(getColor());
y += 22;
new ControlTextCentered(this, y, "Seed Dispersal").setColor(this.getColor());
new ControlTextCentered(this, y, "Seed Dispersal").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColor(this.getColor());
new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColor(getColor());
y += 22;
new ControlTextCentered(this, y, "Pollination").setColor(this.getColor());
new ControlTextCentered(this, y, "Pollination").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColor(this.getColor());
new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColor(getColor());
y += 22;
}
this.setSize(new IPoint(this.w(), y));
setSize(new IPoint(w(), y));
}
private String getMCDayString(final float time) {
final float seconds = time / 20.0f;
final float minutes = seconds / 60.0f;
final float days = minutes / 20.0f;
final DecimalFormat df = new DecimalFormat("#.0");
private String getMCDayString(float time) {
float seconds = time / 20.0f;
float minutes = seconds / 60.0f;
float days = minutes / 20.0f;
DecimalFormat df = new DecimalFormat("#.0");
return df.format(days) + " MC days";
}
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.botany.api.EnumFlowerChromosome;
@@ -29,14 +25,13 @@ import net.minecraftforge.common.BiomeDictionary;
import java.util.ArrayList;
import java.util.List;
public class AnalystPageClimate extends ControlAnalystPage
{
public AnalystPageClimate(final IWidget parent, final IArea area, final IIndividual ind) {
public class AnalystPageClimate extends ControlAnalystPage {
public AnalystPageClimate(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
this.setColor(26163);
final EnumTemperature temp = ind.getGenome().getPrimary().getTemperature();
setColor(26163);
EnumTemperature temp = ind.getGenome().getPrimary().getTemperature();
EnumTolerance tempTol = EnumTolerance.NONE;
final EnumHumidity humid = ind.getGenome().getPrimary().getHumidity();
EnumHumidity humid = ind.getGenome().getPrimary().getHumidity();
EnumTolerance humidTol = EnumTolerance.NONE;
if (ind instanceof IBee) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE)).getValue();
@@ -51,47 +46,47 @@ public class AnalystPageClimate extends ControlAnalystPage
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE)).getValue();
}
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Climate").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Climate").setColor(getColor());
y += 16;
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Temp. Tolerance", TextJustification.MiddleCenter).setColor(this.getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Temp. Tolerance", TextJustification.MiddleCenter).setColor(getColor());
y += 12;
this.createTemperatureBar(this, (this.w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, temp, tempTol);
createTemperatureBar(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, temp, tempTol);
y += 16;
if (!(ind instanceof IFlower)) {
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Humidity Tolerance", TextJustification.MiddleCenter).setColor(this.getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Humidity Tolerance", TextJustification.MiddleCenter).setColor(getColor());
y += 12;
this.createHumidity(this, (this.w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, humid, humidTol);
createHumidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, humid, humidTol);
y += 16;
}
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Biomes", TextJustification.MiddleCenter).setColor(this.getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Biomes", TextJustification.MiddleCenter).setColor(getColor());
y += 12;
final List<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
for (final BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
if (biome != null) {
if (BiomeDictionary.isBiomeRegistered(biome)) {
if (biome != BiomeGenBase.frozenOcean) {
if (Tolerance.canTolerate(temp, EnumTemperature.getFromBiome(biome), tempTol)) {
if (Tolerance.canTolerate(humid, EnumHumidity.getFromValue(biome.rainfall), humidTol)) {
boolean match = false;
for (final BiomeGenBase eBiome : biomes) {
if (biome.biomeName.contains(eBiome.biomeName) && EnumHumidity.getFromValue(eBiome.rainfall) == EnumHumidity.getFromValue(biome.rainfall) && EnumTemperature.getFromBiome(eBiome) == EnumTemperature.getFromBiome(biome)) {
match = true;
}
}
if (!match) {
biomes.add(biome);
}
}
}
}
List<BiomeGenBase> biomes = new ArrayList<BiomeGenBase>();
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
if (biome == null || !BiomeDictionary.isBiomeRegistered(biome) || biome == BiomeGenBase.frozenOcean) {
continue;
}
if (!Tolerance.canTolerate(temp, EnumTemperature.getFromBiome(biome), tempTol) ||
!Tolerance.canTolerate(humid, EnumHumidity.getFromValue(biome.rainfall), humidTol)) {
continue;
}
boolean match = false;
for (BiomeGenBase eBiome : biomes) {
if (biome.biomeName.contains(eBiome.biomeName) && EnumHumidity.getFromValue(eBiome.rainfall) == EnumHumidity.getFromValue(biome.rainfall) && EnumTemperature.getFromBiome(eBiome) == EnumTemperature.getFromBiome(biome)) {
match = true;
}
}
if (!match) {
biomes.add(biome);
}
}
final int maxBiomePerLine = (int) ((this.w() + 2.0f - 16.0f) / 18.0f);
final float biomeListX = (this.w() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2.0f;
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
float biomeListX = (w() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2.0f;
int dx = 0;
int dy = 0;
for (final BiomeGenBase biome2 : biomes) {
for (BiomeGenBase biome2 : biomes) {
new ControlBiome(this, biomeListX + dx, y + dy, 16.0f, 16.0f, biome2);
dx += 18;
if (dx >= 18 * maxBiomePerLine) {
@@ -99,33 +94,33 @@ public class AnalystPageClimate extends ControlAnalystPage
dy += 18;
}
}
this.setSize(new IPoint(this.w(), y + dy + 18 + 8));
setSize(new IPoint(w(), y + dy + 18 + 8));
}
protected void createTemperatureBar(final IWidget parent, final float x, final float y, final float w, final float h, final EnumTemperature value, final EnumTolerance tol) {
protected void createTemperatureBar(IWidget parent, float x, float y, float w, float h, EnumTemperature value, EnumTolerance tol) {
new ControlToleranceBar<EnumTemperature>(parent, x, y, w, h, EnumTemperature.class) {
@Override
protected String getName(final EnumTemperature value) {
protected String getName(EnumTemperature value) {
return value.name;
}
@Override
protected int getColour(final EnumTemperature value) {
return (new int[] { 65531, 7912447, 5242672, 16776960, 16753152, 16711680 })[value.ordinal() - 1];
protected int getColour(EnumTemperature value) {
return (new int[]{0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000})[value.ordinal() - 1];
}
}.setValues(value, tol);
}
protected void createHumidity(final IWidget parent, final float x, final float y, final float w, final float h, final EnumHumidity value, final EnumTolerance tol) {
protected void createHumidity(IWidget parent, float x, float y, float w, float h, EnumHumidity value, EnumTolerance tol) {
new ControlToleranceBar<EnumHumidity>(parent, x, y, w, h, EnumHumidity.class) {
@Override
protected String getName(final EnumHumidity value) {
protected String getName(EnumHumidity value) {
return value.name;
}
@Override
protected int getColour(final EnumHumidity value) {
return (new int[] { 16770979, 1769216, 3177727 })[value.ordinal()];
protected int getColour(EnumHumidity value) {
return (new int[]{0xffe7a3, 0x1aff00, 0x307cff})[value.ordinal()];
}
}.setValues(value, tol);
}
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.CraftGUI;
@@ -28,121 +24,116 @@ import net.minecraft.util.EnumChatFormatting;
import java.util.ArrayList;
import java.util.Collection;
public class AnalystPageDatabase extends ControlAnalystPage
{
public class AnalystPageDatabase extends ControlAnalystPage {
ControlScrollableContent scroll;
boolean isMaster;
public AnalystPageDatabase(final IWidget parent, final IArea area, final BreedingSystem system, final boolean isMaster) {
public AnalystPageDatabase(IWidget parent, IArea area, BreedingSystem system, boolean isMaster) {
super(parent, area);
this.scroll = null;
scroll = null;
this.isMaster = isMaster;
final int cOfSystem = system.getColour();
final int cr = (0xFF0000 & cOfSystem) >> 16;
final int cg = (0xFF00 & cOfSystem) >> 8;
final int cb = 0xFF & cOfSystem;
int cOfSystem = system.getColour();
int cr = (0xFF0000 & cOfSystem) >> 16;
int cg = (0xFF00 & cOfSystem) >> 8;
int cb = 0xFF & cOfSystem;
float brightness = 0.1f * cb / 255.0f + 0.35f * cr / 255.0f + 0.55f * cg / 255.0f;
brightness = 0.3f / brightness;
if (brightness > 1.0f) {
brightness = 1.0f;
}
final int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness);
this.setColor(newColour);
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(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Registry").setColor(getColor());
y += 16;
new ControlTextEdit(this, 20.0f, y, this.w() - 40.0f, 16.0f) {
new ControlTextEdit(this, 20.0f, y, w() - 40.0f, 16.0f) {
@Override
public void onTextEdit(final String value) {
final Collection<IAlleleSpecies> options = new ArrayList<IAlleleSpecies>();
AnalystPageDatabase.this.getSpecies(system);
for (final IAlleleSpecies species : AnalystPageDatabase.this.getSpecies(system)) {
if (value != null) {
if (value != "") {
if (!species.getName().toLowerCase().contains(value.toLowerCase())) {
continue;
}
}
public void onTextEdit(String value) {
Collection<IAlleleSpecies> options = new ArrayList<>();
getSpecies(system);
for (IAlleleSpecies species : getSpecies(system)) {
if (value != null && value.isEmpty() && !species.getName().toLowerCase().contains(value.toLowerCase())) {
continue;
}
options.add(species);
}
AnalystPageDatabase.this.scroll.deleteAllChildren();
AnalystPageDatabase.this.scroll.setScrollableContent(AnalystPageDatabase.this.getItemScrollList(system, options));
scroll.deleteAllChildren();
scroll.setScrollableContent(getItemScrollList(system, options));
}
@Override
public void onRenderBackground() {
CraftGUI.Render.colour(5592405);
CraftGUI.Render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1));
CraftGUI.Render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
CraftGUI.Render.colour(AnalystPageDatabase.this.getColor());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, this.getArea());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea());
super.renderTextField();
}
};
y += 22;
new Panel(this, 3.0f, y - 1, this.w() - 6.0f, this.h() - y - 8.0f + 2.0f, MinecraftGUI.PanelType.TabOutline).setColor(this.getColor());
final boolean textView = false;
final Collection<IAlleleSpecies> options = this.getSpecies(system);
for (final IAlleleSpecies species : options) {
final String height = system.getAlleleName(EnumTreeChromosome.HEIGHT, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT));
final String fertility = system.getAlleleName(EnumTreeChromosome.FERTILITY, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.FERTILITY));
final String yield = system.getAlleleName(EnumTreeChromosome.YIELD, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.YIELD));
final String sappiness = system.getAlleleName(EnumTreeChromosome.SAPPINESS, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
final String maturation = system.getAlleleName(EnumTreeChromosome.MATURATION, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION));
new Panel(this, 3.0f, y - 1, w() - 6.0f, h() - y - 8.0f + 2.0f, MinecraftGUI.PanelType.TabOutline).setColor(getColor());
boolean textView = false;
Collection<IAlleleSpecies> options = getSpecies(system);
for (IAlleleSpecies species : options) {
String height = system.getAlleleName(EnumTreeChromosome.HEIGHT, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT));
String fertility = system.getAlleleName(EnumTreeChromosome.FERTILITY, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.FERTILITY));
String yield = system.getAlleleName(EnumTreeChromosome.YIELD, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.YIELD));
String sappiness = system.getAlleleName(EnumTreeChromosome.SAPPINESS, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
String maturation = system.getAlleleName(EnumTreeChromosome.MATURATION, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION));
}
if (textView) {
this.scroll = new ControlListBox<IAlleleSpecies>(this, 4.0f, y, this.w() - 8.0f, this.h() - y - 8.0f - 20.0f, 0.0f) {
scroll = new ControlListBox<IAlleleSpecies>(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f - 20.0f, 0.0f) {
@Override
public void initialise() {
super.initialise();
this.setOptions(options);
setOptions(options);
}
@Override
public IWidget createOption(final IAlleleSpecies v, final int y) {
return new Control(this.getContent(), 0.0f, y, this.w(), 12.0f) {
public IWidget createOption(IAlleleSpecies v, int y) {
return new Control(getContent(), 0.0f, y, w(), 12.0f) {
IAlleleSpecies value = v;
@Override
public void onRenderBackground() {
CraftGUI.Render.text(this.getArea(), TextJustification.MiddleCenter, this.value.getName(), 16777215);
CraftGUI.Render.text(getArea(), TextJustification.MiddleCenter, value.getName(), 16777215);
}
};
}
};
} else {
(scroll = new ControlScrollableContent(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f, 0.0f)).setScrollableContent(getItemScrollList(system, options));
}
else {
(this.scroll = new ControlScrollableContent(this, 4.0f, y, this.w() - 8.0f, this.h() - y - 8.0f, 0.0f)).setScrollableContent(this.getItemScrollList(system, options));
}
new ControlScrollBar(this, this.scroll.x() + this.scroll.w() - 6.0f, this.scroll.y() + 3.0f, 3.0f, this.scroll.h() - 6.0f, this.scroll) {
new ControlScrollBar(this, scroll.x() + scroll.w() - 6.0f, scroll.y() + 3.0f, 3.0f, scroll.h() - 6.0f, scroll) {
@Override
public void onRenderBackground() {
if (!this.isEnabled()) {
if (!isEnabled()) {
return;
}
CraftGUI.Render.gradientRect(this.getArea(), 1140850688 + AnalystPageDatabase.this.getColor(), 1140850688 + AnalystPageDatabase.this.getColor());
CraftGUI.Render.solid(this.getRenderArea(), AnalystPageDatabase.this.getColor());
CraftGUI.Render.gradientRect(getArea(), 1140850688 + AnalystPageDatabase.this.getColor(), 1140850688 + AnalystPageDatabase.this.getColor());
CraftGUI.Render.solid(getRenderArea(), AnalystPageDatabase.this.getColor());
}
};
}
private IWidget getItemScrollList(final BreedingSystem system, final Collection<IAlleleSpecies> options) {
return new Control(this.scroll, 0.0f, 0.0f, this.scroll.w(), this.scroll.h()) {
private IWidget getItemScrollList(BreedingSystem system, Collection<IAlleleSpecies> options) {
return new Control(scroll, 0.0f, 0.0f, scroll.w(), scroll.h()) {
@Override
public void initialise() {
final int maxBiomePerLine = (int) ((this.w() - 4.0f + 2.0f) / 18.0f);
final float biomeListX = -6.0f + (this.w() - (maxBiomePerLine * 18 - 2)) / 2.0f;
int maxBiomePerLine = (int) ((w() - 4.0f + 2.0f) / 18.0f);
float biomeListX = -6.0f + (w() - (maxBiomePerLine * 18 - 2)) / 2.0f;
int dx = 0;
int dy = 0;
for (final IAlleleSpecies species : options) {
final IIndividual ind = system.getSpeciesRoot().templateAsIndividual(system.getSpeciesRoot().getTemplate(species.getUID()));
for (IAlleleSpecies species : options) {
IIndividual ind = system.getSpeciesRoot().templateAsIndividual(system.getSpeciesRoot().getTemplate(species.getUID()));
new ControlIndividualDisplay(this, biomeListX + dx, 2 + dy, ind) {
@Override
public void initialise() {
this.addSelfEventHandler(new EventMouse.Down.Handler() {
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
public void onEvent(EventMouse.Down event) {
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
window.setIndividual(ind);
}
});
@@ -150,16 +141,15 @@ public class AnalystPageDatabase extends ControlAnalystPage
@Override
public void onRenderBackground() {
final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) {
CraftGUI.Render.colour(15658734);
CraftGUI.Render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1));
CraftGUI.Render.texture(CraftGUITexture.TabSolid, getArea().outset(1));
CraftGUI.Render.colour(AnalystPageDatabase.this.getColor());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, this.getArea().outset(1));
}
else if (this.calculateIsMouseOver()) {
CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea().outset(1));
} else if (calculateIsMouseOver()) {
CraftGUI.Render.colour(15658734);
CraftGUI.Render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1));
CraftGUI.Render.texture(CraftGUITexture.TabSolid, getArea().outset(1));
}
super.onRenderBackground();
}
@@ -170,7 +160,7 @@ public class AnalystPageDatabase extends ControlAnalystPage
dy += 18;
}
}
this.setSize(new IPoint(this.w(), 4 + dy + 18));
setSize(new IPoint(w(), 4 + dy + 18));
}
};
}
@@ -180,9 +170,9 @@ public class AnalystPageDatabase extends ControlAnalystPage
return "Registry";
}
private Collection<IAlleleSpecies> getSpecies(final BreedingSystem system) {
final Collection<IAlleleSpecies> species = new ArrayList<IAlleleSpecies>();
species.addAll(this.isMaster ? system.getAllSpecies() : system.getDiscoveredSpecies(this.getWindow().getWorld(), this.getWindow().getPlayer().getGameProfile()));
private Collection<IAlleleSpecies> getSpecies(BreedingSystem system) {
Collection<IAlleleSpecies> species = new ArrayList<>();
species.addAll(isMaster ? system.getAllSpecies() : system.getDiscoveredSpecies(getWindow().getWorld(), getWindow().getPlayer().getGameProfile()));
return species;
}
}
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.CraftGUI;
@@ -15,23 +11,21 @@ import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageDescription extends ControlAnalystPage
{
public AnalystPageDescription(final IWidget parent, final IArea area, final IIndividual ind) {
public class AnalystPageDescription extends ControlAnalystPage {
public AnalystPageDescription(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
this.setColor(3355443);
setColor(3355443);
int y = 4;
final IAlleleSpecies species = ind.getGenome().getPrimary();
final String branchBinomial = (species.getBranch() != null) ? species.getBranch().getScientific() : "<Unknown>";
final String branchName = (species.getBranch() != null) ? species.getBranch().getName() : "Unknown";
final String desc = species.getDescription();
IAlleleSpecies species = ind.getGenome().getPrimary();
String branchBinomial = (species.getBranch() != null) ? species.getBranch().getScientific() : "<Unknown>";
String branchName = (species.getBranch() != null) ? species.getBranch().getName() : "Unknown";
String desc = species.getDescription();
String descBody = EnumChatFormatting.ITALIC.toString();
String descSig = "";
if (desc == null || desc.isEmpty() || desc.contains("for.description")) {
descBody += "";
}
else {
final String[] descStrings = desc.split("\\|");
} else {
String[] descStrings = desc.split("\\|");
descBody += descStrings[0];
for (int i = 1; i < descStrings.length - 1; ++i) {
descBody += " " + descStrings[i];
@@ -45,28 +39,28 @@ public class AnalystPageDescription extends ControlAnalystPage
authority = EnumChatFormatting.DARK_BLUE.toString() + EnumChatFormatting.BOLD + authority;
}
if (authority.contains("Sengir")) {
authority = EnumChatFormatting.DARK_GREEN.toString() + EnumChatFormatting.BOLD + authority;
authority = EnumChatFormatting.DARK_GREEN.toString() + EnumChatFormatting.BOLD + authority;
}
if (authority.contains("MysteriousAges")) {
authority = EnumChatFormatting.DARK_PURPLE.toString() + EnumChatFormatting.BOLD + authority;
authority = EnumChatFormatting.DARK_PURPLE.toString() + EnumChatFormatting.BOLD + authority;
}
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Description").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Description").setColor(getColor());
y += 16;
new ControlTextCentered(this, y, species.getName() + EnumChatFormatting.RESET).setColor(this.getColor());
new ControlTextCentered(this, y, species.getName() + EnumChatFormatting.RESET).setColor(getColor());
y += 10;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + EnumChatFormatting.RESET).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + EnumChatFormatting.RESET).setColor(getColor());
y += 20;
new ControlTextCentered(this, y, "Discovered by " + EnumChatFormatting.BOLD + authority + EnumChatFormatting.RESET).setColor(this.getColor());
y += (int) (3.0f + CraftGUI.Render.textHeight("Discovered by " + EnumChatFormatting.BOLD + authority + EnumChatFormatting.RESET, this.w()));
new ControlTextCentered(this, y, "Genetic Complexity: " + species.getComplexity()).setColor(this.getColor());
new ControlTextCentered(this, y, "Discovered by " + EnumChatFormatting.BOLD + authority + EnumChatFormatting.RESET).setColor(getColor());
y += (int) (3.0f + CraftGUI.Render.textHeight("Discovered by " + EnumChatFormatting.BOLD + authority + EnumChatFormatting.RESET, w()));
new ControlTextCentered(this, y, "Genetic Complexity: " + species.getComplexity()).setColor(getColor());
y += 26;
final ControlText descText = new ControlText(this, new IArea(8.0f, y, this.w() - 16.0f, 0.0f), descBody + EnumChatFormatting.RESET, TextJustification.TopCenter);
final IWidget signatureText = new ControlText(this, new IArea(8.0f, y, this.w() - 16.0f, 0.0f), descSig + EnumChatFormatting.RESET, TextJustification.BottomRight);
descText.setColor(this.getColor());
signatureText.setColor(this.getColor());
final float descHeight = CraftGUI.Render.textHeight(descText.getValue(), descText.getSize().x());
ControlText descText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descBody + EnumChatFormatting.RESET, TextJustification.TopCenter);
IWidget signatureText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descSig + EnumChatFormatting.RESET, TextJustification.BottomRight);
descText.setColor(getColor());
signatureText.setColor(getColor());
float descHeight = CraftGUI.Render.textHeight(descText.getValue(), descText.getSize().x());
signatureText.setPosition(new IPoint(signatureText.pos().x(), descText.getPosition().y() + descHeight + 10.0f));
this.setSize(new IPoint(this.w(), 20.0f + signatureText.y()));
setSize(new IPoint(w(), 20.0f + signatureText.y()));
}
@Override
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.Binnie;
@@ -25,32 +21,31 @@ import net.minecraft.util.EnumChatFormatting;
import java.lang.reflect.Field;
import java.util.Collection;
public class AnalystPageFruit extends AnalystPageProduce
{
public AnalystPageFruit(final IWidget parent, final IArea area, final ITree ind) {
public class AnalystPageFruit extends AnalystPageProduce {
public AnalystPageFruit(IWidget parent, IArea area, ITree ind) {
super(parent, area);
this.setColor(13382400);
final ITreeGenome genome = ind.getGenome();
setColor(0xcc3300);
ITreeGenome genome = ind.getGenome();
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Fruit").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Fruit").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Yield: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD))).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Yield: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD))).setColor(getColor());
y += 20;
final Collection<ItemStack> products = new UniqueItemStackSet();
final Collection<ItemStack> specialties = new UniqueItemStackSet();
final Collection<ItemStack> wiid = new UniqueItemStackSet();
for (final ItemStack stack : ind.getProduceList()) {
Collection<ItemStack> products = new UniqueItemStackSet();
Collection<ItemStack> specialties = new UniqueItemStackSet();
Collection<ItemStack> wiid = new UniqueItemStackSet();
for (ItemStack stack : ind.getProduceList()) {
products.add(stack);
}
for (final ItemStack stack : ind.getSpecialtyList()) {
for (ItemStack stack : ind.getSpecialtyList()) {
specialties.add(stack);
}
try {
if (ind.getGenome().getFruitProvider() instanceof FruitProviderPod) {
final FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider();
final Field f = FruitProviderPod.class.getDeclaredField("drop");
FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider();
Field f = FruitProviderPod.class.getDeclaredField("drop");
f.setAccessible(true);
for (final ItemStack stack2 : (ItemStack[]) f.get(pod)) {
for (ItemStack stack2 : (ItemStack[]) f.get(pod)) {
products.add(stack2);
}
}
@@ -58,71 +53,70 @@ public class AnalystPageFruit extends AnalystPageProduce
e.printStackTrace();
}
if (products.size() > 0) {
new ControlTextCentered(this, y, "Natural Fruit").setColor(this.getColor());
new ControlTextCentered(this, y, "Natural Fruit").setColor(getColor());
y += 10;
final int w = products.size() * 18 - 2;
final int i = 0;
for (final ItemStack stack : products) {
final ControlItemDisplay d = new ControlItemDisplay(this, (this.w() - w) / 2.0f + 18 * i, y);
int w = products.size() * 18 - 2;
int i = 0;
for (ItemStack stack : products) {
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
d.setTooltip();
d.setItemStack(stack);
}
y += 26;
}
if (specialties.size() > 0) {
new ControlTextCentered(this, y, "Specialty Fruit").setColor(this.getColor());
new ControlTextCentered(this, y, "Specialty Fruit").setColor(getColor());
y += 10;
final int w = products.size() * 18 - 2;
final int i = 0;
for (final ItemStack stack : specialties) {
final ControlItemDisplay d = new ControlItemDisplay(this, (this.w() - w) / 2.0f + 18 * i, y);
int w = products.size() * 18 - 2;
int i = 0;
for (ItemStack stack : specialties) {
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
d.setTooltip();
d.setItemStack(stack);
}
y += 26;
}
final Collection<ItemStack> allProducts = new UniqueItemStackSet();
for (final ItemStack stack3 : products) {
Collection<ItemStack> allProducts = new UniqueItemStackSet();
for (ItemStack stack3 : products) {
allProducts.add(stack3);
}
for (final ItemStack stack3 : specialties) {
for (ItemStack stack3 : specialties) {
allProducts.add(stack3);
}
final Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(this.getAllProductsAndFluids(allProducts));
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
if (refinedProducts.size() > 0) {
y = this.getRefined("Refined Products", y, refinedProducts);
y = getRefined("Refined Products", y, refinedProducts);
y += 8;
}
if (products.size() == 0 && specialties.size() == 0) {
new ControlTextCentered(this, y, "This tree has no \nfruits or nuts").setColor(this.getColor());
new ControlTextCentered(this, y, "This tree has no \nfruits or nuts").setColor(getColor());
y += 28;
}
new ControlTextCentered(this, y, "Possible Fruits").setColor(this.getColor());
new ControlTextCentered(this, y, "Possible Fruits").setColor(getColor());
y += 12;
final Collection<IAllele> fruitAlleles = Binnie.Genetics.getChromosomeMap(Binnie.Genetics.getTreeRoot()).get(EnumTreeChromosome.FRUITS);
for (final IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) {
final Collection<ItemStack> stacks = new UniqueItemStackSet();
for (final IAllele a : fruitAlleles) {
Collection<IAllele> fruitAlleles = Binnie.Genetics.getChromosomeMap(Binnie.Genetics.getTreeRoot()).get(EnumTreeChromosome.FRUITS);
for (IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) {
Collection<ItemStack> stacks = new UniqueItemStackSet();
for (IAllele a : fruitAlleles) {
if (((IAlleleFruit) a).getProvider().getFamily() == fam) {
for (final ItemStack p : ((IAlleleFruit) a).getProvider().getProducts()) {
for (ItemStack p : ((IAlleleFruit) a).getProvider().getProducts()) {
stacks.add(p);
}
for (final ItemStack p : ((IAlleleFruit) a).getProvider().getSpecialty()) {
for (ItemStack p : ((IAlleleFruit) a).getProvider().getSpecialty()) {
stacks.add(p);
}
try {
if (a.getUID().contains("fruitCocoa")) {
stacks.add(new ItemStack(Items.dye, 1, 3));
}
else {
} else {
if (!(((IAlleleFruit) a).getProvider() instanceof FruitProviderPod)) {
continue;
}
final FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider();
final Field field = FruitProviderPod.class.getDeclaredField("drop");
FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider();
Field field = FruitProviderPod.class.getDeclaredField("drop");
field.setAccessible(true);
for (final ItemStack stack4 : (ItemStack[]) field.get(pod2)) {
for (ItemStack stack4 : (ItemStack[]) field.get(pod2)) {
stacks.add(stack4);
}
}
@@ -130,10 +124,10 @@ public class AnalystPageFruit extends AnalystPageProduce
}
}
}
y = this.getRefined(EnumChatFormatting.ITALIC + fam.getName(), y, stacks);
y = getRefined(EnumChatFormatting.ITALIC + fam.getName(), y, stacks);
y += 2;
}
this.setSize(new IPoint(this.w(), y + 8));
setSize(new IPoint(w(), y + 8));
}
@Override
@@ -1,41 +1,36 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import forestry.api.genetics.IAllele;
import binnie.core.genetics.BreedingSystem;
import forestry.api.genetics.ISpeciesRoot;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.Binnie;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.genetics.BreedingSystem;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;
import binnie.core.craftgui.controls.core.Control;
import binnie.Binnie;
import forestry.api.genetics.AlleleManager;
import binnie.core.craftgui.controls.ControlTextCentered;
import forestry.api.genetics.IIndividual;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
public class AnalystPageGenome extends ControlAnalystPage
{
public class AnalystPageGenome extends ControlAnalystPage {
boolean active;
public AnalystPageGenome(final IWidget parent, final IArea area, final boolean active, final IIndividual ind) {
public AnalystPageGenome(IWidget parent, IArea area, boolean active, IIndividual ind) {
super(parent, area);
this.active = active;
this.setColor(26265);
setColor(26265);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + this.getTitle()).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 16;
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
final BreedingSystem system = Binnie.Genetics.getSystem(root);
final Control scaled = new Control(this, 0.0f, y, 0.0f, 0.0f) {
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
BreedingSystem system = Binnie.Genetics.getSystem(root);
Control scaled = new Control(this, 0.0f, y, 0.0f, 0.0f) {
@Override
public void onRenderBackground() {
GL11.glPushMatrix();
@@ -48,19 +43,19 @@ public class AnalystPageGenome extends ControlAnalystPage
GL11.glPopMatrix();
}
};
for (final IChromosomeType chromo : system.getActiveKaryotype()) {
final IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo);
final String alleleName = system.getAlleleName(chromo, allele);
final float height = CraftGUI.Render.textHeight(alleleName, this.w() / 2.0f - 2.0f);
new ControlText(scaled, new IArea(0.0f, y + (height - 9.0f) / 2.0f, this.w() / 2.0f - 2.0f, 0.0f), system.getChromosomeShortName(chromo) + " :", TextJustification.TopRight).setColor(this.getColor());
new ControlText(scaled, new IArea(this.w() / 2.0f + 2.0f, y, this.w() / 2.0f - 2.0f, 0.0f), alleleName, TextJustification.TopLeft).setColor(this.getColor());
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.TopRight).setColor(getColor());
new ControlText(scaled, new IArea(w() / 2.0f + 2.0f, y, w() / 2.0f - 2.0f, 0.0f), alleleName, TextJustification.TopLeft).setColor(getColor());
y += (int) (3.0f + height);
}
this.setSize(new IPoint(this.w(), y + 8));
setSize(new IPoint(w(), y + 8));
}
@Override
public String getTitle() {
return (this.active ? "Active" : "Inactive") + " Genome";
return (active ? "Active" : "Inactive") + " Genome";
}
}
@@ -1,45 +1,40 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.arboriculture.EnumTreeChromosome;
import binnie.Binnie;
import forestry.api.arboriculture.ITree;
import binnie.core.craftgui.controls.ControlTextCentered;
import forestry.api.genetics.IIndividual;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.geometry.IArea;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.arboriculture.ITree;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageGrowth extends ControlAnalystPage
{
public AnalystPageGrowth(final IWidget parent, final IArea area, final IIndividual ind) {
public class AnalystPageGrowth extends ControlAnalystPage {
public AnalystPageGrowth(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
this.setColor(3355443);
setColor(3355443);
int y = 4;
final IAlleleSpecies species = ind.getGenome().getPrimary();
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Growth").setColor(this.getColor());
IAlleleSpecies species = ind.getGenome().getPrimary();
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Growth").setColor(getColor());
y += 12;
if (ind instanceof ITree) {
final ITree tree = (ITree) ind;
final int mat = tree.getGenome().getMaturationTime();
new ControlTextCentered(this, y, "Saplings mature in").setColor(this.getColor());
ITree tree = (ITree) ind;
int mat = tree.getGenome().getMaturationTime();
new ControlTextCentered(this, y, "Saplings mature in").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + this.getTimeString(1373.3999f * mat)).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getTimeString(1373.3999f * mat)).setColor(getColor());
y += 22;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Height: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT))).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Height: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT))).setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Girth: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH))).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Girth: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH))).setColor(getColor());
y += 20;
new ControlTextCentered(this, y, "Growth Conditions").setColor(this.getColor());
new ControlTextCentered(this, y, "Growth Conditions").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + tree.getGenome().getGrowthProvider().getDescription()).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + tree.getGenome().getGrowthProvider().getDescription()).setColor(getColor());
y += 12;
for (final String s : tree.getGenome().getGrowthProvider().getInfo()) {
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + s).setColor(this.getColor());
for (String s : tree.getGenome().getGrowthProvider().getInfo()) {
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + s).setColor(getColor());
y += 12;
}
}
@@ -1,37 +1,32 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.genetics.BreedingSystem;
import forestry.api.genetics.ISpeciesRoot;
import forestry.api.genetics.IChromosomeType;
import binnie.Binnie;
import forestry.api.genetics.AlleleManager;
import binnie.core.craftgui.controls.ControlTextCentered;
import forestry.api.genetics.IIndividual;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.genetics.BreedingSystem;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageKaryogram extends ControlAnalystPage
{
public AnalystPageKaryogram(final IWidget parent, final IArea area, final IIndividual ind) {
public class AnalystPageKaryogram extends ControlAnalystPage {
public AnalystPageKaryogram(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
this.setColor(10040319);
setColor(10040319);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Karyogram").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Karyogram").setColor(getColor());
y += 16;
y += 8;
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
final BreedingSystem system = Binnie.Genetics.getSystem(root);
final int maxBiomePerLine = (int) ((this.w() + 4.0f - 16.0f) / 22.0f);
float karygramX = (this.w() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2.0f;
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
BreedingSystem system = Binnie.Genetics.getSystem(root);
int maxBiomePerLine = (int) ((w() + 4.0f - 16.0f) / 22.0f);
float karygramX = (w() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2.0f;
int dx = 0;
int dy = 0;
int rem = system.getActiveKaryotype().size();
for (final IChromosomeType type : system.getActiveKaryotype()) {
for (IChromosomeType type : system.getActiveKaryotype()) {
new ControlAnalystChromosome(this, karygramX + dx, y + dy, root, type, ind.getGenome().getActiveAllele(type), ind.getGenome().getInactiveAllele(type));
dx += 22;
if (dx >= 22 * maxBiomePerLine - 22) {
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.Binnie;
@@ -34,19 +30,18 @@ import net.minecraft.util.EnumChatFormatting;
import java.util.Collection;
import java.util.List;
public class AnalystPageMutations extends ControlAnalystPage
{
public AnalystPageMutations(final IWidget parent, final IArea area, final IIndividual ind, final boolean isMaster) {
public class AnalystPageMutations extends ControlAnalystPage {
public AnalystPageMutations(IWidget parent, IArea area, IIndividual ind, boolean isMaster) {
super(parent, area);
this.setColor(3355392);
setColor(3355392);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Mutations").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Mutations").setColor(getColor());
y += 18;
final BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
final List<IMutation> discovered = system.getDiscoveredMutations(Window.get(this).getWorld(), Window.get(this).getUsername());
final IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary();
final Collection<IMutation> resultant = system.getResultantMutations(speciesCurrent);
final Collection<IMutation> further = system.getFurtherMutations(speciesCurrent);
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() == ExtraBeesSpecies.WATER) {
@@ -83,59 +78,55 @@ public class AnalystPageMutations extends ControlAnalystPage
hive = new ItemStack(Blocks.chest);
}
if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Valiant.getAllele()) {
new ControlTextCentered(this, y, "Natural Habitat").setColor(this.getColor());
new ControlTextCentered(this, y, "Natural Habitat").setColor(getColor());
y += 10;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Found in any Hive").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Found in any Hive").setColor(getColor());
y += 22;
}
else if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Monastic.getAllele()) {
new ControlTextCentered(this, y, "Natural Habitat").setColor(this.getColor());
} else if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Monastic.getAllele()) {
new ControlTextCentered(this, y, "Natural Habitat").setColor(getColor());
y += 10;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Bought from Villagers").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Bought from Villagers").setColor(getColor());
y += 22;
}
else if (hive != null) {
new ControlTextCentered(this, y, "Natural Habitat").setColor(this.getColor());
} else if (hive != null) {
new ControlTextCentered(this, y, "Natural Habitat").setColor(getColor());
y += 10;
final ControlItemDisplay display = new ControlItemDisplay(this, (this.w() - 16.0f) / 2.0f, y);
ControlItemDisplay display = new ControlItemDisplay(this, (w() - 16.0f) / 2.0f, y);
if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Steadfast.getAllele()) {
display.addTooltip("Dungeon Chests");
}
else {
} else {
display.setTooltip();
}
display.setItemStack(hive);
y += 24;
}
}
float ox = (this.w() - 88.0f - 8.0f) / 2.0f;
float ox = (w() - 88.0f - 8.0f) / 2.0f;
float dx = 0.0f;
if (!resultant.isEmpty()) {
if (resultant.size() == 1) {
ox = (this.w() - 44.0f) / 2.0f;
ox = (w() - 44.0f) / 2.0f;
}
new ControlTextCentered(this, y, "Resultant Mutations").setColor(this.getColor());
new ControlTextCentered(this, y, "Resultant Mutations").setColor(getColor());
y += 10;
for (final IMutation mutation : resultant) {
final float specificChance = this.getSpecificChance(ind, mutation, system);
if (!isMaster && !this.isKnown(system, mutation)) {
for (IMutation mutation : resultant) {
float specificChance = getSpecificChance(ind, mutation, system);
if (!isMaster && !isKnown(system, mutation)) {
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
}
else {
} else {
new Control(this, ox + dx, y, 44.0f, 16.0f) {
@Override
public void initialise() {
final IAlleleSpecies species0 = mutation.getAllele0();
final IAlleleSpecies species2 = mutation.getAllele1();
final String comb = species0.getName() + " + " + species2.getName();
this.addTooltip(comb);
String chance = AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% Chance";
IAlleleSpecies species0 = mutation.getAllele0();
IAlleleSpecies species2 = mutation.getAllele1();
String comb = species0.getName() + " + " + species2.getName();
addTooltip(comb);
String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% Chance";
if (specificChance != mutation.getBaseChance()) {
chance = chance + AnalystPageMutations.this.getMutationColour(specificChance).getCode() + " (" + (int) specificChance + "% currently)";
chance = chance + getMutationColour(specificChance).getCode() + " (" + (int) specificChance + "% currently)";
}
this.addTooltip(chance);
for (final String s : mutation.getSpecialConditions()) {
this.addTooltip(s);
addTooltip(chance);
for (String s : mutation.getSpecialConditions()) {
addTooltip(s);
}
}
@@ -144,13 +135,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.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
CraftGUI.Render.colour(getMutationColour(mutation.getBaseChance()).getColour());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd0.getIcon());
CraftGUI.Render.colour(AnalystPageMutations.this.getMutationColour(specificChance).getColour());
CraftGUI.Render.colour(getMutationColour(specificChance).getColour());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd1.getIcon());
}
else {
CraftGUI.Render.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
} else {
CraftGUI.Render.colour(getMutationColour(mutation.getBaseChance()).getColour());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd.getIcon());
}
}
@@ -166,36 +156,35 @@ public class AnalystPageMutations extends ControlAnalystPage
}
y += 10;
}
ox = (this.w() - 88.0f - 8.0f) / 2.0f;
ox = (w() - 88.0f - 8.0f) / 2.0f;
dx = 0.0f;
if (!further.isEmpty()) {
if (further.size() == 1) {
ox = (this.w() - 44.0f) / 2.0f;
ox = (w() - 44.0f) / 2.0f;
}
new ControlTextCentered(this, y, "Further Mutations").setColor(this.getColor());
new ControlTextCentered(this, y, "Further Mutations").setColor(getColor());
y += 10;
for (final IMutation mutation : further) {
final IAllele speciesComb = mutation.getPartner(speciesCurrent);
final float specificChance2 = this.getSpecificChance(ind, mutation, system);
if (!isMaster && !this.isKnown(system, mutation)) {
for (IMutation mutation : further) {
IAllele speciesComb = mutation.getPartner(speciesCurrent);
float specificChance2 = getSpecificChance(ind, mutation, system);
if (!isMaster && !isKnown(system, mutation)) {
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
}
else {
} else {
new Control(this, ox + dx, y, 44.0f, 16.0f) {
@Override
public void initialise() {
final IAlleleSpecies species0 = (IAlleleSpecies) speciesComb;
final IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0];
this.addTooltip(species2.getName());
final String comb = speciesCurrent.getName() + " + " + species0.getName();
this.addTooltip(comb);
String chance = AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% Chance";
IAlleleSpecies species0 = (IAlleleSpecies) speciesComb;
IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0];
addTooltip(species2.getName());
String comb = speciesCurrent.getName() + " + " + species0.getName();
addTooltip(comb);
String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% Chance";
if (specificChance2 != mutation.getBaseChance()) {
chance = chance + AnalystPageMutations.this.getMutationColour(specificChance2).getCode() + " (" + (int) specificChance2 + "% currently)";
chance = chance + getMutationColour(specificChance2).getCode() + " (" + (int) specificChance2 + "% currently)";
}
this.addTooltip(chance);
for (final String s : mutation.getSpecialConditions()) {
this.addTooltip(s);
addTooltip(chance);
for (String s : mutation.getSpecialConditions()) {
addTooltip(s);
}
}
@@ -203,15 +192,14 @@ 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.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
CraftGUI.Render.colour(getMutationColour(mutation.getBaseChance()).getColour());
if (specificChance2 != mutation.getBaseChance()) {
CraftGUI.Render.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
CraftGUI.Render.colour(getMutationColour(mutation.getBaseChance()).getColour());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow0.getIcon());
CraftGUI.Render.colour(AnalystPageMutations.this.getMutationColour(specificChance2).getColour());
CraftGUI.Render.colour(getMutationColour(specificChance2).getColour());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow1.getIcon());
}
else {
CraftGUI.Render.colour(AnalystPageMutations.this.getMutationColour(mutation.getBaseChance()).getColour());
} else {
CraftGUI.Render.colour(getMutationColour(mutation.getBaseChance()).getColour());
CraftGUI.Render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow.getIcon());
}
}
@@ -227,15 +215,15 @@ public class AnalystPageMutations extends ControlAnalystPage
}
}
y += 8;
this.setSize(new IPoint(this.w(), y));
setSize(new IPoint(w(), y));
}
private boolean isKnown(final BreedingSystem system, final IMutation mutation) {
return system.getDiscoveredMutations(this.getWindow().getWorld(), this.getWindow().getPlayer().getGameProfile()).contains(mutation);
private boolean isKnown(BreedingSystem system, IMutation mutation) {
return system.getDiscoveredMutations(getWindow().getWorld(), getWindow().getPlayer().getGameProfile()).contains(mutation);
}
private float getSpecificChance(final IIndividual ind, final IMutation mutation, final BreedingSystem system) {
return system.getChance(mutation, this.getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1());
private float getSpecificChance(IIndividual ind, IMutation mutation, BreedingSystem system) {
return system.getChance(mutation, getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1());
}
@Override
@@ -243,7 +231,7 @@ public class AnalystPageMutations extends ControlAnalystPage
return "Mutations";
}
protected EnumColor getMutationColour(final float percent) {
protected EnumColor getMutationColour(float percent) {
if (percent >= 20.0f) {
return EnumColor.DarkGreen;
}
@@ -262,17 +250,16 @@ public class AnalystPageMutations extends ControlAnalystPage
return EnumColor.DarkRed;
}
static class ControlUnknownMutation extends Control
{
public ControlUnknownMutation(final IWidget parent, final float x, final float y, final float w, final float h) {
static class ControlUnknownMutation extends Control {
public ControlUnknownMutation(IWidget parent, float x, float y, float w, float h) {
super(parent, x, y, w, h);
this.addAttribute(WidgetAttribute.MouseOver);
this.addTooltip("Unknown Mutation");
addAttribute(WidgetAttribute.MouseOver);
addTooltip("Unknown Mutation");
}
@Override
public void onRenderBackground() {
CraftGUI.Render.text(this.getArea(), TextJustification.MiddleCenter, "UNKNOWN", 11184810);
CraftGUI.Render.text(getArea(), TextJustification.MiddleCenter, "UNKNOWN", 11184810);
}
}
}
@@ -1,59 +1,55 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlTextCentered;
import net.minecraft.init.Items;
import net.minecraftforge.fluids.FluidContainerRegistry;
import binnie.extratrees.machines.Distillery;
import binnie.extratrees.machines.Brewery;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.util.UniqueFluidStackSet;
import binnie.core.util.UniqueItemStackSet;
import binnie.extratrees.machines.Brewery;
import binnie.extratrees.machines.Distillery;
import binnie.extratrees.machines.Press;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import forestry.api.recipes.RecipeManagers;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import forestry.api.recipes.RecipeManagers;
import java.util.ArrayList;
import net.minecraft.item.crafting.FurnaceRecipes;
import binnie.core.util.UniqueItemStackSet;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
public abstract class AnalystPageProduce extends ControlAnalystPage
{
public AnalystPageProduce(final IWidget parent, final IArea area) {
public abstract class AnalystPageProduce extends ControlAnalystPage {
public AnalystPageProduce(IWidget parent, IArea area) {
super(parent, area);
}
protected Collection<? extends ItemStack> getAllProducts(final ItemStack key) {
final Collection<ItemStack> products = new UniqueItemStackSet();
products.addAll(this.getCentrifuge(key));
products.addAll(this.getSqueezer(key));
protected Collection<? extends ItemStack> getAllProducts(ItemStack key) {
Collection<ItemStack> products = new UniqueItemStackSet();
products.addAll(getCentrifuge(key));
products.addAll(getSqueezer(key));
products.add(FurnaceRecipes.smelting().getSmeltingResult(key));
products.addAll(this.getCrafting(key));
products.addAll(getCrafting(key));
return products;
}
public Collection<ItemStack> getCentrifuge(final ItemStack stack) {
final List<ItemStack> products = new ArrayList<ItemStack>();
for (final Map.Entry<Object[], Object[]> recipe : RecipeManagers.centrifugeManager.getRecipes().entrySet()) {
public Collection<ItemStack> getCentrifuge(ItemStack stack) {
List<ItemStack> products = new ArrayList<ItemStack>();
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.centrifugeManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (final Object obj : recipe.getKey()) {
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
if (isRecipe) {
for (final Object obj : recipe.getValue()) {
for (Object obj : recipe.getValue()) {
if (obj instanceof ItemStack) {
products.add((ItemStack) obj);
}
@@ -63,17 +59,17 @@ public abstract class AnalystPageProduce extends ControlAnalystPage
return products;
}
public Collection<ItemStack> getSqueezer(final ItemStack stack) {
final List<ItemStack> products = new ArrayList<ItemStack>();
for (final Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
public Collection<ItemStack> getSqueezer(ItemStack stack) {
List<ItemStack> products = new ArrayList<ItemStack>();
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (final Object obj : recipe.getKey()) {
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
if (isRecipe) {
for (final Object obj : recipe.getValue()) {
for (Object obj : recipe.getValue()) {
if (obj instanceof ItemStack) {
products.add((ItemStack) obj);
}
@@ -83,13 +79,13 @@ public abstract class AnalystPageProduce extends ControlAnalystPage
return products;
}
public Collection<ItemStack> getCrafting(final ItemStack stack) {
final List<ItemStack> products = new ArrayList<ItemStack>();
for (final Object recipeO : CraftingManager.getInstance().getRecipeList()) {
public Collection<ItemStack> getCrafting(ItemStack stack) {
List<ItemStack> products = new ArrayList<ItemStack>();
for (Object recipeO : CraftingManager.getInstance().getRecipeList()) {
if (recipeO instanceof ShapelessRecipes) {
final ShapelessRecipes recipe = (ShapelessRecipes) recipeO;
ShapelessRecipes recipe = (ShapelessRecipes) recipeO;
boolean match = true;
for (final Object rec : recipe.recipeItems) {
for (Object rec : recipe.recipeItems) {
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
match = false;
}
@@ -99,9 +95,9 @@ public abstract class AnalystPageProduce extends ControlAnalystPage
}
}
if (recipeO instanceof ShapedRecipes) {
final ShapedRecipes recipe2 = (ShapedRecipes) recipeO;
ShapedRecipes recipe2 = (ShapedRecipes) recipeO;
boolean match = true;
for (final Object rec2 : recipe2.recipeItems) {
for (Object rec2 : recipe2.recipeItems) {
if (rec2 != null && (!(rec2 instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec2))) {
match = false;
}
@@ -111,9 +107,9 @@ public abstract class AnalystPageProduce extends ControlAnalystPage
}
}
if (recipeO instanceof ShapelessOreRecipe) {
final ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO;
ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO;
boolean match = true;
for (final Object rec : recipe3.getInput()) {
for (Object rec : recipe3.getInput()) {
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
match = false;
}
@@ -127,26 +123,26 @@ public abstract class AnalystPageProduce extends ControlAnalystPage
return products;
}
public Collection<FluidStack> getAllFluids(final ItemStack stack) {
final List<FluidStack> products = new ArrayList<FluidStack>();
products.addAll(this.getSqueezerFluid(stack));
public Collection<FluidStack> getAllFluids(ItemStack stack) {
List<FluidStack> products = new ArrayList<FluidStack>();
products.addAll(getSqueezerFluid(stack));
if (Press.getOutput(stack) != null) {
products.add(Press.getOutput(stack));
}
return products;
}
public Collection<FluidStack> getSqueezerFluid(final ItemStack stack) {
final List<FluidStack> products = new ArrayList<FluidStack>();
for (final Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
public Collection<FluidStack> getSqueezerFluid(ItemStack stack) {
List<FluidStack> products = new ArrayList<FluidStack>();
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (final Object obj : recipe.getKey()) {
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
if (isRecipe) {
for (final Object obj : recipe.getValue()) {
for (Object obj : recipe.getValue()) {
if (obj instanceof FluidStack) {
products.add((FluidStack) obj);
}
@@ -156,8 +152,8 @@ public abstract class AnalystPageProduce extends ControlAnalystPage
return products;
}
protected Collection<? extends FluidStack> getAllProducts(final FluidStack stack) {
final Collection<FluidStack> fluids = new UniqueFluidStackSet();
protected Collection<? extends FluidStack> getAllProducts(FluidStack stack) {
Collection<FluidStack> fluids = new UniqueFluidStackSet();
fluids.add(Brewery.getOutput(stack));
fluids.add(Distillery.getOutput(stack, 0));
fluids.add(Distillery.getOutput(stack, 1));
@@ -165,38 +161,38 @@ public abstract class AnalystPageProduce extends ControlAnalystPage
return fluids;
}
protected Collection<ItemStack> getAllProductsAndFluids(final Collection<ItemStack> collection) {
final Collection<ItemStack> products = new UniqueItemStackSet();
for (final ItemStack stack : collection) {
products.addAll(this.getAllProducts(stack));
protected Collection<ItemStack> getAllProductsAndFluids(Collection<ItemStack> collection) {
Collection<ItemStack> products = new UniqueItemStackSet();
for (ItemStack stack : collection) {
products.addAll(getAllProducts(stack));
}
final Collection<ItemStack> products2 = new UniqueItemStackSet();
for (final ItemStack stack2 : products) {
products2.addAll(this.getAllProducts(stack2));
Collection<ItemStack> products2 = new UniqueItemStackSet();
for (ItemStack stack2 : products) {
products2.addAll(getAllProducts(stack2));
}
final Collection<ItemStack> products3 = new UniqueItemStackSet();
for (final ItemStack stack3 : products2) {
products3.addAll(this.getAllProducts(stack3));
Collection<ItemStack> products3 = new UniqueItemStackSet();
for (ItemStack stack3 : products2) {
products3.addAll(getAllProducts(stack3));
}
products.addAll(products2);
products.addAll(products3);
final Collection<FluidStack> allFluids = new UniqueFluidStackSet();
for (final ItemStack stack4 : collection) {
allFluids.addAll(this.getAllFluids(stack4));
Collection<FluidStack> allFluids = new UniqueFluidStackSet();
for (ItemStack stack4 : collection) {
allFluids.addAll(getAllFluids(stack4));
}
final Collection<FluidStack> fluids2 = new UniqueFluidStackSet();
for (final FluidStack stack5 : allFluids) {
fluids2.addAll(this.getAllProducts(stack5));
Collection<FluidStack> fluids2 = new UniqueFluidStackSet();
for (FluidStack stack5 : allFluids) {
fluids2.addAll(getAllProducts(stack5));
}
final Collection<FluidStack> fluids3 = new UniqueFluidStackSet();
for (final FluidStack stack6 : fluids2) {
fluids3.addAll(this.getAllProducts(stack6));
Collection<FluidStack> fluids3 = new UniqueFluidStackSet();
for (FluidStack stack6 : fluids2) {
fluids3.addAll(getAllProducts(stack6));
}
allFluids.addAll(fluids2);
allFluids.addAll(fluids3);
for (final FluidStack fluid : allFluids) {
for (FluidStack fluid : allFluids) {
ItemStack container = null;
for (final FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle)) && data.fluid.isFluidEqual(fluid)) {
container = data.filledContainer;
break;
@@ -217,21 +213,21 @@ public abstract class AnalystPageProduce extends ControlAnalystPage
return products;
}
protected int getRefined(final String string, int y, final Collection<ItemStack> products) {
new ControlTextCentered(this, y, string).setColor(this.getColor());
protected int getRefined(String string, int y, Collection<ItemStack> products) {
new ControlTextCentered(this, y, string).setColor(getColor());
y += 10;
final int maxBiomePerLine = (int) ((this.w() + 2.0f - 16.0f) / 18.0f);
final float biomeListX = (this.w() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2.0f;
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
float biomeListX = (w() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2.0f;
int dx = 0;
int dy = 0;
for (final ItemStack soilStack : products) {
for (ItemStack soilStack : products) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
final FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(soilStack);
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(soilStack);
soilStack.stackSize = 1;
final ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null);
ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null);
if (fluid != null) {
display.addTooltip(fluid.getLocalizedName());
}
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.Binnie;
@@ -32,66 +28,65 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public class AnalystPageProducts extends AnalystPageProduce
{
public AnalystPageProducts(final IWidget parent, final IArea area, final IBee ind) {
public class AnalystPageProducts extends AnalystPageProduce {
public AnalystPageProducts(IWidget parent, IArea area, IBee ind) {
super(parent, area);
this.setColor(13382400);
final IBeeGenome genome = ind.getGenome();
final float speed = genome.getSpeed();
final float modeSpeed = Binnie.Genetics.getBeeRoot().getBeekeepingMode(BinnieCore.proxy.getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f);
setColor(13382400);
IBeeGenome genome = ind.getGenome();
float speed = genome.getSpeed();
float modeSpeed = Binnie.Genetics.getBeeRoot().getBeekeepingMode(BinnieCore.proxy.getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Produce").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Produce").setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Rate: " + Binnie.Genetics.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED))).setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + "Rate: " + Binnie.Genetics.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED))).setColor(getColor());
y += 20;
final Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
final Collection<ItemStack> productList = new UniqueItemStackSet();
final Collection<ItemStack> specialtyList = new UniqueItemStackSet();
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
Collection<ItemStack> productList = new UniqueItemStackSet();
Collection<ItemStack> specialtyList = new UniqueItemStackSet();
Map<ItemStack, Float> products = new HashMap<ItemStack, Float>();
products.putAll(genome.getPrimary().getProductChances());
products.putAll(genome.getSecondary().getProductChances());
if (!products.isEmpty()) {
new ControlTextCentered(this, y, "Natural Products").setColor(this.getColor());
new ControlTextCentered(this, y, "Natural Products").setColor(getColor());
y += 12;
for (final Map.Entry<ItemStack, Float> entry : products.entrySet()) {
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
if (!productList.add(entry.getKey())) {
continue;
}
refinedProducts.addAll(this.getAllProducts(entry.getKey()));
this.createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
refinedProducts.addAll(getAllProducts(entry.getKey()));
createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
y += 18;
}
y += 12;
}
products = genome.getPrimary().getSpecialtyChances();
if (!products.isEmpty()) {
new ControlTextCentered(this, y, "Specialty Products").setColor(this.getColor());
new ControlTextCentered(this, y, "Specialty Products").setColor(getColor());
y += 12;
for (final Map.Entry<ItemStack, Float> entry : products.entrySet()) {
refinedProducts.addAll(this.getAllProducts(entry.getKey()));
this.createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
refinedProducts.addAll(getAllProducts(entry.getKey()));
createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
y += 18;
}
y += 12;
}
new ControlTextCentered(this, y, "Refined Products").setColor(this.getColor());
new ControlTextCentered(this, y, "Refined Products").setColor(getColor());
y += 12;
Collection<ItemStack> level2Products = new UniqueItemStackSet();
for (final ItemStack stack : refinedProducts) {
level2Products.addAll(this.getAllProducts(stack));
for (ItemStack stack : refinedProducts) {
level2Products.addAll(getAllProducts(stack));
}
refinedProducts.addAll(level2Products);
level2Products = new UniqueItemStackSet();
for (final ItemStack stack : refinedProducts) {
level2Products.addAll(this.getAllProducts(stack));
for (ItemStack stack : refinedProducts) {
level2Products.addAll(getAllProducts(stack));
}
refinedProducts.addAll(level2Products);
final Collection<FluidStack> allFluids = new ArrayList<FluidStack>();
for (final ItemStack stack2 : refinedProducts) {
for (final FluidStack addition : this.getAllFluids(stack2)) {
Collection<FluidStack> allFluids = new ArrayList<FluidStack>();
for (ItemStack stack2 : refinedProducts) {
for (FluidStack addition : getAllFluids(stack2)) {
boolean alreadyIn = false;
for (final FluidStack existing : allFluids) {
for (FluidStack existing : allFluids) {
if (existing.isFluidEqual(addition)) {
alreadyIn = true;
}
@@ -101,27 +96,27 @@ public class AnalystPageProducts extends AnalystPageProduce
}
}
}
final int maxBiomePerLine = (int) ((this.w() + 2.0f - 16.0f) / 18.0f);
final float biomeListX = (this.w() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2.0f;
int maxBiomePerLine = (int) ((w() + 2.0f - 16.0f) / 18.0f);
float biomeListX = (w() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2.0f;
int dx = 0;
int dy = 0;
for (final ItemStack soilStack : refinedProducts) {
for (ItemStack soilStack : refinedProducts) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
final ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy);
ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy);
display.setItemStack(soilStack);
display.setTooltip();
dx += 18;
}
for (final FluidStack soilStack2 : allFluids) {
for (FluidStack soilStack2 : allFluids) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
ItemStack container = null;
for (final FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle)) && data.fluid.isFluidEqual(soilStack2)) {
container = data.filledContainer;
break;
@@ -136,39 +131,38 @@ public class AnalystPageProducts extends AnalystPageProduce
}
}
if (container == null) {
final ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy);
ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy);
display2.setItemStack(soilStack2);
display2.setTooltip();
}
else {
final ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy);
} else {
ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy);
display3.setItemStack(container);
display3.setTooltip();
}
dx += 18;
}
this.setSize(new IPoint(this.w(), y + dy + 18 + 8));
setSize(new IPoint(w(), y + dy + 18 + 8));
}
private void createProductEntry(final ItemStack key, final Float value, final int y, final float speed) {
final ControlItemDisplay item = new ControlItemDisplay(this, 16.0f, y) {
private void createProductEntry(ItemStack key, Float value, int y, float speed) {
ControlItemDisplay item = new ControlItemDisplay(this, 16.0f, y) {
@Override
public void getTooltip(final Tooltip tooltip) {
public void getTooltip(Tooltip tooltip) {
super.getTooltip(tooltip);
final Collection<ItemStack> products = AnalystPageProducts.this.getCentrifuge(key);
Collection<ItemStack> products = getCentrifuge(key);
if (!products.isEmpty()) {
tooltip.add("Centrifuges to give: ");
for (final ItemStack prod : products) {
final NBTTagCompound nbt = new NBTTagCompound();
for (ItemStack prod : products) {
NBTTagCompound nbt = new NBTTagCompound();
prod.writeToNBT(nbt);
tooltip.add(prod, prod.getDisplayName());
}
}
final Collection<ItemStack> liquids = AnalystPageProducts.this.getSqueezer(key);
Collection<ItemStack> liquids = getSqueezer(key);
if (!liquids.isEmpty()) {
tooltip.add("Squeezes to give: ");
for (final ItemStack prod2 : liquids) {
final NBTTagCompound nbt2 = new NBTTagCompound();
for (ItemStack prod2 : liquids) {
NBTTagCompound nbt2 = new NBTTagCompound();
prod2.writeToNBT(nbt2);
tooltip.add(prod2, prod2.getDisplayName());
}
@@ -176,12 +170,12 @@ public class AnalystPageProducts extends AnalystPageProduce
}
};
item.setTooltip();
final ControlText textWidget = new ControlTextCentered(this, y + 4, "");
textWidget.setColor(this.getColor());
ControlText textWidget = new ControlTextCentered(this, y + 4, "");
textWidget.setColor(getColor());
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));
float time = (int) (PluginApiculture.ticksPerBeeWorkCycle * 100.0 / (speed * value));
textWidget.setValue("Every " + getTimeString(time));
}
@Override
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.Binnie;
@@ -25,41 +21,38 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
public class AnalystPageSoil extends ControlAnalystPage
{
public AnalystPageSoil(final IWidget parent, final IArea area, final IFlower flower) {
public class AnalystPageSoil extends ControlAnalystPage {
public AnalystPageSoil(IWidget parent, IArea area, IFlower flower) {
super(parent, area);
this.setColor(6697728);
final EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture();
final EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture();
final EnumAcidity pH = flower.getGenome().getPrimary().getPH();
final EnumTolerance pHTol = flower.getGenome().getTolerancePH();
setColor(6697728);
EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture();
EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture();
EnumAcidity pH = flower.getGenome().getPrimary().getPH();
EnumTolerance pHTol = flower.getGenome().getTolerancePH();
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Soil").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Soil").setColor(getColor());
y += 16;
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Moisture Tolerance", TextJustification.MiddleCenter).setColor(this.getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Moisture Tolerance", TextJustification.MiddleCenter).setColor(getColor());
y += 12;
this.createMoisture(this, (this.w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
createMoisture(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).setColor(this.getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "pH Tolerance", TextJustification.MiddleCenter).setColor(getColor());
y += 12;
this.createAcidity(this, (this.w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
createAcidity(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).setColor(this.getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Recommended Soil", TextJustification.MiddleCenter).setColor(getColor());
y += 12;
EnumMoisture recomMoisture = EnumMoisture.Normal;
final boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.Normal, moistureTol);
final boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.Damp, moistureTol);
final boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.Dry, moistureTol);
boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.Normal, moistureTol);
boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.Damp, moistureTol);
boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.Dry, moistureTol);
if (canTolNormal) {
if (canTolDamp && !canTolDry) {
recomMoisture = EnumMoisture.Damp;
}
else if (canTolDry && !canTolDamp) {
} else if (canTolDry && !canTolDamp) {
recomMoisture = EnumMoisture.Dry;
}
}
else {
} else {
if (canTolDamp) {
recomMoisture = EnumMoisture.Damp;
}
@@ -68,18 +61,16 @@ public class AnalystPageSoil extends ControlAnalystPage
}
}
EnumAcidity recomPH = EnumAcidity.Neutral;
final boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.Neutral, pHTol);
final boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.Acid, pHTol);
final boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.Alkaline, pHTol);
boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.Neutral, pHTol);
boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.Acid, pHTol);
boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.Alkaline, pHTol);
if (canTolNeutral) {
if (canTolAcid && !canTolAlkaline) {
recomPH = EnumAcidity.Acid;
}
else if (canTolAlkaline && !canTolAcid) {
} else if (canTolAlkaline && !canTolAcid) {
recomPH = EnumAcidity.Alkaline;
}
}
else {
} else {
if (canTolAcid) {
recomPH = EnumAcidity.Acid;
}
@@ -87,55 +78,55 @@ public class AnalystPageSoil extends ControlAnalystPage
recomPH = EnumAcidity.Alkaline;
}
}
final ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture));
final ControlItemDisplay recomSoil = new ControlItemDisplay(this, (this.w() - 24.0f) / 2.0f, y, 24.0f);
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, this.w() - 8.0f, 14.0f), "Other Soils", TextJustification.MiddleCenter).setColor(this.getColor());
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Other Soils", TextJustification.MiddleCenter).setColor(getColor());
y += 12;
final List<ItemStack> stacks = new ArrayList<ItemStack>();
for (final EnumAcidity a : EnumSet.range(EnumAcidity.Acid, EnumAcidity.Alkaline)) {
for (final EnumMoisture b : EnumSet.range(EnumMoisture.Dry, EnumMoisture.Damp)) {
List<ItemStack> stacks = new ArrayList<ItemStack>();
for (EnumAcidity a : EnumSet.range(EnumAcidity.Acid, EnumAcidity.Alkaline)) {
for (EnumMoisture b : EnumSet.range(EnumMoisture.Dry, EnumMoisture.Damp)) {
if (Tolerance.canTolerate(pH, a, pHTol) && Tolerance.canTolerate(moisture, b, moistureTol) && (a != recomPH || b != recomMoisture)) {
stacks.add(new ItemStack(Botany.soil, 1, BlockSoil.getMeta(a, b)));
}
}
}
final float soilListWidth = 17 * stacks.size() - 1;
final float soilListX = (this.w() - soilListWidth) / 2.0f;
float soilListWidth = 17 * stacks.size() - 1;
float soilListX = (w() - soilListWidth) / 2.0f;
int t = 0;
for (final ItemStack soilStack : stacks) {
final ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y);
for (ItemStack soilStack : stacks) {
ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y);
display.setItemStack(soilStack);
display.setTooltip();
}
}
protected void createMoisture(final IWidget parent, final float x, final float y, final float w, final float h, final EnumMoisture value, final EnumTolerance tol) {
protected void createMoisture(IWidget parent, float x, float y, float w, float h, EnumMoisture value, EnumTolerance tol) {
new ControlToleranceBar<EnumMoisture>(parent, x, y, w, h, EnumMoisture.class) {
@Override
protected String getName(final EnumMoisture value) {
protected String getName(EnumMoisture value) {
return Binnie.Language.localise(value);
}
@Override
protected int getColour(final EnumMoisture value) {
return (new int[] { 13434828, 6737151, 3368703 })[value.ordinal()];
protected int getColour(EnumMoisture value) {
return (new int[]{13434828, 6737151, 3368703})[value.ordinal()];
}
}.setValues(value, tol);
}
protected void createAcidity(final IWidget parent, final float x, final float y, final float w, final float h, final EnumAcidity value, final EnumTolerance tol) {
protected void createAcidity(IWidget parent, float x, float y, float w, float h, EnumAcidity value, EnumTolerance tol) {
new ControlToleranceBar<EnumAcidity>(parent, x, y, w, h, EnumAcidity.class) {
@Override
protected String getName(final EnumAcidity value) {
protected String getName(EnumAcidity value) {
return Binnie.Language.localise(value);
}
@Override
protected int getColour(final EnumAcidity value) {
return (new int[] { 16711782, 65280, 26367 })[value.ordinal()];
protected int getColour(EnumAcidity value) {
return (new int[]{16711782, 65280, 26367})[value.ordinal()];
}
}.setValues(value, tol);
}
@@ -1,25 +1,20 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.controls.ControlTextCentered;
import forestry.api.lepidopterology.IButterfly;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.geometry.IArea;
import forestry.api.lepidopterology.IButterfly;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageSpecimen extends ControlAnalystPage
{
public AnalystPageSpecimen(final IWidget parent, final IArea area, final IButterfly ind) {
public class AnalystPageSpecimen extends ControlAnalystPage {
public AnalystPageSpecimen(IWidget parent, IArea area, IButterfly ind) {
super(parent, area);
this.setColor(3355443);
setColor(3355443);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Specimen").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Specimen").setColor(getColor());
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);
float w = (w() - 16.0f) * ind.getSize();
new ControlIndividualDisplay(this, (w() - w) / 2.0f, y + (w() - w) / 2.0f, w, ind);
}
@Override
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.IWidget;
@@ -23,60 +19,58 @@ import net.minecraftforge.common.util.ForgeDirection;
import java.util.Collection;
public class AnalystPageWood extends AnalystPageProduce
{
public AnalystPageWood(final IWidget parent, final IArea area, final ITree ind) {
public class AnalystPageWood extends AnalystPageProduce {
public AnalystPageWood(IWidget parent, IArea area, ITree ind) {
super(parent, area);
this.setColor(6697728);
final ITreeGenome genome = ind.getGenome();
setColor(6697728);
ITreeGenome genome = ind.getGenome();
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Wood").setColor(this.getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Wood").setColor(getColor());
y += 12;
if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) {
new ControlIconDisplay(this, (this.w() - 16.0f) / 2.0f, y, ModuleItem.iconNoFire.getIcon()).addTooltip("Fireproof");
}
else {
new ControlIconDisplay(this, (this.w() - 16.0f) / 2.0f, y, ModuleItem.iconFire.getIcon()).addTooltip("Flammable");
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconNoFire.getIcon()).addTooltip("Fireproof");
} else {
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconFire.getIcon()).addTooltip("Flammable");
}
y += 30;
final Collection<ItemStack> products = new UniqueItemStackSet();
Collection<ItemStack> products = new UniqueItemStackSet();
genome.getPrimary().getGenerator().setLogBlock(genome, FakeWorld.instance, 0, 0, 0, ForgeDirection.UP);
ItemStack stackWood = FakeWorld.instance.getWooLog();
if (stackWood != null) {
products.add(stackWood);
}
// for (final ItemStack stack :
// for (ItemStack stack :
// ind.getGenome().getFruitProvider().getProducts()) {
// products.add(stack);
// }
if (products.size() > 0) {
new ControlTextCentered(this, y, "Logs").setColor(this.getColor());
new ControlTextCentered(this, y, "Logs").setColor(getColor());
y += 10;
final int w = products.size() * 18 - 2;
final int i = 0;
for (final ItemStack stack : products) {
final ControlItemDisplay d = new ControlItemDisplay(this, (this.w() - w) / 2.0f + 18 * i, y);
int w = products.size() * 18 - 2;
int i = 0;
for (ItemStack stack : products) {
ControlItemDisplay d = new ControlItemDisplay(this, (w() - w) / 2.0f + 18 * i, y);
d.setTooltip();
d.setItemStack(stack);
}
y += 26;
}
final Collection<ItemStack> allProducts = new UniqueItemStackSet();
for (final ItemStack stack2 : products) {
Collection<ItemStack> allProducts = new UniqueItemStackSet();
for (ItemStack stack2 : products) {
allProducts.add(stack2);
}
final Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(this.getAllProductsAndFluids(allProducts));
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
if (refinedProducts.size() > 0) {
y = this.getRefined("Refined Products", y, refinedProducts);
y = getRefined("Refined Products", y, refinedProducts);
y += 8;
}
if (products.size() == 0) {
new ControlTextCentered(this, y, "This tree has no \nfruits or nuts").setColor(this.getColor());
new ControlTextCentered(this, y, "This tree has no \nfruits or nuts").setColor(getColor());
y += 28;
}
this.setSize(new IPoint(this.w(), y + 8));
setSize(new IPoint(w(), y + 8));
}
@Override
@@ -1,27 +1,22 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.genetics.BreedingSystem;
import binnie.Binnie;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.texture.BinnieCoreTexture;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.resource.Texture;
import forestry.api.genetics.ISpeciesRoot;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IAllele;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.genetics.BreedingSystem;
import binnie.core.texture.BinnieCoreTexture;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
public class ControlAnalystChromosome extends Control implements ITooltip
{
public class ControlAnalystChromosome extends Control implements ITooltip {
IAllele allele0;
IAllele allele1;
IChromosomeType chromosomeType;
@@ -29,37 +24,36 @@ public class ControlAnalystChromosome extends Control implements ITooltip
Texture Homozygous;
Texture Heterozygous;
public ControlAnalystChromosome(final IWidget parent, final float x, final float y, final ISpeciesRoot root, final IChromosomeType type, final IAllele allele0, final IAllele allele1) {
public ControlAnalystChromosome(IWidget parent, float x, float y, ISpeciesRoot root, IChromosomeType type, IAllele allele0, IAllele allele1) {
super(parent, x, y, 16.0f, 22.0f);
this.Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
this.Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
this.addAttribute(WidgetAttribute.MouseOver);
Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
addAttribute(WidgetAttribute.MouseOver);
this.root = root;
this.chromosomeType = type;
chromosomeType = type;
this.allele0 = allele0;
this.allele1 = allele1;
}
public boolean isHomozygous() {
return this.allele0.getUID().equals(this.allele1.getUID());
return allele0.getUID().equals(allele1.getUID());
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
CraftGUI.Render.texture(this.isHomozygous() ? this.Homozygous : this.Heterozygous, IPoint.ZERO);
CraftGUI.Render.texture(isHomozygous() ? Homozygous : Heterozygous, IPoint.ZERO);
}
@Override
public void getTooltip(final Tooltip tooltip) {
final BreedingSystem system = Binnie.Genetics.getSystem(this.root);
tooltip.add(system.getChromosomeName(this.chromosomeType));
if (this.isHomozygous()) {
tooltip.add(system.getAlleleName(this.chromosomeType, this.allele0));
}
else {
tooltip.add("Active: " + system.getAlleleName(this.chromosomeType, this.allele0));
tooltip.add("Inactive: " + system.getAlleleName(this.chromosomeType, this.allele1));
public void getTooltip(Tooltip tooltip) {
BreedingSystem system = Binnie.Genetics.getSystem(root);
tooltip.add(system.getChromosomeName(chromosomeType));
if (isHomozygous()) {
tooltip.add(system.getAlleleName(chromosomeType, allele0));
} else {
tooltip.add("Active: " + system.getAlleleName(chromosomeType, allele0));
tooltip.add("Inactive: " + system.getAlleleName(chromosomeType, allele1));
}
}
}
@@ -1,19 +1,15 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import java.text.DecimalFormat;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.geometry.IArea;
public abstract class ControlAnalystPage extends Control
{
public ControlAnalystPage(final IWidget parent, final IArea area) {
import java.text.DecimalFormat;
public abstract class ControlAnalystPage extends Control {
public ControlAnalystPage(IWidget parent, IArea area) {
super(parent, area);
this.hide();
hide();
}
@Override
@@ -22,11 +18,11 @@ public abstract class ControlAnalystPage extends Control
public abstract String getTitle();
protected String getTimeString(final float time) {
final float seconds = time / 20.0f;
final float minutes = seconds / 60.0f;
final float hours = minutes / 60.0f;
final DecimalFormat df = new DecimalFormat("#.0");
protected String getTimeString(float time) {
float seconds = time / 20.0f;
float minutes = seconds / 60.0f;
float hours = minutes / 60.0f;
DecimalFormat df = new DecimalFormat("#.0");
if (hours > 1.0f) {
return df.format(hours) + " hours";
}
@@ -1,76 +1,71 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.Tooltip;
import net.minecraft.util.IIcon;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import forestry.core.render.TextureManager;
import net.minecraftforge.common.BiomeDictionary;
import binnie.core.craftgui.IWidget;
import net.minecraft.world.biome.BiomeGenBase;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.geometry.IPoint;
import forestry.core.render.TextureManager;
import net.minecraft.util.IIcon;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
public class ControlBiome extends Control implements ITooltip
{
public class ControlBiome extends Control implements ITooltip {
BiomeGenBase biome;
String iconCategory;
public ControlBiome(final IWidget parent, final float x, final float y, final float w, final float h, final BiomeGenBase biome) {
public ControlBiome(IWidget parent, float x, float y, float w, float h, BiomeGenBase biome) {
super(parent, x, y, w, h);
this.biome = null;
this.iconCategory = "plains";
iconCategory = "plains";
this.biome = biome;
}
@Override
public void onRenderBackground() {
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.MOUNTAIN)) {
this.iconCategory = "hills";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MOUNTAIN)) {
iconCategory = "hills";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.HILLS)) {
this.iconCategory = "hills";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.HILLS)) {
iconCategory = "hills";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.SANDY)) {
this.iconCategory = "desert";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)) {
iconCategory = "desert";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.SNOWY)) {
this.iconCategory = "snow";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
iconCategory = "snow";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.FOREST)) {
this.iconCategory = "forest";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
iconCategory = "forest";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.SWAMP)) {
this.iconCategory = "swamp";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SWAMP)) {
iconCategory = "swamp";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.JUNGLE)) {
this.iconCategory = "jungle";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.JUNGLE)) {
iconCategory = "jungle";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.COLD) && BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.FOREST)) {
this.iconCategory = "taiga";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.COLD) && BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
iconCategory = "taiga";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.MUSHROOM)) {
this.iconCategory = "mushroom";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) {
iconCategory = "mushroom";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.OCEAN)) {
this.iconCategory = "ocean";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.OCEAN)) {
iconCategory = "ocean";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.NETHER)) {
this.iconCategory = "nether";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) {
iconCategory = "nether";
}
if (BiomeDictionary.isBiomeOfType(this.biome, BiomeDictionary.Type.END)) {
this.iconCategory = "end";
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END)) {
iconCategory = "end";
}
final IIcon icon = TextureManager.getInstance().getDefault("habitats/" + this.iconCategory);
IIcon icon = TextureManager.getInstance().getDefault("habitats/" + iconCategory);
CraftGUI.Render.iconItem(IPoint.ZERO, icon);
}
@Override
public void getTooltip(final Tooltip tooltip) {
tooltip.add(this.biome.biomeName.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"));
public void getTooltip(Tooltip tooltip) {
tooltip.add(biome.biomeName.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"));
}
}
@@ -1,47 +1,42 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.Binnie;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.events.EventValueChanged;
import binnie.core.craftgui.events.EventWidget;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.extrabees.core.ExtraBeeTexture;
import forestry.api.genetics.IChromosomeType;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.controls.core.Control;
public class ControlChromoPicker extends Control implements ITooltip
{
public class ControlChromoPicker extends Control implements ITooltip {
Texture Selected;
Texture Texture;
IChromosomeType type;
ControlChromosome parent;
public ControlChromoPicker(final ControlChromosome parent, final float x, final float y, final IChromosomeType chromo) {
public ControlChromoPicker(ControlChromosome parent, float x, float y, IChromosomeType chromo) {
super(parent, x, y, 16.0f, 16.0f);
this.Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett);
this.Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett);
this.type = chromo;
this.addAttribute(WidgetAttribute.MouseOver);
Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett);
Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett);
type = chromo;
addAttribute(WidgetAttribute.MouseOver);
this.parent = parent;
this.addSelfEventHandler(new EventWidget.StartMouseOver.Handler() {
addSelfEventHandler(new EventWidget.StartMouseOver.Handler() {
@Override
public void onEvent(final EventWidget.StartMouseOver event) {
ControlChromoPicker.this.callEvent(new EventValueChanged<Object>(ControlChromoPicker.this.getWidget(), ControlChromoPicker.this.type));
public void onEvent(EventWidget.StartMouseOver event) {
callEvent(new EventValueChanged<Object>(getWidget(), type));
}
});
this.addSelfEventHandler(new EventWidget.EndMouseOver.Handler() {
addSelfEventHandler(new EventWidget.EndMouseOver.Handler() {
@Override
public void onEvent(final EventWidget.EndMouseOver event) {
ControlChromoPicker.this.callEvent(new EventValueChanged<Object>(ControlChromoPicker.this.getWidget(), null));
public void onEvent(EventWidget.EndMouseOver event) {
callEvent(new EventValueChanged<>(getWidget(), null));
}
});
}
@@ -49,13 +44,13 @@ public class ControlChromoPicker extends Control implements ITooltip
@Override
public void onRenderBackground() {
super.onRenderBackground();
final boolean selected = this.isMouseOver();
final Texture text = selected ? this.Selected : this.Texture;
boolean selected = isMouseOver();
Texture text = selected ? Selected : Texture;
CraftGUI.Render.texture(text, IPoint.ZERO);
}
@Override
public void getTooltip(final Tooltip tooltip) {
tooltip.add(Binnie.Genetics.getSystem(this.parent.getRoot()).getChromosomeName(this.type));
public void getTooltip(Tooltip tooltip) {
tooltip.add(Binnie.Genetics.getSystem(parent.getRoot()).getChromosomeName(type));
}
}
@@ -1,27 +1,22 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.CraftGUI;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import binnie.botany.api.EnumFlowerChromosome;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.apiculture.EnumBeeChromosome;
import binnie.Binnie;
import binnie.botany.api.EnumFlowerChromosome;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.controls.core.IControlValue;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.resource.Texture;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.core.texture.BinnieCoreTexture;
import binnie.core.craftgui.IWidget;
import forestry.api.genetics.ISpeciesRoot;
import binnie.core.craftgui.resource.Texture;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.genetics.IChromosomeType;
import binnie.core.craftgui.controls.core.IControlValue;
import binnie.core.craftgui.controls.core.Control;
import forestry.api.genetics.ISpeciesRoot;
import forestry.api.lepidopterology.EnumButterflyChromosome;
public class ControlChromosome extends Control implements IControlValue<IChromosomeType>
{
public class ControlChromosome extends Control implements IControlValue<IChromosomeType> {
Texture BeeTexture;
Texture TreeTexture;
Texture MothTexture;
@@ -29,24 +24,24 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
IChromosomeType chromo;
ISpeciesRoot species;
public ControlChromosome(final IWidget parent, final float x, final float y) {
public ControlChromosome(IWidget parent, float x, float y) {
super(parent, x, y, 96.0f, 96.0f);
this.BeeTexture = new StandardTexture(0, 0, 96, 96, BinnieCoreTexture.GUIBreeding);
this.TreeTexture = new StandardTexture(96, 0, 96, 96, BinnieCoreTexture.GUIBreeding);
this.MothTexture = new StandardTexture(96, 96, 96, 96, BinnieCoreTexture.GUIBreeding);
this.FlowerTexture = new StandardTexture(0, 96, 96, 96, BinnieCoreTexture.GUIBreeding);
this.chromo = null;
this.species = null;
BeeTexture = new StandardTexture(0, 0, 96, 96, BinnieCoreTexture.GUIBreeding);
TreeTexture = new StandardTexture(96, 0, 96, 96, BinnieCoreTexture.GUIBreeding);
MothTexture = new StandardTexture(96, 96, 96, 96, BinnieCoreTexture.GUIBreeding);
FlowerTexture = new StandardTexture(0, 96, 96, 96, BinnieCoreTexture.GUIBreeding);
chromo = null;
species = null;
}
public ISpeciesRoot getRoot() {
return this.species;
return species;
}
public void setRoot(final ISpeciesRoot root) {
if (root != this.species) {
this.species = root;
this.deleteAllChildren();
public void setRoot(ISpeciesRoot root) {
if (root != species) {
species = root;
deleteAllChildren();
if (root == Binnie.Genetics.getBeeRoot()) {
new ControlChromoPicker(this, 28.0f, 47.0f, EnumBeeChromosome.SPECIES);
new ControlChromoPicker(this, 28.0f, 72.0f, EnumBeeChromosome.SPEED);
@@ -61,8 +56,7 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
new ControlChromoPicker(this, 83.0f, 27.0f, EnumBeeChromosome.FLOWERING);
new ControlChromoPicker(this, 71.0f, 10.0f, EnumBeeChromosome.TERRITORY);
new ControlChromoPicker(this, 84.0f, 54.0f, EnumBeeChromosome.EFFECT);
}
else if (root == Binnie.Genetics.getTreeRoot()) {
} else if (root == Binnie.Genetics.getTreeRoot()) {
new ControlChromoPicker(this, 48.0f, 48.0f, EnumTreeChromosome.SPECIES);
new ControlChromoPicker(this, 43.0f, 12.0f, EnumTreeChromosome.GROWTH);
new ControlChromoPicker(this, 43.0f, 84.0f, EnumTreeChromosome.HEIGHT);
@@ -76,8 +70,7 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
new ControlChromoPicker(this, 70.0f, 34.0f, EnumTreeChromosome.MATURATION);
new ControlChromoPicker(this, 45.0f, 67.0f, EnumTreeChromosome.GIRTH);
new ControlChromoPicker(this, 5.0f, 70.0f, EnumTreeChromosome.FIREPROOF);
}
else if (root == Binnie.Genetics.getFlowerRoot()) {
} else if (root == Binnie.Genetics.getFlowerRoot()) {
new ControlChromoPicker(this, 35.0f, 81.0f, EnumFlowerChromosome.SPECIES);
new ControlChromoPicker(this, 36.0f, 28.0f, EnumFlowerChromosome.PRIMARY);
new ControlChromoPicker(this, 27.0f, 13.0f, EnumFlowerChromosome.SECONDARY);
@@ -90,8 +83,7 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
new ControlChromoPicker(this, 54.0f, 80.0f, EnumFlowerChromosome.PH_TOLERANCE);
new ControlChromoPicker(this, 41.0f, 42.0f, EnumFlowerChromosome.SAPPINESS);
new ControlChromoPicker(this, 37.0f, 63.0f, EnumFlowerChromosome.STEM);
}
else if (root == Binnie.Genetics.getButterflyRoot()) {
} else if (root == Binnie.Genetics.getButterflyRoot()) {
new ControlChromoPicker(this, 40.0f, 40.0f, EnumButterflyChromosome.SPECIES);
new ControlChromoPicker(this, 63.0f, 32.0f, EnumButterflyChromosome.SIZE);
new ControlChromoPicker(this, 32.0f, 63.0f, EnumButterflyChromosome.SPEED);
@@ -112,36 +104,36 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
@Override
public IChromosomeType getValue() {
return this.chromo;
return chromo;
}
@Override
public void setValue(final IChromosomeType value) {
this.chromo = value;
public void setValue(IChromosomeType value) {
chromo = value;
}
@Override
public void onRenderBackground() {
if (this.species == null) {
if (species == null) {
return;
}
super.onRenderBackground();
final Texture text = this.getTypeTexture();
Texture text = getTypeTexture();
CraftGUI.Render.texture(text, IPoint.ZERO);
}
private Texture getTypeTexture() {
if (this.species == Binnie.Genetics.getBeeRoot()) {
return this.BeeTexture;
if (species == Binnie.Genetics.getBeeRoot()) {
return BeeTexture;
}
if (this.species == Binnie.Genetics.getTreeRoot()) {
return this.TreeTexture;
if (species == Binnie.Genetics.getTreeRoot()) {
return TreeTexture;
}
if (this.species == Binnie.Genetics.getButterflyRoot()) {
return this.MothTexture;
if (species == Binnie.Genetics.getButterflyRoot()) {
return MothTexture;
}
if (this.species == Binnie.Genetics.getFlowerRoot()) {
return this.FlowerTexture;
if (species == Binnie.Genetics.getFlowerRoot()) {
return FlowerTexture;
}
return null;
}
@@ -1,36 +1,31 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.controls.listbox.ControlList;
import binnie.core.genetics.Gene;
import binnie.core.craftgui.controls.listbox.ControlOption;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.genetics.Gene;
public class ControlGenesisOption extends ControlOption<Gene>
{
public ControlGenesisOption(final ControlList<Gene> parent, final Gene gene, final int y) {
public class ControlGenesisOption extends ControlOption<Gene> {
public ControlGenesisOption(ControlList<Gene> parent, Gene gene, int y) {
super(parent, gene, y);
}
String getAlleleName() {
return this.getValue().getAlleleName();
return getValue().getAlleleName();
}
String getChromosomeName() {
return this.getValue().getShortChromosomeName();
return getValue().getShortChromosomeName();
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
CraftGUI.Render.text(new IArea(0.0f, 0.0f, 70.0f, 22.0f), TextJustification.MiddleCenter, this.getChromosomeName(), this.getColor());
CraftGUI.Render.text(new IArea(75.0f, 0.0f, 80.0f, 22.0f), TextJustification.MiddleCenter, this.getAlleleName(), this.getColor());
CraftGUI.Render.solid(new IArea(70.0f, 2.0f, 1.0f, 16.0f), -16777216 + this.getColor());
CraftGUI.Render.text(new IArea(0.0f, 0.0f, 70.0f, 22.0f), TextJustification.MiddleCenter, getChromosomeName(), getColor());
CraftGUI.Render.text(new IArea(75.0f, 0.0f, 80.0f, 22.0f), TextJustification.MiddleCenter, getAlleleName(), getColor());
CraftGUI.Render.solid(new IArea(70.0f, 2.0f, 1.0f, 16.0f), 0xff000000 + getColor());
}
}
@@ -1,39 +1,34 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import net.minecraft.item.ItemStack;
import forestry.api.genetics.AlleleManager;
import binnie.core.craftgui.Tooltip;
import binnie.core.genetics.BreedingSystem;
import binnie.Binnie;
import forestry.api.genetics.IIndividual;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.genetics.BreedingSystem;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IIndividual;
import net.minecraft.item.ItemStack;
public class ControlIndividualDisplay extends ControlItemDisplay implements ITooltip
{
public ControlIndividualDisplay(final IWidget parent, final float x, final float y, final IIndividual ind) {
public class ControlIndividualDisplay extends ControlItemDisplay implements ITooltip {
public ControlIndividualDisplay(IWidget parent, float x, float y, IIndividual ind) {
this(parent, x, y, 16.0f, ind);
}
public ControlIndividualDisplay(final IWidget parent, final float x, final float y, final float size, final IIndividual ind) {
public ControlIndividualDisplay(IWidget parent, float x, float y, float size, IIndividual ind) {
super(parent, x, y, size);
final BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
this.setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()));
this.setTooltip();
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()));
setTooltip();
}
@Override
public void getTooltip(final Tooltip tooltip) {
final ItemStack stack = this.getItemStack();
public void getTooltip(Tooltip tooltip) {
ItemStack stack = getItemStack();
if (stack == null) {
return;
}
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
if (ind == null) {
return;
}
@@ -1,7 +1,3 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.CraftGUI;
@@ -19,62 +15,61 @@ import net.minecraft.util.EnumChatFormatting;
import java.util.EnumSet;
public abstract class ControlToleranceBar<T extends Enum<T>> extends Control implements ITooltip
{
private Class<T> enumClass;
public abstract class ControlToleranceBar<T extends Enum<T>> extends Control implements ITooltip {
EnumSet<T> tolerated;
EnumSet<T> fullSet;
private Class<T> enumClass;
public ControlToleranceBar(final IWidget parent, final float x, final float y, final float width, final float height, final Class<T> clss) {
public ControlToleranceBar(IWidget parent, float x, float y, float width, float height, Class<T> clss) {
super(parent, x, y, width, height);
this.addAttribute(WidgetAttribute.MouseOver);
this.enumClass = clss;
this.tolerated = EnumSet.noneOf(this.enumClass);
this.fullSet = EnumSet.allOf(this.enumClass);
if (this.enumClass == EnumTemperature.class) {
this.fullSet.remove(EnumTemperature.NONE);
addAttribute(WidgetAttribute.MouseOver);
enumClass = clss;
tolerated = EnumSet.noneOf(enumClass);
fullSet = EnumSet.allOf(enumClass);
if (enumClass == EnumTemperature.class) {
fullSet.remove(EnumTemperature.NONE);
}
}
@Override
public void getTooltip(final Tooltip tooltip) {
final int types = this.fullSet.size();
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) {
tooltip.add((this.tolerated.contains(tol) ? "" : EnumChatFormatting.DARK_GRAY) + this.getName(tol));
public void getTooltip(Tooltip tooltip) {
int types = fullSet.size();
int type = (int) ((int) getRelativeMousePosition().x() / (getSize().x() / types));
for (T tol : fullSet) {
if (tol.ordinal() - ((enumClass == EnumTemperature.class) ? 1 : 0) == type) {
tooltip.add((tolerated.contains(tol) ? "" : EnumChatFormatting.DARK_GRAY) + getName(tol));
}
}
}
protected abstract String getName(final T p0);
protected abstract String getName(T p0);
protected abstract int getColour(final T p0);
protected abstract int getColour(T p0);
@Override
public void onRenderBackground() {
CraftGUI.Render.gradientRect(this.getArea(), -1431655766, -1431655766);
final float w = this.getArea().w() / this.fullSet.size();
CraftGUI.Render.gradientRect(getArea(), -1431655766, -1431655766);
float w = getArea().w() / fullSet.size();
int t = 0;
for (final T value : this.fullSet) {
final int col = (this.tolerated.contains(value) ? -16777216 : 855638016) + this.getColour(value);
final IBorder inset = new IBorder(this.tolerated.contains(value) ? 1.0f : 3.0f);
CraftGUI.Render.gradientRect(new IArea(w * t, 0.0f, w, this.h()).inset(inset), col, col);
for (T value : fullSet) {
int col = (tolerated.contains(value) ? -16777216 : 855638016) + getColour(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;
}
}
public void setValues(final T value, final EnumTolerance enumTol) {
this.tolerated.clear();
final Tolerance tol = Tolerance.get(enumTol);
for (final T full : this.fullSet) {
public void setValues(T value, EnumTolerance enumTol) {
tolerated.clear();
Tolerance tol = Tolerance.get(enumTol);
for (T full : fullSet) {
if (full.ordinal() > value.ordinal() + tol.getBounds()[1]) {
continue;
}
if (full.ordinal() < value.ordinal() + tol.getBounds()[0]) {
continue;
}
this.tolerated.add(full);
tolerated.add(full);
}
}
}
@@ -1,21 +1,17 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.controls.core.Control;
public class ControlTooltip extends Control implements ITooltip
{
public ControlTooltip(final IWidget parent, final float x, final float y, final float w, final float h) {
public class ControlTooltip extends Control implements ITooltip {
public ControlTooltip(IWidget parent, float x, float y, float w, float h) {
super(parent, x, y, w, h);
}
@Override
public void getTooltip(final Tooltip tooltip) {
public void getTooltip(Tooltip tooltip) {
// ignored
}
}
@@ -1,84 +1,81 @@
//
// Decompiled by Procyon v0.5.30
//
package binnie.genetics.gui;
import forestry.api.genetics.AlleleManager;
import forestry.api.lepidopterology.IButterfly;
import binnie.botany.api.IFlower;
import forestry.api.apiculture.IBee;
import forestry.api.arboriculture.ITree;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.events.EventKey;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.controls.scroll.ControlScrollBar;
import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.events.EventMouse;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.Widget;
import forestry.api.genetics.IBreedingTracker;
import binnie.Binnie;
import binnie.genetics.machine.ModuleMachine;
import binnie.genetics.item.GeneticsItems;
import binnie.genetics.machine.Analyser;
import net.minecraft.item.ItemStack;
import binnie.botany.api.IFlower;
import binnie.core.AbstractMod;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.Widget;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.controls.scroll.ControlScrollBar;
import binnie.core.craftgui.controls.scroll.ControlScrollableContent;
import binnie.core.craftgui.events.EventKey;
import binnie.core.craftgui.events.EventMouse;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.IPoint;
import binnie.core.craftgui.geometry.Position;
import binnie.core.craftgui.minecraft.InventoryType;
import binnie.core.craftgui.minecraft.MinecraftGUI;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlide;
import binnie.core.craftgui.minecraft.control.ControlSlot;
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.genetics.Genetics;
import binnie.core.AbstractMod;
import java.util.ArrayList;
import binnie.genetics.item.GeneticsItems;
import binnie.genetics.machine.Analyser;
import binnie.genetics.machine.ModuleMachine;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.inventory.IInventory;
import net.minecraft.entity.player.EntityPlayer;
import binnie.core.genetics.BreedingSystem;
import forestry.api.apiculture.IBee;
import forestry.api.arboriculture.ITree;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IIndividual;
import binnie.core.craftgui.minecraft.control.ControlSlide;
import binnie.core.craftgui.geometry.IArea;
import java.util.List;
import binnie.core.craftgui.window.Panel;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.controls.scroll.ControlScrollableContent;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.minecraft.Window;
import forestry.api.lepidopterology.IButterfly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.List;
public class WindowAnalyst extends Window {
protected IWidget baseWidget;
protected ControlScrollableContent leftPage;
protected ControlScrollableContent rightPage;
protected Control tabBar;
protected Panel analystPanel;
protected List<ControlAnalystPage> analystPages;
protected IArea analystPageSize;
protected boolean isDatabase;
protected boolean isMaster;
protected boolean lockedSearch;
protected IIndividual current;
protected BreedingSystem currentSystem;
public class WindowAnalyst extends Window
{
IWidget baseWidget;
ControlScrollableContent leftPage;
ControlScrollableContent rightPage;
Control tabBar;
Panel analystPanel;
List<ControlAnalystPage> analystPages;
IArea analystPageSize;
boolean isDatabase;
boolean isMaster;
boolean lockedSearch;
private Control analystNone;
private ControlSlide slideUpInv;
IIndividual current;
BreedingSystem currentSystem;
public WindowAnalyst(final EntityPlayer player, final IInventory inventory, final Side side, final boolean database, final boolean master) {
public WindowAnalyst(EntityPlayer player, IInventory inventory, Side side, boolean database, boolean master) {
super(312.0f, 230.0f, player, inventory, side);
this.baseWidget = null;
this.tabBar = null;
this.analystPages = new ArrayList<ControlAnalystPage>();
this.analystPageSize = null;
this.isDatabase = false;
this.isMaster = false;
this.lockedSearch = false;
this.current = null;
this.currentSystem = null;
this.isDatabase = database;
this.isMaster = master;
this.lockedSearch = this.isDatabase;
baseWidget = null;
tabBar = null;
analystPages = new ArrayList<>();
analystPageSize = null;
isDatabase = false;
isMaster = false;
lockedSearch = false;
current = null;
currentSystem = null;
isDatabase = database;
isMaster = master;
lockedSearch = isDatabase;
}
@Override
@@ -92,158 +89,157 @@ public class WindowAnalyst extends Window
}
private void setupValidators() {
if (!this.isDatabase) {
this.getWindowInventory().setValidator(0, new SlotValidator.Individual() {
if (!isDatabase) {
getWindowInventory().setValidator(0, new SlotValidator.Individual() {
@Override
public boolean isValid(final ItemStack itemStack) {
return Analyser.isAnalysed(itemStack) || (Analyser.isAnalysable(itemStack) && WindowAnalyst.this.getWindowInventory().getStackInSlot(1) != null);
public boolean isValid(ItemStack itemStack) {
return Analyser.isAnalysed(itemStack) || (Analyser.isAnalysable(itemStack) && getWindowInventory().getStackInSlot(1) != null);
}
});
this.getWindowInventory().setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.IconDye));
getWindowInventory().setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.IconDye));
}
}
@Override
public void initialiseServer() {
for (final BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
final IBreedingTracker tracker = system.getSpeciesRoot().getBreedingTracker(this.getWorld(), this.getUsername());
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
IBreedingTracker tracker = system.getSpeciesRoot().getBreedingTracker(getWorld(), getUsername());
if (tracker != null) {
tracker.synchToPlayer(this.getPlayer());
tracker.synchToPlayer(getPlayer());
}
}
this.setupValidators();
setupValidators();
}
@Override
public void initialiseClient() {
this.setTitle(this.isDatabase ? (this.isMaster ? "Master Registry" : "Registry") : "Analyst");
final BreedingSystem system = Binnie.Genetics.beeBreedingSystem;
final IIndividual ind = system.getDefaultIndividual();
final ItemStack stack = system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType());
this.getWindowInventory().createSlot(0);
this.baseWidget = new Widget(this);
setTitle(isDatabase ? (isMaster ? "Master Registry" : "Registry") : "Analyst");
BreedingSystem system = Binnie.Genetics.beeBreedingSystem;
IIndividual ind = system.getDefaultIndividual();
ItemStack stack = system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType());
getWindowInventory().createSlot(0);
baseWidget = new Widget(this);
int x = 16;
final int y = 28;
if (this.isDatabase) {
for (final BreedingSystem syst : Binnie.Genetics.getActiveSystems()) {
int y = 28;
if (isDatabase) {
for (BreedingSystem syst : Binnie.Genetics.getActiveSystems()) {
new Control(this, x, y, 20.0f, 20.0f) {
@Override
public void initialise() {
this.addAttribute(WidgetAttribute.MouseOver);
this.addSelfEventHandler(new EventMouse.Down.Handler() {
addAttribute(WidgetAttribute.MouseOver);
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
WindowAnalyst.this.setSystem(syst);
public void onEvent(EventMouse.Down event) {
setSystem(syst);
}
});
}
@Override
public void getTooltip(final Tooltip tooltip) {
public void getTooltip(Tooltip tooltip) {
tooltip.add(syst.getName());
}
@Override
public void onRenderBackground() {
CraftGUI.Render.colour(syst.getColour());
final int outset = (WindowAnalyst.this.getSystem() == syst) ? 1 : 0;
CraftGUI.Render.texture(CraftGUITexture.TabOutline, this.getArea().outset(outset));
if (WindowAnalyst.this.getSystem() == syst) {
int outset = (getSystem() == syst) ? 1 : 0;
CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea().outset(outset));
if (getSystem() == syst) {
CraftGUI.Render.colour(1140850688 + syst.getColour());
CraftGUI.Render.texture(CraftGUITexture.TabSolid, this.getArea().outset(outset));
CraftGUI.Render.texture(CraftGUITexture.TabSolid, getArea().outset(outset));
}
CraftGUI.Render.item(new IPoint(2.0f, 2.0f), syst.getItemStackRepresentative());
}
};
x += 22;
}
}
else {
} else {
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 0);
x += 22;
new ControlSlot(this, x, y + 1).assign(InventoryType.Window, 1);
x += 26;
this.setupValidators();
setupValidators();
}
this.tabBar = new Control(this, x, 28.0f, this.w() - 16.0f - x, 20.0f);
this.analystPanel = new Panel(this, 16.0f, 54.0f, 280.0f, 164.0f, MinecraftGUI.PanelType.Outline) {
tabBar = new Control(this, x, 28.0f, w() - 16.0f - x, 20.0f);
analystPanel = new Panel(this, 16.0f, 54.0f, 280.0f, 164.0f, MinecraftGUI.PanelType.Outline) {
@Override
public void onRenderBackground() {
CraftGUI.Render.gradientRect(this.getArea(), 1157627903, 1728053247);
CraftGUI.Render.gradientRect(getArea(), 0x44ffffff, 0x66ffffff);
super.onRenderBackground();
}
@Override
public void initialise() {
this.setColor(4473924);
final float sectionWidth = (this.w() - 8.0f - 4.0f) / 2.0f;
WindowAnalyst.this.leftPage = new ControlScrollableContent<IWidget>(this, 3.0f, 3.0f, sectionWidth + 2.0f, this.h() - 8.0f + 2.0f, 0.0f) {
setColor(0x444444);
float sectionWidth = (w() - 8.0f - 4.0f) / 2.0f;
leftPage = new ControlScrollableContent<IWidget>(this, 3.0f, 3.0f, sectionWidth + 2.0f, h() - 8.0f + 2.0f, 0.0f) {
@Override
public void onRenderBackground() {
if (this.getContent() == null) {
if (getContent() == null) {
return;
}
CraftGUI.Render.colour(this.getContent().getColor());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, this.getArea());
CraftGUI.Render.colour(getContent().getColor());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea());
}
};
new ControlScrollBar(this, sectionWidth + 2.0f - 3.0f, 6.0f, 3.0f, this.h() - 8.0f + 2.0f - 6.0f, WindowAnalyst.this.leftPage) {
new ControlScrollBar(this, sectionWidth + 2.0f - 3.0f, 6.0f, 3.0f, h() - 8.0f + 2.0f - 6.0f, leftPage) {
@Override
public void onRenderBackground() {
if (!this.isEnabled()) {
if (!isEnabled()) {
return;
}
if (WindowAnalyst.this.leftPage.getContent() == null) {
if (leftPage.getContent() == null) {
return;
}
CraftGUI.Render.gradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColor(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColor());
CraftGUI.Render.solid(this.getRenderArea(), WindowAnalyst.this.leftPage.getContent().getColor());
CraftGUI.Render.gradientRect(getArea(), 1140850688 + leftPage.getContent().getColor(), 0x44000000 + leftPage.getContent().getColor());
CraftGUI.Render.solid(getRenderArea(), leftPage.getContent().getColor());
}
};
WindowAnalyst.this.rightPage = new ControlScrollableContent<IWidget>(this, 3.0f + sectionWidth + 4.0f, 3.0f, sectionWidth + 2.0f, this.h() - 8.0f + 2.0f, 0.0f) {
rightPage = new ControlScrollableContent<IWidget>(this, 3.0f + sectionWidth + 4.0f, 3.0f, sectionWidth + 2.0f, h() - 8.0f + 2.0f, 0.0f) {
@Override
public void onRenderBackground() {
if (this.getContent() == null) {
if (getContent() == null) {
return;
}
CraftGUI.Render.colour(this.getContent().getColor());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, this.getArea());
CraftGUI.Render.colour(getContent().getColor());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea());
}
};
new ControlScrollBar(this, sectionWidth + 2.0f - 3.0f + sectionWidth + 4.0f, 6.0f, 3.0f, this.h() - 8.0f + 2.0f - 6.0f, WindowAnalyst.this.rightPage) {
new ControlScrollBar(this, sectionWidth + 2.0f - 3.0f + sectionWidth + 4.0f, 6.0f, 3.0f, h() - 8.0f + 2.0f - 6.0f, rightPage) {
@Override
public void onRenderBackground() {
if (!this.isEnabled()) {
if (!isEnabled()) {
return;
}
if (WindowAnalyst.this.rightPage.getContent() == null) {
if (rightPage.getContent() == null) {
return;
}
CraftGUI.Render.gradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColor(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColor());
CraftGUI.Render.solid(this.getRenderArea(), WindowAnalyst.this.rightPage.getContent().getColor());
CraftGUI.Render.gradientRect(getArea(), 1140850688 + rightPage.getContent().getColor(), 0x44000000 + rightPage.getContent().getColor());
CraftGUI.Render.solid(getRenderArea(), rightPage.getContent().getColor());
}
};
WindowAnalyst.this.analystPageSize = new IArea(1.0f, 1.0f, sectionWidth, this.h() - 8.0f);
analystPageSize = new IArea(1.0f, 1.0f, sectionWidth, h() - 8.0f);
}
};
if (!this.isDatabase) {
this.slideUpInv = new ControlSlide(this, (this.getSize().x() - 244.0f) / 2.0f, this.getSize().y() - 80.0f + 1.0f, 244.0f, 80.0f, Position.Bottom);
new ControlPlayerInventory(this.slideUpInv, true);
this.slideUpInv.setSlide(false);
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);
slideUpInv.setSlide(false);
}
this.addEventHandler(new EventKey.Down.Handler() {
addEventHandler(new EventKey.Down.Handler() {
@Override
public void onEvent(final EventKey.Down event) {
public void onEvent(EventKey.Down event) {
if (event.getKey() == 205) {
WindowAnalyst.this.shiftPages(true);
shiftPages(true);
}
if (event.getKey() == 203) {
WindowAnalyst.this.shiftPages(false);
shiftPages(false);
}
}
});
if (!this.isDatabase) {
this.analystNone = new Control(this.analystPanel, 0.0f, 0.0f, this.analystPanel.w(), this.analystPanel.h()) {
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);
@@ -251,130 +247,94 @@ public class WindowAnalyst extends Window
}
};
}
this.setIndividual(null);
this.setSystem(Binnie.Genetics.beeBreedingSystem);
setIndividual(null);
setSystem(Binnie.Genetics.beeBreedingSystem);
}
public void setIndividual(final IIndividual ind) {
if (!this.isDatabase) {
if (ind == null) {
this.analystNone.show();
this.slideUpInv.hide();
}
else {
this.analystNone.hide();
this.slideUpInv.show();
}
}
if (ind == this.current || (ind != null && this.current != null && ind.isGeneticEqual(this.current))) {
return;
}
final boolean systemChange = (this.current = ind) != null && ind.getGenome().getSpeciesRoot() != this.getSystem().getSpeciesRoot();
if (systemChange) {
this.currentSystem = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
}
this.updatePages(systemChange);
}
public void setSystem(final BreedingSystem system) {
if (system == this.currentSystem) {
return;
}
this.currentSystem = system;
this.current = null;
this.updatePages(true);
}
public void updatePages(final boolean systemChange) {
public void updatePages(boolean systemChange) {
int oldLeft = -1;
int oldRight = -1;
if (!systemChange) {
oldLeft = this.analystPages.indexOf(this.leftPage.getContent());
oldRight = this.analystPages.indexOf(this.rightPage.getContent());
oldLeft = analystPages.indexOf(leftPage.getContent());
oldRight = analystPages.indexOf(rightPage.getContent());
}
ControlAnalystPage databasePage = null;
if (this.isDatabase && !systemChange) {
databasePage = ((this.analystPages.size() > 0) ? this.analystPages.get(0) : null);
if (isDatabase && !systemChange) {
databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null);
}
this.analystPages.clear();
this.setPage(this.leftPage, null);
this.setPage(this.rightPage, null);
if (this.isDatabase) {
this.analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(this.analystPanel, this.analystPageSize, this.currentSystem, this.isMaster));
analystPages.clear();
setPage(leftPage, null);
setPage(rightPage, null);
if (isDatabase) {
analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster));
}
if (this.current != null) {
this.analystPages.add(new AnalystPageDescription(this.analystPanel, this.analystPageSize, this.current));
this.analystPages.add(new AnalystPageGenome(this.analystPanel, this.analystPageSize, true, this.current));
if (!this.isDatabase) {
this.analystPages.add(new AnalystPageGenome(this.analystPanel, this.analystPageSize, false, this.current));
this.analystPages.add(new AnalystPageKaryogram(this.analystPanel, this.analystPageSize, this.current));
if (current != null) {
analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current));
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current));
if (!isDatabase) {
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, false, current));
analystPages.add(new AnalystPageKaryogram(analystPanel, analystPageSize, current));
}
if (!(this.current instanceof ITree)) {
this.analystPages.add(new AnalystPageClimate(this.analystPanel, this.analystPageSize, this.current));
if (!(current instanceof ITree)) {
analystPages.add(new AnalystPageClimate(analystPanel, analystPageSize, current));
}
if (this.current instanceof IBee) {
this.analystPages.add(new AnalystPageProducts(this.analystPanel, this.analystPageSize, (IBee) this.current));
if (current instanceof IBee) {
analystPages.add(new AnalystPageProducts(analystPanel, analystPageSize, (IBee) current));
} else if (current instanceof ITree) {
analystPages.add(new AnalystPageFruit(analystPanel, analystPageSize, (ITree) current));
analystPages.add(new AnalystPageWood(analystPanel, analystPageSize, (ITree) current));
} else if (current instanceof IFlower) {
analystPages.add(new AnalystPageSoil(analystPanel, analystPageSize, (IFlower) current));
} else if (current instanceof IButterfly) {
analystPages.add(new AnalystPageSpecimen(analystPanel, analystPageSize, (IButterfly) current));
}
else if (this.current instanceof ITree) {
this.analystPages.add(new AnalystPageFruit(this.analystPanel, this.analystPageSize, (ITree) this.current));
this.analystPages.add(new AnalystPageWood(this.analystPanel, this.analystPageSize, (ITree) this.current));
analystPages.add(new AnalystPageBiology(analystPanel, analystPageSize, current));
if (current instanceof IBee || current instanceof IButterfly) {
analystPages.add(new AnalystPageBehaviour(analystPanel, analystPageSize, current));
} else if (current instanceof ITree) {
analystPages.add(new AnalystPageGrowth(analystPanel, analystPageSize, current));
} else if (current instanceof IFlower) {
analystPages.add(new AnalystPageAppearance(analystPanel, analystPageSize, (IFlower) current));
}
else if (this.current instanceof IFlower) {
this.analystPages.add(new AnalystPageSoil(this.analystPanel, this.analystPageSize, (IFlower) this.current));
}
else if (this.current instanceof IButterfly) {
this.analystPages.add(new AnalystPageSpecimen(this.analystPanel, this.analystPageSize, (IButterfly) this.current));
}
this.analystPages.add(new AnalystPageBiology(this.analystPanel, this.analystPageSize, this.current));
if (this.current instanceof IBee || this.current instanceof IButterfly) {
this.analystPages.add(new AnalystPageBehaviour(this.analystPanel, this.analystPageSize, this.current));
}
else if (this.current instanceof ITree) {
this.analystPages.add(new AnalystPageGrowth(this.analystPanel, this.analystPageSize, this.current));
}
else if (this.current instanceof IFlower) {
this.analystPages.add(new AnalystPageAppearance(this.analystPanel, this.analystPageSize, (IFlower) this.current));
}
this.analystPages.add(new AnalystPageMutations(this.analystPanel, this.analystPageSize, this.current, this.isMaster));
analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster));
}
this.tabBar.deleteAllChildren();
final float width = this.tabBar.w() / this.analystPages.size();
tabBar.deleteAllChildren();
float width = tabBar.w() / analystPages.size();
float x = 0.0f;
for (final ControlAnalystPage page : this.analystPages) {
new ControlTooltip(this.tabBar, x, 0.0f, width, this.tabBar.h()) {
for (ControlAnalystPage page : analystPages) {
new ControlTooltip(tabBar, x, 0.0f, width, tabBar.h()) {
ControlAnalystPage value;
@Override
public void getTooltip(final Tooltip tooltip) {
tooltip.add(this.value.getTitle());
public void getTooltip(Tooltip tooltip) {
tooltip.add(value.getTitle());
}
@Override
protected void initialise() {
super.initialise();
this.addAttribute(WidgetAttribute.MouseOver);
this.value = page;
this.addSelfEventHandler(new EventMouse.Down.Handler() {
addAttribute(WidgetAttribute.MouseOver);
value = page;
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(final EventMouse.Down event) {
final int currentIndex = WindowAnalyst.this.analystPages.indexOf(WindowAnalyst.this.rightPage.getContent());
int clickedIndex = WindowAnalyst.this.analystPages.indexOf(value);
if (WindowAnalyst.this.isDatabase) {
public void onEvent(EventMouse.Down event) {
int currentIndex = analystPages.indexOf(rightPage.getContent());
int clickedIndex = analystPages.indexOf(value);
if (isDatabase) {
if (clickedIndex != 0 && clickedIndex != currentIndex) {
WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, value);
setPage(rightPage, value);
}
}
else {
} else {
if (clickedIndex < 0) {
clickedIndex = 0;
}
if (clickedIndex < currentIndex) {
++clickedIndex;
}
WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, null);
WindowAnalyst.this.setPage(WindowAnalyst.this.leftPage, null);
WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, WindowAnalyst.this.analystPages.get(clickedIndex));
WindowAnalyst.this.setPage(WindowAnalyst.this.leftPage, WindowAnalyst.this.analystPages.get(clickedIndex - 1));
setPage(rightPage, null);
setPage(leftPage, null);
setPage(rightPage, analystPages.get(clickedIndex));
setPage(leftPage, analystPages.get(clickedIndex - 1));
}
}
});
@@ -382,64 +342,64 @@ public class WindowAnalyst extends Window
@Override
public void onRenderBackground() {
final boolean active = this.value == WindowAnalyst.this.leftPage.getContent() || this.value == WindowAnalyst.this.rightPage.getContent();
CraftGUI.Render.colour((active ? -16777216 : 1140850688) + this.value.getColor());
CraftGUI.Render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1));
CraftGUI.Render.colour(this.value.getColor());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, this.getArea().inset(1));
boolean active = value == leftPage.getContent() || value == rightPage.getContent();
CraftGUI.Render.colour((active ? 0xff000000 : 0x44000000) + value.getColor());
CraftGUI.Render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
CraftGUI.Render.colour(value.getColor());
CraftGUI.Render.texture(CraftGUITexture.TabOutline, getArea().inset(1));
super.onRenderBackground();
}
};
x += width;
}
if (this.analystPages.size() > 0) {
this.setPage(this.leftPage, this.analystPages.get((oldLeft >= 0) ? oldLeft : 0));
if (analystPages.size() > 0) {
setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0));
}
if (this.analystPages.size() > 1) {
this.setPage(this.rightPage, this.analystPages.get((oldRight >= 0) ? oldRight : 1));
if (analystPages.size() > 1) {
setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1));
}
}
public void shiftPages(final boolean right) {
if (this.analystPages.size() < 2) {
public void shiftPages(boolean right) {
if (analystPages.size() < 2) {
return;
}
final int leftIndex = this.analystPages.indexOf(this.leftPage.getContent());
final int rightIndex = this.analystPages.indexOf(this.rightPage.getContent());
if (right && rightIndex + 1 >= this.analystPages.size()) {
int leftIndex = analystPages.indexOf(leftPage.getContent());
int rightIndex = analystPages.indexOf(rightPage.getContent());
if (right && rightIndex + 1 >= analystPages.size()) {
return;
}
if (!this.lockedSearch && !right && leftIndex <= 0) {
if (!lockedSearch && !right && leftIndex <= 0) {
return;
}
if (!this.lockedSearch && !right && rightIndex <= 1) {
if (!lockedSearch && !right && rightIndex <= 1) {
return;
}
final int newRightIndex = rightIndex + (right ? 1 : -1);
final int newLeftIndex = this.lockedSearch ? 0 : (newRightIndex - 1);
int newRightIndex = rightIndex + (right ? 1 : -1);
int newLeftIndex = lockedSearch ? 0 : (newRightIndex - 1);
float oldRightPercent = 0.0f;
float oldLeftPercent = 0.0f;
if (newLeftIndex == rightIndex) {
oldRightPercent = this.rightPage.getPercentageIndex();
oldRightPercent = rightPage.getPercentageIndex();
}
if (newRightIndex == leftIndex) {
oldLeftPercent = this.leftPage.getPercentageIndex();
oldLeftPercent = leftPage.getPercentageIndex();
}
this.setPage(this.leftPage, null);
this.setPage(this.rightPage, null);
this.setPage(this.leftPage, this.analystPages.get(newLeftIndex));
this.setPage(this.rightPage, this.analystPages.get(newRightIndex));
this.analystPages.get(newLeftIndex).show();
setPage(leftPage, null);
setPage(rightPage, null);
setPage(leftPage, analystPages.get(newLeftIndex));
setPage(rightPage, analystPages.get(newRightIndex));
analystPages.get(newLeftIndex).show();
if (oldRightPercent != 0.0f) {
this.leftPage.setPercentageIndex(oldRightPercent);
leftPage.setPercentageIndex(oldRightPercent);
}
if (oldLeftPercent != 0.0f) {
this.rightPage.setPercentageIndex(oldLeftPercent);
rightPage.setPercentageIndex(oldLeftPercent);
}
}
public void setPage(final ControlScrollableContent side, final ControlAnalystPage page) {
final ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent();
public void setPage(ControlScrollableContent side, ControlAnalystPage page) {
ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent();
if (existingPage != null) {
existingPage.hide();
side.setScrollableContent(null);
@@ -455,31 +415,62 @@ public class WindowAnalyst extends Window
@Override
public void onWindowInventoryChanged() {
super.onWindowInventoryChanged();
if (this.getWindowInventory().getStackInSlot(0) != null && !Analyser.isAnalysed(this.getWindowInventory().getStackInSlot(0))) {
this.getWindowInventory().setInventorySlotContents(0, Analyser.analyse(this.getWindowInventory().getStackInSlot(0)));
this.getWindowInventory().decrStackSize(1, 1);
if (getWindowInventory().getStackInSlot(0) != null && !Analyser.isAnalysed(getWindowInventory().getStackInSlot(0))) {
getWindowInventory().setInventorySlotContents(0, Analyser.analyse(getWindowInventory().getStackInSlot(0)));
getWindowInventory().decrStackSize(1, 1);
}
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(this.getWindowInventory().getStackInSlot(0));
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(getWindowInventory().getStackInSlot(0));
if (ind != null) {
ind.getGenome().getSpeciesRoot().getBreedingTracker(this.getWorld(), this.getUsername()).registerBirth(ind);
ind.getGenome().getSpeciesRoot().getBreedingTracker(getWorld(), getUsername()).registerBirth(ind);
}
if (this.isClient()) {
this.setStack(this.getWindowInventory().getStackInSlot(0));
}
else if (this.isServer()) {
if (isClient()) {
setStack(getWindowInventory().getStackInSlot(0));
}
}
public void setStack(final ItemStack stack) {
final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
this.setIndividual(ind);
public void setStack(ItemStack stack) {
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
setIndividual(ind);
}
public IIndividual getIndividual() {
return this.current;
return current;
}
public void setIndividual(IIndividual ind) {
if (!isDatabase) {
if (ind == null) {
analystNone.show();
slideUpInv.hide();
} else {
analystNone.hide();
slideUpInv.show();
}
}
if (ind == current || (ind != null && current != null && ind.isGeneticEqual(current))) {
return;
}
boolean systemChange = (current = ind) != null && ind.getGenome().getSpeciesRoot() != getSystem().getSpeciesRoot();
if (systemChange) {
currentSystem = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
}
updatePages(systemChange);
}
public BreedingSystem getSystem() {
return this.currentSystem;
return currentSystem;
}
public void setSystem(BreedingSystem system) {
if (system == currentSystem) {
return;
}
currentSystem = system;
current = null;
updatePages(true);
}
}