Update buildscript & spotlessApply

This commit is contained in:
DianeXD committed 2022-07-03 12:17:51 +08:00
1 parent e4329e2b8f
commit 8683a345c3
818 files changed
+51123 -49403

No files matched your search

@@ -14,62 +14,70 @@ import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;
public class AnalystPageAppearance extends ControlAnalystPage {
public AnalystPageAppearance(IWidget parent, IArea area, IFlower ind) {
super(parent, area);
setColor(0x333333);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
y += 12;
public AnalystPageAppearance(IWidget parent, IArea area, IFlower ind) {
super(parent, area);
setColor(0x333333);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
ControlColorDisplay a = new ControlColorDisplay(this, w() / 2.0f - 28.0f, y);
a.setValue(ind.getGenome().getPrimaryColor());
a.addTooltip(I18N.localise("genetics.gui.analyst.primaryColor"));
ControlColorDisplay a = new ControlColorDisplay(this, w() / 2.0f - 28.0f, y);
a.setValue(ind.getGenome().getPrimaryColor());
a.addTooltip(I18N.localise("genetics.gui.analyst.primaryColor"));
ControlColorDisplay b = new ControlColorDisplay(this, w() / 2.0f - 8.0f, y);
b.setValue(ind.getGenome().getSecondaryColor());
b.addTooltip(I18N.localise("genetics.gui.analyst.secondaryColor"));
ControlColorDisplay b = new ControlColorDisplay(this, w() / 2.0f - 8.0f, y);
b.setValue(ind.getGenome().getSecondaryColor());
b.addTooltip(I18N.localise("genetics.gui.analyst.secondaryColor"));
ControlColorDisplay c = new ControlColorDisplay(this, w() / 2.0f + 12.0f, y);
c.setValue(ind.getGenome().getStemColor());
c.addTooltip(I18N.localise("genetics.gui.analyst.stemColor"));
y += 26;
ControlColorDisplay c = new ControlColorDisplay(this, w() / 2.0f + 12.0f, y);
c.setValue(ind.getGenome().getStemColor());
c.addTooltip(I18N.localise("genetics.gui.analyst.stemColor"));
y += 26;
int sections = ind.getGenome().getType().getSections();
int w = (sections > 1) ? 50 : 100;
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();
float scale = w / 16.0f;
float dy = (sections > 1) ? 16.0f : 0.0f;
GL11.glScalef(scale, scale, 1.0f);
CraftGUI.render.color(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));
}
new ControlIconDisplay(this, (w() - w) / 2.0f, y - ((sections == 1) ? 0 : 0), null) {
@Override
public void onRenderForeground() {
GL11.glPushMatrix();
float scale = w / 16.0f;
float dy = (sections > 1) ? 16.0f : 0.0f;
GL11.glScalef(scale, scale, 1.0f);
CraftGUI.render.color(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.color(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().getStem(EnumFlowerStage.FLOWER, true, 0));
CraftGUI.render.color(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.color(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().getPetalIcon(EnumFlowerStage.FLOWER, true, 0));
CraftGUI.render.color(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();
}
};
}
CraftGUI.render.iconBlock(
new IPoint(0.0f, dy),
ind.getGenome().getType().getVariantIcon(EnumFlowerStage.FLOWER, true, 0));
GL11.glPopMatrix();
}
};
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.appearance");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.appearance");
}
}
@@ -18,77 +18,99 @@ import forestry.plugins.PluginApiculture;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageBehaviour extends ControlAnalystPage {
public AnalystPageBehaviour(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x660033);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
y += 12;
public AnalystPageBehaviour(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x660033);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
if (ind instanceof IBee) {
IBee bee = (IBee) ind;
y += 8;
int fertility = bee.getGenome().getFlowering();
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n" + bee.getGenome().getFlowerProvider().getDescription())
.setColor(getColor());
y += 20;
if (ind instanceof IBee) {
IBee bee = (IBee) ind;
y += 8;
int fertility = bee.getGenome().getFlowering();
new ControlTextCentered(
this,
y,
I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n"
+ bee.getGenome().getFlowerProvider().getDescription())
.setColor(getColor());
y += 20;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.everyTime", getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100.0f / fertility)))
.setColor(getColor());
y += 22;
new ControlTextCentered(
this,
y,
I18N.localise(
"genetics.gui.analyst.behaviour.everyTime",
getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100.0f / fertility)))
.setColor(getColor());
y += 22;
IAlleleBeeEffect effect = bee.getGenome().getEffect();
int[] t = bee.getGenome().getTerritory();
if (!effect.getUID().contains("None")) {
String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc");
String loc = effectDesc.isEmpty()
? I18N.localise("genetics.gui.analyst.behaviour.effect", effect.getName())
: effectDesc;
IAlleleBeeEffect effect = bee.getGenome().getEffect();
int[] t = bee.getGenome().getTerritory();
if (!effect.getUID().contains("None")) {
String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc");
String loc = effectDesc.isEmpty()
? I18N.localise("genetics.gui.analyst.behaviour.effect", effect.getName())
: effectDesc;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc, TextJustification.TOP_CENTER)
.setColor(getColor());
y += (int) (CraftGUI.render.textHeight(loc, w() - 8.0f) + 1.0f);
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc, TextJustification.TOP_CENTER)
.setColor(getColor());
y += (int) (CraftGUI.render.textHeight(loc, w() - 8.0f) + 1.0f);
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.withinBlocks", (int) (t[0] / 2.0f)))
.setColor(getColor());
y += 22;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.withinBlocks", (int)
(t[0] / 2.0f)))
.setColor(getColor());
y += 22;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.territory", t[0], t[1], t[2]))
.setColor(getColor());
y += 22;
}
new ControlTextCentered(
this, y, I18N.localise("genetics.gui.analyst.behaviour.territory", t[0], t[1], t[2]))
.setColor(getColor());
y += 22;
}
if (ind instanceof IButterfly) {
IButterfly bee2 = (IButterfly) ind;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.metabolism", Binnie.Genetics.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))))
.setColor(getColor());
y += 20;
if (ind instanceof IButterfly) {
IButterfly bee2 = (IButterfly) ind;
new ControlTextCentered(
this,
y,
I18N.localise(
"genetics.gui.analyst.behaviour.metabolism",
Binnie.Genetics.mothBreedingSystem.getAlleleName(
EnumButterflyChromosome.METABOLISM,
ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))))
.setColor(getColor());
y += 20;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n" + bee2.getGenome().getFlowerProvider().getDescription())
.setColor(getColor());
y += 20;
new ControlTextCentered(
this,
y,
I18N.localise("genetics.gui.analyst.behaviour.pollinatesNearby") + "\n"
+ bee2.getGenome().getFlowerProvider().getDescription())
.setColor(getColor());
y += 20;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.behaviour.everyTime", getTimeString(1500.0f)))
.setColor(getColor());
y += 22;
new ControlTextCentered(
this, y, I18N.localise("genetics.gui.analyst.behaviour.everyTime", getTimeString(1500.0f)))
.setColor(getColor());
y += 22;
IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect();
if (!effect2.getUID().contains("None")) {
String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc");
String loc2 = effectDesc2.isEmpty()
? I18N.localise("genetics.gui.analyst.behaviour.effect", effect2.getName())
: effectDesc2;
IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect();
if (!effect2.getUID().contains("None")) {
String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc");
String loc2 = effectDesc2.isEmpty()
? I18N.localise("genetics.gui.analyst.behaviour.effect", effect2.getName())
: effectDesc2;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc2, TextJustification.TOP_CENTER)
.setColor(getColor());
}
}
}
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 0.0f), loc2, TextJustification.TOP_CENTER)
.setColor(getColor());
}
}
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.behaviour");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.behaviour");
}
}
@@ -15,233 +15,270 @@ import forestry.api.arboriculture.ITree;
import forestry.api.genetics.IIndividual;
import forestry.api.lepidopterology.IButterfly;
import forestry.plugins.PluginApiculture;
import java.text.DecimalFormat;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.EnumPlantType;
import java.text.DecimalFormat;
public class AnalystPageBiology extends ControlAnalystPage {
private static final float SPAWN_KOEF = 1365.3999f;
public AnalystPageBiology(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x006666);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
y += 12;
private static final float SPAWN_KOEF = 1365.3999f;
if (ind instanceof IBee) {
IBee bee = (IBee) ind;
if (bee.getGenome().getNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.allDay"));
} else if (bee.getGenome().getPrimary().isNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.night"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.day"));
}
public AnalystPageBiology(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x006666);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
if (!bee.getGenome().getTolerantFlyer()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notRain"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.rain"));
}
if (ind instanceof IBee) {
IBee bee = (IBee) ind;
if (bee.getGenome().getNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.allDay"));
} else if (bee.getGenome().getPrimary().isNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.night"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.day"));
}
if (bee.getGenome().getCaveDwelling()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoSky.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.underground"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconSky.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notUnderground"));
}
y += 30;
} else if (ind instanceof IButterfly) {
IButterfly moth = (IButterfly) ind;
if (moth.getGenome().getNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.allDay"));
} else if (moth.getGenome().getPrimary().isNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.night"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.day"));
}
if (!bee.getGenome().getTolerantFlyer()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notRain"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.rain"));
}
if (!moth.getGenome().getTolerantFlyer()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notRain"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.rain"));
}
if (bee.getGenome().getCaveDwelling()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoSky.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.underground"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconSky.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notUnderground"));
}
y += 30;
} else if (ind instanceof IButterfly) {
IButterfly moth = (IButterfly) ind;
if (moth.getGenome().getNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconAllDay.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.allDay"));
} else if (moth.getGenome().getPrimary().isNocturnal()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconNight.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.night"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f, y, ModuleItem.iconDaytime.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.day"));
}
if (moth.getGenome().getFireResist()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoFire.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.nonflammable"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconFire.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.flammable"));
}
y += 30;
} else if (ind instanceof ITree) {
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.biology.sappiness", alleleName))
.setColor(getColor());
y += 20;
} else {
y += 10;
}
if (!moth.getGenome().getTolerantFlyer()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconNoRain.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.notRain"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 24.0f, y, ModuleItem.iconRain.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.rain"));
}
if (ind instanceof IBee) {
IBee bee = (IBee) ind;
int fertility = bee.getGenome().getFertility();
if (fertility > 1) {
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.fertility.drones", fertility))
.setColor(getColor());
} else {
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.fertility.drone"))
.setColor(getColor());
}
if (moth.getGenome().getFireResist()) {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconNoFire.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.nonflammable"));
} else {
new ControlIconDisplay(this, (w() - 64.0f) / 2.0f + 48.0f, y, ModuleItem.iconFire.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.biology.flammable"));
}
y += 30;
} else if (ind instanceof ITree) {
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(
EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC
+ I18N.localise("genetics.gui.analyst.biology.sappiness", alleleName))
.setColor(getColor());
y += 20;
} else {
y += 10;
}
y += 22;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.averageLifespan"))
.setColor(getColor());
if (ind instanceof IBee) {
IBee bee = (IBee) ind;
int fertility = bee.getGenome().getFertility();
if (fertility > 1) {
new ControlTextCentered(
this,
y,
EnumChatFormatting.BOLD
+ I18N.localise("genetics.gui.analyst.biology.fertility.drones", fertility))
.setColor(getColor());
} else {
new ControlTextCentered(
this,
y,
EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.fertility.drone"))
.setColor(getColor());
}
y += 12;
int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(lifespan * (bee.getGenome().getNocturnal() ? 1.0f : 2.0f)))
.setColor(getColor());
y += 22;
}
y += 22;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.averageLifespan"))
.setColor(getColor());
if (ind instanceof IButterfly) {
IButterfly bee2 = (IButterfly) ind;
int fertility = bee2.getGenome().getFertility();
if (fertility > 1) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.moths", fertility))
.setColor(getColor());
} else {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.moth"))
.setColor(getColor());
}
y += 12;
int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
new ControlTextCentered(
this,
y,
EnumChatFormatting.BOLD
+ getMCDayString(lifespan * (bee.getGenome().getNocturnal() ? 1.0f : 2.0f)))
.setColor(getColor());
y += 22;
}
y += 32;
float caterpillarMatureTime = SPAWN_KOEF * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2));
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.caterpillarGestation"))
.setColor(getColor());
if (ind instanceof IButterfly) {
IButterfly bee2 = (IButterfly) ind;
int fertility = bee2.getGenome().getFertility();
if (fertility > 1) {
new ControlTextCentered(
this, y, I18N.localise("genetics.gui.analyst.biology.fertility.moths", fertility))
.setColor(getColor());
} else {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.moth"))
.setColor(getColor());
}
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(caterpillarMatureTime))
.setColor(getColor());
y += 32;
float caterpillarMatureTime = SPAWN_KOEF
* Math.round(
bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2));
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.caterpillarGestation"))
.setColor(getColor());
y += 22;
int speed = (int) (20.0f * bee2.getGenome().getSpeed());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.flightSpeed"))
.setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(caterpillarMatureTime))
.setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.blocksPerSec", speed))
.setColor(getColor());
y += 22;
}
y += 22;
int speed = (int) (20.0f * bee2.getGenome().getSpeed());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.flightSpeed"))
.setColor(getColor());
if (ind instanceof ITree) {
ITree tree = (ITree) ind;
int fertility = (int) (1.0f / tree.getGenome().getFertility());
if (fertility > 1) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.leaves", fertility))
.setColor(getColor());
} else {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.leaf"))
.setColor(getColor());
}
y += 12;
new ControlTextCentered(
this,
y,
EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.biology.blocksPerSec", speed))
.setColor(getColor());
y += 22;
}
y += 22;
float butterflySpawn = SPAWN_KOEF / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f);
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.mothSpawn.perLeaf", getTimeString(butterflySpawn)))
.setColor(getColor());
if (ind instanceof ITree) {
ITree tree = (ITree) ind;
int fertility = (int) (1.0f / tree.getGenome().getFertility());
if (fertility > 1) {
new ControlTextCentered(
this, y, I18N.localise("genetics.gui.analyst.biology.fertility.leaves", fertility))
.setColor(getColor());
} else {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.fertility.leaf"))
.setColor(getColor());
}
y += 34;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.planTypes"))
.setColor(getColor());
y += 22;
float butterflySpawn = SPAWN_KOEF
/ (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f);
new ControlTextCentered(
this,
y,
I18N.localise(
"genetics.gui.analyst.biology.mothSpawn.perLeaf", getTimeString(butterflySpawn)))
.setColor(getColor());
y += 12;
for (EnumPlantType type : tree.getGenome().getPlantTypes()) {
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + type.name())
.setColor(getColor());
y += 12;
}
}
if (ind instanceof IFlower) {
IFlower flower = (IFlower) ind;
float butterflySpawn2 = SPAWN_KOEF / (flower.getGenome().getSappiness() * 0.2f);
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.mothSpawn", getTimeString(butterflySpawn2)))
.setColor(getColor());
y += 30;
y += 34;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.planTypes"))
.setColor(getColor());
int fertility = flower.getGenome().getFertility();
float chanceDispersal = 0.8f;
chanceDispersal += 0.2f * fertility;
if (chanceDispersal > 1.0f) {
chanceDispersal = 1.0f;
}
y += 12;
for (EnumPlantType type : tree.getGenome().getPlantTypes()) {
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + type.name()).setColor(getColor());
y += 12;
}
}
if (ind instanceof IFlower) {
IFlower flower = (IFlower) ind;
float butterflySpawn2 = SPAWN_KOEF / (flower.getGenome().getSappiness() * 0.2f);
new ControlTextCentered(
this,
y,
I18N.localise("genetics.gui.analyst.biology.mothSpawn", getTimeString(butterflySpawn2)))
.setColor(getColor());
y += 30;
float chancePollinate = 0.6f;
chancePollinate += 0.25f * fertility;
if (chancePollinate > 1.0f) {
chancePollinate = 1.0f;
}
int fertility = flower.getGenome().getFertility();
float chanceDispersal = 0.8f;
chanceDispersal += 0.2f * fertility;
if (chanceDispersal > 1.0f) {
chanceDispersal = 1.0f;
}
float maxAge = flower.getMaxAge();
float ageChance = flower.getGenome().getAgeChance();
float dispersalTime = SPAWN_KOEF / chanceDispersal;
float pollinateTime = SPAWN_KOEF / chancePollinate;
float lifespan2 = maxAge * 20.0f * 68.27f / ageChance;
float floweringLifespan = (maxAge - 1) * 20.0f * 68.27f / ageChance - SPAWN_KOEF;
float chancePollinate = 0.6f;
chancePollinate += 0.25f * fertility;
if (chancePollinate > 1.0f) {
chancePollinate = 1.0f;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.averageLifespan"))
.setColor(getColor());
y += 12;
float maxAge = flower.getMaxAge();
float ageChance = flower.getGenome().getAgeChance();
float dispersalTime = SPAWN_KOEF / chanceDispersal;
float pollinateTime = SPAWN_KOEF / chancePollinate;
float lifespan2 = maxAge * 20.0f * 68.27f / ageChance;
float floweringLifespan = (maxAge - 1) * 20.0f * 68.27f / ageChance - SPAWN_KOEF;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(lifespan2))
.setColor(getColor());
y += 22;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.averageLifespan"))
.setColor(getColor());
y += 12;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.seedDispersal"))
.setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getMCDayString(lifespan2)).setColor(getColor());
y += 22;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.biology.perLifetime", (int) (floweringLifespan / dispersalTime)))
.setColor(getColor());
y += 22;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.seedDispersal"))
.setColor(getColor());
y += 12;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.pollination"))
.setColor(getColor());
y += 12;
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC
+ I18N.localise("genetics.gui.analyst.biology.perLifetime", (int)
(floweringLifespan / dispersalTime)))
.setColor(getColor());
y += 22;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.biology.perLifetime", (int) (floweringLifespan / pollinateTime)))
.setColor(getColor());
y += 22;
}
setSize(new IPoint(w(), y));
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.biology.pollination"))
.setColor(getColor());
y += 12;
private String getMCDayString(float time) {
float seconds = time / 20.0f;
float minutes = seconds / 60.0f;
float days = minutes / 20.0f;
DecimalFormat df = new DecimalFormat("#.#");
return I18N.localise("genetics.gui.analyst.biology.mcDays", df.format(days));
}
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC
+ I18N.localise("genetics.gui.analyst.biology.perLifetime", (int)
(floweringLifespan / pollinateTime)))
.setColor(getColor());
y += 22;
}
setSize(new IPoint(w(), y));
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.biology");
}
private String getMCDayString(float time) {
float seconds = time / 20.0f;
float minutes = seconds / 60.0f;
float days = minutes / 20.0f;
DecimalFormat df = new DecimalFormat("#.#");
return I18N.localise("genetics.gui.analyst.biology.mcDays", df.format(days));
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.biology");
}
}
@@ -19,127 +19,147 @@ import forestry.api.genetics.IAlleleTolerance;
import forestry.api.genetics.IIndividual;
import forestry.api.lepidopterology.EnumButterflyChromosome;
import forestry.api.lepidopterology.IButterfly;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import java.util.ArrayList;
import java.util.List;
public class AnalystPageClimate extends ControlAnalystPage {
public AnalystPageClimate(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x006633);
EnumTemperature temp = ind.getGenome().getPrimary().getTemperature();
EnumTolerance tempTol = EnumTolerance.NONE;
EnumHumidity humid = ind.getGenome().getPrimary().getHumidity();
EnumTolerance humidTol = EnumTolerance.NONE;
public AnalystPageClimate(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x006633);
EnumTemperature temp = ind.getGenome().getPrimary().getTemperature();
EnumTolerance tempTol = EnumTolerance.NONE;
EnumHumidity humid = ind.getGenome().getPrimary().getHumidity();
EnumTolerance humidTol = EnumTolerance.NONE;
if (ind instanceof IBee) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE)).getValue();
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE)).getValue();
}
if (ind instanceof IBee) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE))
.getValue();
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE))
.getValue();
}
if (ind instanceof IFlower) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
humidTol = EnumTolerance.BOTH_5;
}
if (ind instanceof IFlower) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE))
.getValue();
humidTol = EnumTolerance.BOTH_5;
}
if (ind instanceof IButterfly) {
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE)).getValue();
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE)).getValue();
}
if (ind instanceof IButterfly) {
tempTol = ((IAlleleTolerance)
ind.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE))
.getValue();
humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE))
.getValue();
}
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.temperature"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
createTemperatureBar(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, temp, tempTol);
y += 16;
y += 16;
new ControlText(
this,
new IArea(4.0f, y, w() - 8.0f, 14.0f),
I18N.localise("genetics.gui.analyst.climate.temperature"),
TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
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, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.humidity"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
createHumidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, humid, humidTol);
y += 16;
}
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
if (!(ind instanceof IFlower)) {
new ControlText(
this,
new IArea(4.0f, y, w() - 8.0f, 14.0f),
I18N.localise("genetics.gui.analyst.climate.humidity"),
TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
createHumidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, humid, humidTol);
y += 16;
}
new ControlText(
this,
new IArea(4.0f, y, w() - 8.0f, 14.0f),
I18N.localise("genetics.gui.analyst.climate.biomes"),
TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
List<BiomeGenBase> biomes = new ArrayList<>();
for (BiomeGenBase biome : BiomeGenBase.getBiomeGenArray()) {
if (biome == null || !BiomeDictionary.isBiomeRegistered(biome) || biome == BiomeGenBase.frozenOcean) {
continue;
}
y += 12;
List<BiomeGenBase> biomes = new ArrayList<>();
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;
}
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;
}
}
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);
}
}
if (!match) {
biomes.add(biome);
}
}
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 (BiomeGenBase biome2 : biomes) {
new ControlBiome(this, biomeListX + dx, y + dy, 16.0f, 16.0f, biome2);
dx += 18;
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
}
setSize(new IPoint(w(), y + dy + 18 + 8));
}
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 (BiomeGenBase biome2 : biomes) {
new ControlBiome(this, biomeListX + dx, y + dy, 16.0f, 16.0f, biome2);
dx += 18;
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
}
setSize(new IPoint(w(), y + dy + 18 + 8));
}
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(EnumTemperature value) {
return value.name;
}
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(EnumTemperature value) {
return value.name;
}
@Override
protected int getColor(EnumTemperature value) {
return (new int[]{0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000})[value.ordinal() - 1];
}
}.setValues(value, tol);
}
@Override
protected int getColor(EnumTemperature value) {
return (new int[] {0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000})[value.ordinal() - 1];
}
}.setValues(value, 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(EnumHumidity value) {
return value.name;
}
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(EnumHumidity value) {
return value.name;
}
@Override
protected int getColor(EnumHumidity value) {
return (new int[]{0xffe7a3, 0x1aff00, 0x307cff})[value.ordinal()];
}
}.setValues(value, tol);
}
@Override
protected int getColor(EnumHumidity value) {
return (new int[] {0xffe7a3, 0x1aff00, 0x307cff})[value.ordinal()];
}
}.setValues(value, tol);
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.climate");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.climate");
}
}
@@ -20,161 +20,185 @@ import binnie.core.util.I18N;
import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import net.minecraft.util.EnumChatFormatting;
import java.util.ArrayList;
import java.util.Collection;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageDatabase extends ControlAnalystPage {
ControlScrollableContent scroll;
boolean isMaster;
ControlScrollableContent scroll;
boolean isMaster;
public AnalystPageDatabase(IWidget parent, IArea area, BreedingSystem system, boolean isMaster) {
super(parent, area);
scroll = null;
this.isMaster = isMaster;
int cOfSystem = system.getColor();
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;
}
int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness);
setColor(newColour);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 16;
new ControlTextEdit(this, 20.0f, y, w() - 40.0f, 16.0f) {
@Override
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);
}
scroll.deleteAllChildren();
scroll.setScrollableContent(getItemScrollList(system, options));
}
public AnalystPageDatabase(IWidget parent, IArea area, BreedingSystem system, boolean isMaster) {
super(parent, area);
scroll = null;
this.isMaster = isMaster;
int cOfSystem = system.getColor();
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;
}
int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness);
setColor(newColour);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 16;
new ControlTextEdit(this, 20.0f, y, w() - 40.0f, 16.0f) {
@Override
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);
}
scroll.deleteAllChildren();
scroll.setScrollableContent(getItemScrollList(system, options));
}
@Override
public void onRenderBackground() {
CraftGUI.render.color(0x555555);
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
CraftGUI.render.color(AnalystPageDatabase.this.getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
super.renderTextField();
}
};
y += 22;
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));
}
@Override
public void onRenderBackground() {
CraftGUI.render.color(0x555555);
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
CraftGUI.render.color(AnalystPageDatabase.this.getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
super.renderTextField();
}
};
y += 22;
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) {
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();
setOptions(options);
}
if (textView) {
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();
setOptions(options);
}
@Override
public IWidget createOption(IAlleleSpecies v, int y) {
return new Control(getContent(), 0.0f, y, w(), 12.0f) {
IAlleleSpecies value = v;
@Override
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(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 0xffffff);
}
};
}
};
} else {
scroll = new ControlScrollableContent(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f, 0.0f);
scroll.setScrollableContent(getItemScrollList(system, options));
}
new ControlScrollBar(this, scroll.x() + scroll.w() - 6.0f, scroll.y() + 3.0f, 3.0f, scroll.h() - 6.0f, scroll) {
@Override
public void onRenderBackground() {
if (!isEnabled()) {
return;
}
CraftGUI.render.gradientRect(getArea(), 0x44000000 + AnalystPageDatabase.this.getColor(), 0x44000000 + AnalystPageDatabase.this.getColor());
CraftGUI.render.solid(getRenderArea(), AnalystPageDatabase.this.getColor());
}
};
}
@Override
public void onRenderBackground() {
CraftGUI.render.text(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 0xffffff);
}
};
}
};
} else {
scroll = new ControlScrollableContent(this, 4.0f, y, w() - 8.0f, h() - y - 8.0f, 0.0f);
scroll.setScrollableContent(getItemScrollList(system, options));
}
new ControlScrollBar(this, scroll.x() + scroll.w() - 6.0f, scroll.y() + 3.0f, 3.0f, scroll.h() - 6.0f, scroll) {
@Override
public void onRenderBackground() {
if (!isEnabled()) {
return;
}
CraftGUI.render.gradientRect(
getArea(),
0x44000000 + AnalystPageDatabase.this.getColor(),
0x44000000 + AnalystPageDatabase.this.getColor());
CraftGUI.render.solid(getRenderArea(), AnalystPageDatabase.this.getColor());
}
};
}
private IWidget getItemScrollList(BreedingSystem system, Collection<IAlleleSpecies> options) {
return new Control(scroll, 0.0f, 0.0f, scroll.w(), scroll.h()) {
@Override
public void initialise() {
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 (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() {
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
window.setIndividual(ind);
}
});
}
private IWidget getItemScrollList(BreedingSystem system, Collection<IAlleleSpecies> options) {
return new Control(scroll, 0.0f, 0.0f, scroll.w(), scroll.h()) {
@Override
public void initialise() {
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 (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() {
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
window.setIndividual(ind);
}
});
}
@Override
public void onRenderBackground() {
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) {
CraftGUI.render.color(0xeeeeee);
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(1));
CraftGUI.render.color(AnalystPageDatabase.this.getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().outset(1));
} else if (calculateIsMouseOver()) {
CraftGUI.render.color(0xeeeeee);
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(1));
}
super.onRenderBackground();
}
};
dx += 18;
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
}
setSize(new IPoint(w(), 4 + dy + 18));
}
};
}
@Override
public void onRenderBackground() {
WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getSuperParent();
if (window.getIndividual() != null
&& window.getIndividual().getGenome().getPrimary() == species) {
CraftGUI.render.color(0xeeeeee);
CraftGUI.render.texture(
CraftGUITexture.TabSolid, getArea().outset(1));
CraftGUI.render.color(AnalystPageDatabase.this.getColor());
CraftGUI.render.texture(
CraftGUITexture.TabOutline, getArea().outset(1));
} else if (calculateIsMouseOver()) {
CraftGUI.render.color(0xeeeeee);
CraftGUI.render.texture(
CraftGUITexture.TabSolid, getArea().outset(1));
}
super.onRenderBackground();
}
};
dx += 18;
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
}
setSize(new IPoint(w(), 4 + dy + 18));
}
};
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.registry");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.registry");
}
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;
}
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;
}
}
@@ -13,73 +13,96 @@ import forestry.api.genetics.IIndividual;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageDescription extends ControlAnalystPage {
public AnalystPageDescription(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x333333);
int y = 4;
public AnalystPageDescription(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x333333);
int y = 4;
IAlleleSpecies species = ind.getGenome().getPrimary();
String branchBinomial = (species.getBranch() != null)
? species.getBranch().getScientific()
: I18N.localise("genetics.gui.analyst.description.unknown");
String desc = species.getDescription();
StringBuilder descBody = new StringBuilder(EnumChatFormatting.ITALIC.toString());
String descSig = "";
if (desc == null || desc.isEmpty() || desc.matches("(\\w+\\.?)+")) {
descBody.append("");
} else {
String[] descStrings = desc.split("\\|");
descBody.append(descStrings[0]);
for (int i = 1; i < descStrings.length - 1; ++i) {
descBody.append(" ").append(descStrings[i]);
}
if (descStrings.length > 1) {
descSig += descStrings[descStrings.length - 1];
}
}
IAlleleSpecies species = ind.getGenome().getPrimary();
String branchBinomial = (species.getBranch() != null)
? species.getBranch().getScientific()
: I18N.localise("genetics.gui.analyst.description.unknown");
String desc = species.getDescription();
StringBuilder descBody = new StringBuilder(EnumChatFormatting.ITALIC.toString());
String descSig = "";
if (desc == null || desc.isEmpty() || desc.matches("(\\w+\\.?)+")) {
descBody.append("");
} else {
String[] descStrings = desc.split("\\|");
descBody.append(descStrings[0]);
for (int i = 1; i < descStrings.length - 1; ++i) {
descBody.append(" ").append(descStrings[i]);
}
if (descStrings.length > 1) {
descSig += descStrings[descStrings.length - 1];
}
}
String authority = species.getAuthority();
if (authority.contains("Binnie")) {
authority = EnumChatFormatting.DARK_BLUE.toString() + authority;
}
if (authority.contains("Sengir")) {
authority = EnumChatFormatting.DARK_GREEN.toString() + authority;
}
if (authority.contains("MysteriousAges")) {
authority = EnumChatFormatting.DARK_PURPLE.toString() + authority;
}
String authority = species.getAuthority();
if (authority.contains("Binnie")) {
authority = EnumChatFormatting.DARK_BLUE.toString() + authority;
}
if (authority.contains("Sengir")) {
authority = EnumChatFormatting.DARK_GREEN.toString() + authority;
}
if (authority.contains("MysteriousAges")) {
authority = EnumChatFormatting.DARK_PURPLE.toString() + authority;
}
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 16;
new ControlTextCentered(this, y, species.getName() + EnumChatFormatting.RESET)
.setColor(getColor());
y += 16;
new ControlTextCentered(this, y, species.getName() + EnumChatFormatting.RESET).setColor(getColor());
y += 10;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + EnumChatFormatting.RESET)
.setColor(getColor());
y += 10;
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC + branchBinomial + " " + species.getBinomial()
+ EnumChatFormatting.RESET)
.setColor(getColor());
y += 20;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.description.discoveredBy", authority) + EnumChatFormatting.RESET)
.setColor(getColor());
y += 20;
new ControlTextCentered(
this,
y,
EnumChatFormatting.BOLD
+ I18N.localise("genetics.gui.analyst.description.discoveredBy", authority)
+ EnumChatFormatting.RESET)
.setColor(getColor());
y += (int) (3.0f + CraftGUI.render.textHeight(EnumChatFormatting.BOLD + I18N.localise("genetics.gui.analyst.description.discoveredBy", authority) + EnumChatFormatting.RESET, w()));
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.description.complexity", species.getComplexity()))
.setColor(getColor());
y += (int) (3.0f
+ CraftGUI.render.textHeight(
EnumChatFormatting.BOLD
+ I18N.localise("genetics.gui.analyst.description.discoveredBy", authority)
+ EnumChatFormatting.RESET,
w()));
new ControlTextCentered(
this, y, I18N.localise("genetics.gui.analyst.description.complexity", species.getComplexity()))
.setColor(getColor());
y += 26;
ControlText descText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descBody.toString() + EnumChatFormatting.RESET, TextJustification.TOP_CENTER);
IWidget signatureText = new ControlText(this, new IArea(8.0f, y, w() - 16.0f, 0.0f), descSig + EnumChatFormatting.RESET, TextJustification.BOTTOM_RIGHT);
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));
setSize(new IPoint(w(), 20.0f + signatureText.y()));
}
y += 26;
ControlText descText = new ControlText(
this,
new IArea(8.0f, y, w() - 16.0f, 0.0f),
descBody.toString() + EnumChatFormatting.RESET,
TextJustification.TOP_CENTER);
IWidget signatureText = new ControlText(
this,
new IArea(8.0f, y, w() - 16.0f, 0.0f),
descSig + EnumChatFormatting.RESET,
TextJustification.BOTTOM_RIGHT);
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));
setSize(new IPoint(w(), 20.0f + signatureText.y()));
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.description");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.description");
}
}
@@ -14,126 +14,126 @@ import forestry.api.arboriculture.ITree;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IFruitFamily;
import forestry.arboriculture.FruitProviderPod;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Collections;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Collections;
public class AnalystPageFruit extends AnalystPageProduce {
public AnalystPageFruit(IWidget parent, IArea area, ITree ind) {
super(parent, area);
setColor(0xcc3300);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
public AnalystPageFruit(IWidget parent, IArea area, ITree ind) {
super(parent, area);
setColor(0xcc3300);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD));
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield", alleleName))
.setColor(getColor());
y += 12;
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(
EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD));
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield", alleleName))
.setColor(getColor());
y += 20;
Collection<ItemStack> products = new UniqueItemStackSet();
Collection<ItemStack> specialties = new UniqueItemStackSet();
Collections.addAll(products, ind.getProduceList());
Collections.addAll(specialties, ind.getSpecialtyList());
y += 20;
Collection<ItemStack> products = new UniqueItemStackSet();
Collection<ItemStack> specialties = new UniqueItemStackSet();
Collections.addAll(products, ind.getProduceList());
Collections.addAll(specialties, ind.getSpecialtyList());
try {
if (ind.getGenome().getFruitProvider() instanceof FruitProviderPod) {
FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider();
Field f = FruitProviderPod.class.getDeclaredField("drop");
f.setAccessible(true);
Collections.addAll(products, (ItemStack[]) f.get(pod));
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (ind.getGenome().getFruitProvider() instanceof FruitProviderPod) {
FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider();
Field f = FruitProviderPod.class.getDeclaredField("drop");
f.setAccessible(true);
Collections.addAll(products, (ItemStack[]) f.get(pod));
}
} catch (Exception e) {
e.printStackTrace();
}
if (products.size() > 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural"))
.setColor(getColor());
if (products.size() > 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural")).setColor(getColor());
y += 10;
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;
}
y += 10;
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, I18N.localise("genetics.gui.analyst.fruit.speciality"))
.setColor(getColor());
if (specialties.size() > 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.speciality"))
.setColor(getColor());
y += 10;
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;
}
y += 10;
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;
}
Collection<ItemStack> allProducts = new UniqueItemStackSet();
allProducts.addAll(products);
allProducts.addAll(specialties);
Collection<ItemStack> allProducts = new UniqueItemStackSet();
allProducts.addAll(products);
allProducts.addAll(specialties);
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
if (refinedProducts.size() > 0) {
y = getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts);
y += 8;
}
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
if (refinedProducts.size() > 0) {
y = getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts);
y += 8;
}
if (products.size() == 0 && specialties.size() == 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.none"))
.setColor(getColor());
y += 28;
}
if (products.size() == 0 && specialties.size() == 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.none")).setColor(getColor());
y += 28;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible"))
.setColor(getColor());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible")).setColor(getColor());
y += 12;
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) {
Collections.addAll(stacks, ((IAlleleFruit) a).getProvider().getProducts());
Collections.addAll(stacks, ((IAlleleFruit) a).getProvider().getSpecialty());
try {
if (a.getUID().contains("fruitCocoa")) {
stacks.add(new ItemStack(Items.dye, 1, 3));
} else {
if (!(((IAlleleFruit) a).getProvider() instanceof FruitProviderPod)) {
continue;
}
FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider();
Field field = FruitProviderPod.class.getDeclaredField("drop");
field.setAccessible(true);
Collections.addAll(stacks, (ItemStack[]) field.get(pod2));
}
} catch (Exception ex) {
// ignored
}
}
}
y = getRefined(EnumChatFormatting.ITALIC + fam.getName(), y, stacks) + 2;
}
setSize(new IPoint(w(), y + 8));
}
y += 12;
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) {
Collections.addAll(stacks, ((IAlleleFruit) a).getProvider().getProducts());
Collections.addAll(stacks, ((IAlleleFruit) a).getProvider().getSpecialty());
try {
if (a.getUID().contains("fruitCocoa")) {
stacks.add(new ItemStack(Items.dye, 1, 3));
} else {
if (!(((IAlleleFruit) a).getProvider() instanceof FruitProviderPod)) {
continue;
}
FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider();
Field field = FruitProviderPod.class.getDeclaredField("drop");
field.setAccessible(true);
Collections.addAll(stacks, (ItemStack[]) field.get(pod2));
}
} catch (Exception ex) {
// ignored
}
}
}
y = getRefined(EnumChatFormatting.ITALIC + fam.getName(), y, stacks) + 2;
}
setSize(new IPoint(w(), y + 8));
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.fruit");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.fruit");
}
}
@@ -20,49 +20,59 @@ import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;
public class AnalystPageGenome extends ControlAnalystPage {
boolean active;
boolean active;
public AnalystPageGenome(IWidget parent, IArea area, boolean active, IIndividual ind) {
super(parent, area);
this.active = active;
setColor(0x006699);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 16;
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();
GL11.glTranslatef(10.0f, -15.0f, 0.0f);
GL11.glScalef(0.9f, 0.95f, 1.0f);
}
public AnalystPageGenome(IWidget parent, IArea area, boolean active, IIndividual ind) {
super(parent, area);
this.active = active;
setColor(0x006699);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 16;
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();
GL11.glTranslatef(10.0f, -15.0f, 0.0f);
GL11.glScalef(0.9f, 0.95f, 1.0f);
}
@Override
public void onRenderForeground() {
GL11.glPopMatrix();
}
};
@Override
public void onRenderForeground() {
GL11.glPopMatrix();
}
};
for (IChromosomeType chromo : system.getActiveKaryotype()) {
IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo);
String alleleName = system.getAlleleName(chromo, allele);
float height = CraftGUI.render.textHeight(alleleName, w() / 2.0f - 2.0f);
new ControlText(scaled, new IArea(0.0f, y + (height - 9.0f) / 2.0f, w() / 2.0f - 2.0f, 0.0f), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT)
.setColor(getColor());
new ControlText(scaled, new IArea(w() / 2.0f + 2.0f, y, w() / 2.0f - 2.0f, 0.0f), alleleName, TextJustification.TOP_LEFT)
.setColor(getColor());
y += (int) (3.0f + height);
}
setSize(new IPoint(w(), y + 8));
}
for (IChromosomeType chromo : system.getActiveKaryotype()) {
IAllele allele = active
? ind.getGenome().getActiveAllele(chromo)
: ind.getGenome().getInactiveAllele(chromo);
String alleleName = system.getAlleleName(chromo, allele);
float height = CraftGUI.render.textHeight(alleleName, w() / 2.0f - 2.0f);
new ControlText(
scaled,
new IArea(0.0f, y + (height - 9.0f) / 2.0f, w() / 2.0f - 2.0f, 0.0f),
system.getChromosomeShortName(chromo) + " :",
TextJustification.TOP_RIGHT)
.setColor(getColor());
new ControlText(
scaled,
new IArea(w() / 2.0f + 2.0f, y, w() / 2.0f - 2.0f, 0.0f),
alleleName,
TextJustification.TOP_LEFT)
.setColor(getColor());
y += (int) (3.0f + height);
}
setSize(new IPoint(w(), y + 8));
}
@Override
public String getTitle() {
if (active) {
return I18N.localise("genetics.gui.analyst.genome.active");
}
return I18N.localise("genetics.gui.analyst.genome.inactive");
}
@Override
public String getTitle() {
if (active) {
return I18N.localise("genetics.gui.analyst.genome.active");
}
return I18N.localise("genetics.gui.analyst.genome.inactive");
}
}
@@ -11,53 +11,62 @@ import forestry.api.genetics.IIndividual;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageGrowth extends ControlAnalystPage {
public AnalystPageGrowth(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x333333);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
public AnalystPageGrowth(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x333333);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
if (ind instanceof ITree) {
ITree tree = (ITree) ind;
int mat = tree.getGenome().getMaturationTime();
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature"))
.setColor(getColor());
y += 12;
if (ind instanceof ITree) {
ITree tree = (ITree) ind;
int mat = tree.getGenome().getMaturationTime();
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature")).setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getTimeString(1373.3999f * mat))
.setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.BOLD + getTimeString(1373.3999f * mat))
.setColor(getColor());
y += 22;
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT));
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height", alleleName))
.setColor(getColor());
y += 22;
String alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(
EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT));
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height", alleleName))
.setColor(getColor());
y += 12;
alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH));
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth", alleleName))
.setColor(getColor());
y += 12;
alleleName = Binnie.Genetics.treeBreedingSystem.getAlleleName(
EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH));
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth", alleleName))
.setColor(getColor());
y += 20;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.conditions"))
.setColor(getColor());
y += 20;
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.conditions"))
.setColor(getColor());
y += 12;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + tree.getGenome().getGrowthProvider().getDescription())
.setColor(getColor());
y += 12;
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC
+ tree.getGenome().getGrowthProvider().getDescription())
.setColor(getColor());
y += 12;
for (String s : tree.getGenome().getGrowthProvider().getInfo()) {
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + s)
.setColor(getColor());
y += 12;
}
}
}
y += 12;
for (String s : tree.getGenome().getGrowthProvider().getInfo()) {
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + s).setColor(getColor());
y += 12;
}
}
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.growth");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.growth");
}
}
@@ -13,37 +13,44 @@ import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageKaryogram extends ControlAnalystPage {
public AnalystPageKaryogram(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x9933ff);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
public AnalystPageKaryogram(IWidget parent, IArea area, IIndividual ind) {
super(parent, area);
setColor(0x9933ff);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 24;
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
BreedingSystem system = Binnie.Genetics.getSystem(root);
int maxBiomePerLine = (int) ((w() + 4.0f - 16.0f) / 22.0f);
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 (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) {
rem -= maxBiomePerLine - 1;
if (rem < maxBiomePerLine) {
karygramX += (maxBiomePerLine - 1 - rem) * 22 / 2.0f;
}
dx = 0;
dy += 28;
}
}
}
y += 24;
ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind.getClass());
BreedingSystem system = Binnie.Genetics.getSystem(root);
int maxBiomePerLine = (int) ((w() + 4.0f - 16.0f) / 22.0f);
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 (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) {
rem -= maxBiomePerLine - 1;
if (rem < maxBiomePerLine) {
karygramX += (maxBiomePerLine - 1 - rem) * 22 / 2.0f;
}
dx = 0;
dy += 28;
}
}
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.karyogram");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.karyogram");
}
}
@@ -23,255 +23,293 @@ import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.IMutation;
import forestry.apiculture.genetics.BeeDefinition;
import java.util.Collection;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import java.util.Collection;
public class AnalystPageMutations extends ControlAnalystPage {
public AnalystPageMutations(IWidget parent, IArea area, IIndividual ind, boolean isMaster) {
super(parent, area);
setColor(0x333300);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
public AnalystPageMutations(IWidget parent, IArea area, IIndividual ind, boolean isMaster) {
super(parent, area);
setColor(0x333300);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 18;
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary();
Collection<IMutation> resultant = system.getResultantMutations(speciesCurrent);
Collection<IMutation> further = system.getFurtherMutations(speciesCurrent);
if (ind instanceof IBee) {
ItemStack hive = null;
IAlleleSpecies primary = ind.getGenome().getPrimary();
if (primary == ExtraBeeDefinition.WATER) {
hive = new ItemStack(ExtraBees.hive, 1, 0);
} else if (primary == ExtraBeeDefinition.ROCK) {
hive = new ItemStack(ExtraBees.hive, 1, 1);
} else if (primary == ExtraBeeDefinition.BASALT) {
hive = new ItemStack(ExtraBees.hive, 1, 2);
} else if (primary == BeeDefinition.FOREST.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 1);
} else if (primary == BeeDefinition.MEADOWS.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 2);
} else if (primary == BeeDefinition.MODEST.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 3);
} else if (primary == BeeDefinition.TROPICAL.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 4);
} else if (primary == BeeDefinition.ENDED.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 5);
} else if (primary == BeeDefinition.WINTRY.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 6);
} else if (primary == BeeDefinition.MARSHY.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 7);
} else if (primary == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
hive = new ItemStack(Blocks.chest);
}
y += 18;
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary();
Collection<IMutation> resultant = system.getResultantMutations(speciesCurrent);
Collection<IMutation> further = system.getFurtherMutations(speciesCurrent);
if (ind instanceof IBee) {
ItemStack hive = null;
IAlleleSpecies primary = ind.getGenome().getPrimary();
if (primary == ExtraBeeDefinition.WATER) {
hive = new ItemStack(ExtraBees.hive, 1, 0);
} else if (primary == ExtraBeeDefinition.ROCK) {
hive = new ItemStack(ExtraBees.hive, 1, 1);
} else if (primary == ExtraBeeDefinition.BASALT) {
hive = new ItemStack(ExtraBees.hive, 1, 2);
} else if (primary == BeeDefinition.FOREST.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 1);
} else if (primary == BeeDefinition.MEADOWS.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 2);
} else if (primary == BeeDefinition.MODEST.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 3);
} else if (primary == BeeDefinition.TROPICAL.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 4);
} else if (primary == BeeDefinition.ENDED.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 5);
} else if (primary == BeeDefinition.WINTRY.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 6);
} else if (primary == BeeDefinition.MARSHY.getGenome().getPrimary()) {
hive = new ItemStack(Mods.forestry.block("beehives"), 1, 7);
} else if (primary == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
hive = new ItemStack(Blocks.chest);
}
if (ind.getGenome().getPrimary() == BeeDefinition.VALIANT.getGenome().getPrimary()) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
if (ind.getGenome().getPrimary()
== BeeDefinition.VALIANT.getGenome().getPrimary()) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
y += 10;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.habitat.any"))
.setColor(getColor());
y += 22;
} else if (ind.getGenome().getPrimary() == BeeDefinition.MONASTIC.getGenome().getPrimary()) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
y += 10;
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.habitat.any"))
.setColor(getColor());
y += 22;
} else if (ind.getGenome().getPrimary()
== BeeDefinition.MONASTIC.getGenome().getPrimary()) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
y += 10;
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.habitat.villagers"))
.setColor(getColor());
y += 22;
} else if (hive != null) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
y += 10;
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC
+ I18N.localise("genetics.gui.analyst.mutations.habitat.villagers"))
.setColor(getColor());
y += 22;
} else if (hive != null) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.habitat"))
.setColor(getColor());
y += 10;
ControlItemDisplay display = new ControlItemDisplay(this, (w() - 16.0f) / 2.0f, y);
if (ind.getGenome().getPrimary() == BeeDefinition.STEADFAST.getGenome().getPrimary()) {
display.addTooltip(I18N.localise("genetics.gui.analyst.mutations.habitat.chest"));
} else {
display.setTooltip();
}
y += 10;
ControlItemDisplay display = new ControlItemDisplay(this, (w() - 16.0f) / 2.0f, y);
if (ind.getGenome().getPrimary()
== BeeDefinition.STEADFAST.getGenome().getPrimary()) {
display.addTooltip(I18N.localise("genetics.gui.analyst.mutations.habitat.chest"));
} else {
display.setTooltip();
}
display.setItemStack(hive);
y += 24;
}
}
display.setItemStack(hive);
y += 24;
}
}
float ox = (w() - 88.0f - 8.0f) / 2.0f;
float dx = 0.0f;
float ox = (w() - 88.0f - 8.0f) / 2.0f;
float dx = 0.0f;
if (!resultant.isEmpty()) {
if (resultant.size() == 1) {
ox = (w() - 44.0f) / 2.0f;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultantMutations"))
.setColor(getColor());
if (!resultant.isEmpty()) {
if (resultant.size() == 1) {
ox = (w() - 44.0f) / 2.0f;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultantMutations"))
.setColor(getColor());
y += 10;
for (IMutation mutation : resultant) {
float specificChance = getSpecificChance(mutation, system);
if (!isMaster && !isKnown(system, mutation)) {
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
} else {
new Control(this, ox + dx, y, 44.0f, 16.0f) {
@Override
public void initialise() {
IAlleleSpecies species0 = mutation.getAllele0();
IAlleleSpecies species2 = mutation.getAllele1();
String comb = species0.getName() + " + " + species2.getName();
addTooltip(comb);
String chance = getMutationColor(mutation.getBaseChance()).getCode() + I18N.localise("genetics.gui.analyst.mutations.chance", (int) mutation.getBaseChance());
if (specificChance != mutation.getBaseChance()) {
chance += getMutationColor(specificChance).getCode() + " " + I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance);
}
y += 10;
for (IMutation mutation : resultant) {
float specificChance = getSpecificChance(mutation, system);
if (!isMaster && !isKnown(system, mutation)) {
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
} else {
new Control(this, ox + dx, y, 44.0f, 16.0f) {
@Override
public void initialise() {
IAlleleSpecies species0 = mutation.getAllele0();
IAlleleSpecies species2 = mutation.getAllele1();
String comb = species0.getName() + " + " + species2.getName();
addTooltip(comb);
String chance =
getMutationColor(mutation.getBaseChance()).getCode()
+ I18N.localise("genetics.gui.analyst.mutations.chance", (int)
mutation.getBaseChance());
if (specificChance != mutation.getBaseChance()) {
chance += getMutationColor(specificChance).getCode() + " "
+ I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance);
}
addTooltip(chance);
for (String s : mutation.getSpecialConditions()) {
addTooltip(s);
}
}
addTooltip(chance);
for (String s : mutation.getSpecialConditions()) {
addTooltip(s);
}
}
@Override
public void onRenderBackground() {
CraftGUI.render.item(new IPoint(0.0f, 0.0f), system.getDefaultMember(mutation.getAllele0().getUID()));
CraftGUI.render.item(new IPoint(28.0f, 0.0f), system.getDefaultMember(mutation.getAllele1().getUID()));
if (specificChance != mutation.getBaseChance()) {
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd0.getIcon());
CraftGUI.render.color(getMutationColor(specificChance).getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd1.getIcon());
} else {
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd.getIcon());
}
}
};
}
dx = 52.0f - dx;
if (dx == 0.0f || resultant.size() == 1) {
y += 18;
}
}
@Override
public void onRenderBackground() {
CraftGUI.render.item(
new IPoint(0.0f, 0.0f),
system.getDefaultMember(
mutation.getAllele0().getUID()));
CraftGUI.render.item(
new IPoint(28.0f, 0.0f),
system.getDefaultMember(
mutation.getAllele1().getUID()));
if (specificChance != mutation.getBaseChance()) {
CraftGUI.render.color(getMutationColor(mutation.getBaseChance())
.getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd0.getIcon());
CraftGUI.render.color(
getMutationColor(specificChance).getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd1.getIcon());
} else {
CraftGUI.render.color(getMutationColor(mutation.getBaseChance())
.getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconAdd.getIcon());
}
}
};
}
dx = 52.0f - dx;
if (dx == 0.0f || resultant.size() == 1) {
y += 18;
}
}
if (dx != 0.0f && resultant.size() != 1) {
y += 18;
}
y += 10;
}
if (dx != 0.0f && resultant.size() != 1) {
y += 18;
}
y += 10;
}
ox = (w() - 88.0f - 8.0f) / 2.0f;
dx = 0.0f;
if (!further.isEmpty()) {
if (further.size() == 1) {
ox = (w() - 44.0f) / 2.0f;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.furtherMutations"))
.setColor(getColor());
ox = (w() - 88.0f - 8.0f) / 2.0f;
dx = 0.0f;
if (!further.isEmpty()) {
if (further.size() == 1) {
ox = (w() - 44.0f) / 2.0f;
}
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.furtherMutations"))
.setColor(getColor());
y += 10;
for (IMutation mutation : further) {
IAllele speciesComb = mutation.getPartner(speciesCurrent);
float specificChance2 = getSpecificChance(mutation, system);
if (!isMaster && !isKnown(system, mutation)) {
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
} else {
new Control(this, ox + dx, y, 44.0f, 16.0f) {
@Override
public void initialise() {
IAlleleSpecies species0 = (IAlleleSpecies) speciesComb;
IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0];
addTooltip(species2.getName());
String comb = speciesCurrent.getName() + " + " + species0.getName();
addTooltip(comb);
String chance = getMutationColor(mutation.getBaseChance()).getCode() + I18N.localise("genetics.gui.analyst.mutations.chance", (int) mutation.getBaseChance());
if (specificChance2 != mutation.getBaseChance()) {
chance = chance + getMutationColor(specificChance2).getCode() + " " + I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance2);
}
addTooltip(chance);
for (String s : mutation.getSpecialConditions()) {
addTooltip(s);
}
}
y += 10;
for (IMutation mutation : further) {
IAllele speciesComb = mutation.getPartner(speciesCurrent);
float specificChance2 = getSpecificChance(mutation, system);
if (!isMaster && !isKnown(system, mutation)) {
new ControlUnknownMutation(this, ox + dx, y, 44.0f, 16.0f);
} else {
new Control(this, ox + dx, y, 44.0f, 16.0f) {
@Override
public void initialise() {
IAlleleSpecies species0 = (IAlleleSpecies) speciesComb;
IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0];
addTooltip(species2.getName());
String comb = speciesCurrent.getName() + " + " + species0.getName();
addTooltip(comb);
String chance =
getMutationColor(mutation.getBaseChance()).getCode()
+ I18N.localise("genetics.gui.analyst.mutations.chance", (int)
mutation.getBaseChance());
if (specificChance2 != mutation.getBaseChance()) {
chance = chance
+ getMutationColor(specificChance2).getCode() + " "
+ I18N.localise("genetics.gui.analyst.mutations.chance", (int) specificChance2);
}
addTooltip(chance);
for (String s : mutation.getSpecialConditions()) {
addTooltip(s);
}
}
@Override
public void onRenderBackground() {
CraftGUI.render.item(new IPoint(0.0f, 0.0f), system.getDefaultMember(speciesComb.getUID()));
CraftGUI.render.item(new IPoint(28.0f, 0.0f), system.getDefaultMember(mutation.getTemplate()[0].getUID()));
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
if (specificChance2 != mutation.getBaseChance()) {
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow0.getIcon());
CraftGUI.render.color(getMutationColor(specificChance2).getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow1.getIcon());
} else {
CraftGUI.render.color(getMutationColor(mutation.getBaseChance()).getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow.getIcon());
}
}
};
}
@Override
public void onRenderBackground() {
CraftGUI.render.item(new IPoint(0.0f, 0.0f), system.getDefaultMember(speciesComb.getUID()));
CraftGUI.render.item(
new IPoint(28.0f, 0.0f),
system.getDefaultMember(mutation.getTemplate()[0].getUID()));
CraftGUI.render.color(
getMutationColor(mutation.getBaseChance()).getColor());
if (specificChance2 != mutation.getBaseChance()) {
CraftGUI.render.color(getMutationColor(mutation.getBaseChance())
.getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow0.getIcon());
CraftGUI.render.color(
getMutationColor(specificChance2).getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow1.getIcon());
} else {
CraftGUI.render.color(getMutationColor(mutation.getBaseChance())
.getColor());
CraftGUI.render.iconItem(new IPoint(14.0f, 0.0f), ModuleItem.iconArrow.getIcon());
}
}
};
}
dx = 52.0f - dx;
if (dx == 0.0f || further.size() == 1) {
y += 18;
}
}
dx = 52.0f - dx;
if (dx == 0.0f || further.size() == 1) {
y += 18;
}
}
if (dx != 0.0f && further.size() != 1) {
y += 18;
}
}
y += 8;
setSize(new IPoint(w(), y));
}
if (dx != 0.0f && further.size() != 1) {
y += 18;
}
}
y += 8;
setSize(new IPoint(w(), y));
}
private boolean isKnown(BreedingSystem system, IMutation mutation) {
return system.getDiscoveredMutations(getWindow().getWorld(), 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(IMutation mutation, BreedingSystem system) {
return system.getChance(mutation, getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1());
}
private float getSpecificChance(IMutation mutation, BreedingSystem system) {
return system.getChance(mutation, getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1());
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.mutations");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.mutations");
}
protected EnumColor getMutationColor(float percent) {
if (percent >= 20.0f) {
return EnumColor.DarkGreen;
}
if (percent >= 15.0f) {
return EnumColor.Green;
}
if (percent >= 10.0f) {
return EnumColor.Yellow;
}
if (percent >= 5.0f) {
return EnumColor.Gold;
}
if (percent > 0.0f) {
return EnumColor.Red;
}
return EnumColor.DarkRed;
}
protected EnumColor getMutationColor(float percent) {
if (percent >= 20.0f) {
return EnumColor.DarkGreen;
}
if (percent >= 15.0f) {
return EnumColor.Green;
}
if (percent >= 10.0f) {
return EnumColor.Yellow;
}
if (percent >= 5.0f) {
return EnumColor.Gold;
}
if (percent > 0.0f) {
return EnumColor.Red;
}
return EnumColor.DarkRed;
}
static class ControlUnknownMutation extends Control {
public ControlUnknownMutation(IWidget parent, float x, float y, float w, float h) {
super(parent, x, y, w, h);
addAttribute(WidgetAttribute.MOUSE_OVER);
addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknownMutation"));
}
static class ControlUnknownMutation extends Control {
public ControlUnknownMutation(IWidget parent, float x, float y, float w, float h) {
super(parent, x, y, w, h);
addAttribute(WidgetAttribute.MOUSE_OVER);
addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknownMutation"));
}
@Override
public void onRenderBackground() {
CraftGUI.render.text(getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 0xaaaaaa);
}
}
@Override
public void onRenderBackground() {
CraftGUI.render.text(
getArea(),
TextJustification.MIDDLE_CENTER,
I18N.localise("genetics.gui.analyst.mutations.unknown"),
0xaaaaaa);
}
}
}
@@ -7,6 +7,10 @@ import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
import binnie.core.util.UniqueFluidStackSet;
import binnie.core.util.UniqueItemStackSet;
import forestry.api.recipes.RecipeManagers;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
@@ -17,232 +21,233 @@ 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;
public abstract class AnalystPageProduce extends ControlAnalystPage {
public AnalystPageProduce(IWidget parent, IArea area) {
super(parent, area);
}
public AnalystPageProduce(IWidget parent, IArea area) {
super(parent, area);
}
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(getCrafting(key));
return products;
}
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(getCrafting(key));
return products;
}
public Collection<ItemStack> getCentrifuge(ItemStack stack) {
List<ItemStack> products = new ArrayList<>();
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.centrifugeManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
public Collection<ItemStack> getCentrifuge(ItemStack stack) {
List<ItemStack> products = new ArrayList<>();
for (Map.Entry<Object[], Object[]> recipe :
RecipeManagers.centrifugeManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
if (isRecipe) {
for (Object obj : recipe.getValue()) {
if (obj instanceof ItemStack) {
products.add((ItemStack) obj);
}
}
}
}
return products;
}
if (isRecipe) {
for (Object obj : recipe.getValue()) {
if (obj instanceof ItemStack) {
products.add((ItemStack) obj);
}
}
}
}
return products;
}
public Collection<ItemStack> getSqueezer(ItemStack stack) {
List<ItemStack> products = new ArrayList<>();
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
public Collection<ItemStack> getSqueezer(ItemStack stack) {
List<ItemStack> products = new ArrayList<>();
for (Map.Entry<Object[], Object[]> recipe :
RecipeManagers.squeezerManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
if (isRecipe) {
for (Object obj : recipe.getValue()) {
if (obj instanceof ItemStack) {
products.add((ItemStack) obj);
}
}
}
}
return products;
}
if (isRecipe) {
for (Object obj : recipe.getValue()) {
if (obj instanceof ItemStack) {
products.add((ItemStack) obj);
}
}
}
}
return products;
}
public Collection<ItemStack> getCrafting(ItemStack stack) {
List<ItemStack> products = new ArrayList<>();
for (Object recipeO : CraftingManager.getInstance().getRecipeList()) {
if (recipeO instanceof ShapelessRecipes) {
ShapelessRecipes recipe = (ShapelessRecipes) recipeO;
boolean match = true;
for (Object rec : recipe.recipeItems) {
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
match = false;
}
}
public Collection<ItemStack> getCrafting(ItemStack stack) {
List<ItemStack> products = new ArrayList<>();
for (Object recipeO : CraftingManager.getInstance().getRecipeList()) {
if (recipeO instanceof ShapelessRecipes) {
ShapelessRecipes recipe = (ShapelessRecipes) recipeO;
boolean match = true;
for (Object rec : recipe.recipeItems) {
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
match = false;
}
}
if (match) {
products.add(recipe.getRecipeOutput());
}
}
if (match) {
products.add(recipe.getRecipeOutput());
}
}
if (recipeO instanceof ShapedRecipes) {
ShapedRecipes recipe2 = (ShapedRecipes) recipeO;
boolean match = true;
for (Object rec2 : recipe2.recipeItems) {
if (rec2 != null && (!(rec2 instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec2))) {
match = false;
}
}
if (recipeO instanceof ShapedRecipes) {
ShapedRecipes recipe2 = (ShapedRecipes) recipeO;
boolean match = true;
for (Object rec2 : recipe2.recipeItems) {
if (rec2 != null && (!(rec2 instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec2))) {
match = false;
}
}
if (match) {
products.add(recipe2.getRecipeOutput());
}
}
if (match) {
products.add(recipe2.getRecipeOutput());
}
}
if (recipeO instanceof ShapelessOreRecipe) {
ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO;
boolean match = true;
for (Object rec : recipe3.getInput()) {
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
match = false;
}
}
if (recipeO instanceof ShapelessOreRecipe) {
ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO;
boolean match = true;
for (Object rec : recipe3.getInput()) {
if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) {
match = false;
}
}
if (!match) {
continue;
}
products.add(recipe3.getRecipeOutput());
}
}
return products;
}
if (!match) {
continue;
}
products.add(recipe3.getRecipeOutput());
}
}
return products;
}
public Collection<FluidStack> getAllFluids(ItemStack stack) {
List<FluidStack> products = new ArrayList<>();
products.addAll(getSqueezerFluid(stack));
return products;
}
public Collection<FluidStack> getAllFluids(ItemStack stack) {
List<FluidStack> products = new ArrayList<>();
products.addAll(getSqueezerFluid(stack));
return products;
}
public Collection<FluidStack> getSqueezerFluid(ItemStack stack) {
List<FluidStack> products = new ArrayList<>();
for (Map.Entry<Object[], Object[]> recipe : RecipeManagers.squeezerManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
public Collection<FluidStack> getSqueezerFluid(ItemStack stack) {
List<FluidStack> products = new ArrayList<>();
for (Map.Entry<Object[], Object[]> recipe :
RecipeManagers.squeezerManager.getRecipes().entrySet()) {
boolean isRecipe = false;
for (Object obj : recipe.getKey()) {
if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) {
isRecipe = true;
}
}
if (isRecipe) {
for (Object obj : recipe.getValue()) {
if (obj instanceof FluidStack) {
products.add((FluidStack) obj);
}
}
}
}
return products;
}
if (isRecipe) {
for (Object obj : recipe.getValue()) {
if (obj instanceof FluidStack) {
products.add((FluidStack) obj);
}
}
}
}
return products;
}
protected Collection<? extends FluidStack> getAllProducts(FluidStack stack) {
return new UniqueFluidStackSet();
}
protected Collection<? extends FluidStack> getAllProducts(FluidStack stack) {
return new UniqueFluidStackSet();
}
protected Collection<ItemStack> getAllProductsAndFluids(Collection<ItemStack> collection) {
Collection<ItemStack> products = new UniqueItemStackSet();
for (ItemStack stack : collection) {
products.addAll(getAllProducts(stack));
}
protected Collection<ItemStack> getAllProductsAndFluids(Collection<ItemStack> collection) {
Collection<ItemStack> products = new UniqueItemStackSet();
for (ItemStack stack : collection) {
products.addAll(getAllProducts(stack));
}
Collection<ItemStack> products2 = new UniqueItemStackSet();
for (ItemStack stack2 : products) {
products2.addAll(getAllProducts(stack2));
}
Collection<ItemStack> products2 = new UniqueItemStackSet();
for (ItemStack stack2 : products) {
products2.addAll(getAllProducts(stack2));
}
Collection<ItemStack> products3 = new UniqueItemStackSet();
for (ItemStack stack3 : products2) {
products3.addAll(getAllProducts(stack3));
}
Collection<ItemStack> products3 = new UniqueItemStackSet();
for (ItemStack stack3 : products2) {
products3.addAll(getAllProducts(stack3));
}
products.addAll(products2);
products.addAll(products3);
Collection<FluidStack> allFluids = new UniqueFluidStackSet();
for (ItemStack stack4 : collection) {
allFluids.addAll(getAllFluids(stack4));
}
products.addAll(products2);
products.addAll(products3);
Collection<FluidStack> allFluids = new UniqueFluidStackSet();
for (ItemStack stack4 : collection) {
allFluids.addAll(getAllFluids(stack4));
}
Collection<FluidStack> fluids2 = new UniqueFluidStackSet();
for (FluidStack stack5 : allFluids) {
fluids2.addAll(getAllProducts(stack5));
}
Collection<FluidStack> fluids2 = new UniqueFluidStackSet();
for (FluidStack stack5 : allFluids) {
fluids2.addAll(getAllProducts(stack5));
}
Collection<FluidStack> fluids3 = new UniqueFluidStackSet();
for (FluidStack stack6 : fluids2) {
fluids3.addAll(getAllProducts(stack6));
}
Collection<FluidStack> fluids3 = new UniqueFluidStackSet();
for (FluidStack stack6 : fluids2) {
fluids3.addAll(getAllProducts(stack6));
}
allFluids.addAll(fluids2);
allFluids.addAll(fluids3);
for (FluidStack fluid : allFluids) {
ItemStack container = null;
for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle)) && data.fluid.isFluidEqual(fluid)) {
container = data.filledContainer;
break;
}
allFluids.addAll(fluids2);
allFluids.addAll(fluids3);
for (FluidStack fluid : allFluids) {
ItemStack container = null;
for (FluidContainerRegistry.FluidContainerData data :
FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle))
&& data.fluid.isFluidEqual(fluid)) {
container = data.filledContainer;
break;
}
if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket)) && data.fluid.isFluidEqual(fluid)) {
container = data.filledContainer;
break;
}
if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket)) && data.fluid.isFluidEqual(fluid)) {
container = data.filledContainer;
break;
}
if (data.fluid.isFluidEqual(fluid)) {
container = data.filledContainer;
break;
}
}
if (container != null) {
products.add(container);
}
}
return products;
}
if (data.fluid.isFluidEqual(fluid)) {
container = data.filledContainer;
break;
}
}
if (container != null) {
products.add(container);
}
}
return products;
}
protected int getRefined(String string, int y, Collection<ItemStack> products) {
new ControlTextCentered(this, y, string).setColor(getColor());
y += 10;
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 (ItemStack soilStack : products) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
protected int getRefined(String string, int y, Collection<ItemStack> products) {
new ControlTextCentered(this, y, string).setColor(getColor());
y += 10;
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 (ItemStack soilStack : products) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(soilStack);
soilStack.stackSize = 1;
ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null);
if (fluid != null) {
display.addTooltip(fluid.getLocalizedName());
}
dx += 18;
}
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(soilStack);
soilStack.stackSize = 1;
ControlItemDisplay display =
new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null);
if (fluid != null) {
display.addTooltip(fluid.getLocalizedName());
}
dx += 18;
}
if (dx != 0) {
dy += 18;
}
return y + dy;
}
if (dx != 0) {
dy += 18;
}
return y + dy;
}
}
@@ -17,6 +17,10 @@ import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IBee;
import forestry.api.apiculture.IBeeGenome;
import forestry.plugins.PluginApiculture;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -24,183 +28,188 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public class AnalystPageProducts extends AnalystPageProduce {
public AnalystPageProducts(IWidget parent, IArea area, IBee ind) {
super(parent, area);
setColor(0xcc3300);
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 + getTitle())
.setColor(getColor());
public AnalystPageProducts(IWidget parent, IArea area, IBee ind) {
super(parent, area);
setColor(0xcc3300);
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 + getTitle()).setColor(getColor());
y += 12;
String alleleName = Binnie.Genetics.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED));
new ControlTextCentered(this, y, EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.produce.rate", alleleName))
.setColor(getColor());
y += 12;
String alleleName = Binnie.Genetics.beeBreedingSystem.getAlleleName(
EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED));
new ControlTextCentered(
this,
y,
EnumChatFormatting.ITALIC + I18N.localise("genetics.gui.analyst.produce.rate", alleleName))
.setColor(getColor());
y += 20;
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
Collection<ItemStack> productList = new UniqueItemStackSet();
Map<ItemStack, Float> products = new HashMap<>();
products.putAll(genome.getPrimary().getProductChances());
products.putAll(genome.getSecondary().getProductChances());
if (!products.isEmpty()) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.natural"))
.setColor(getColor());
y += 20;
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
Collection<ItemStack> productList = new UniqueItemStackSet();
Map<ItemStack, Float> products = new HashMap<>();
products.putAll(genome.getPrimary().getProductChances());
products.putAll(genome.getSecondary().getProductChances());
if (!products.isEmpty()) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.natural"))
.setColor(getColor());
y += 12;
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
if (!productList.add(entry.getKey())) {
continue;
}
refinedProducts.addAll(getAllProducts(entry.getKey()));
createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed);
y += 18;
}
y += 12;
}
y += 12;
for (Map.Entry<ItemStack, Float> entry : products.entrySet()) {
if (!productList.add(entry.getKey())) {
continue;
}
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, I18N.localise("genetics.gui.analyst.produce.speciality")).setColor(getColor());
y += 12;
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;
}
products = genome.getPrimary().getSpecialtyChances();
if (!products.isEmpty()) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.speciality"))
.setColor(getColor());
y += 12;
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, I18N.localise("genetics.gui.analyst.produce.refined"))
.setColor(getColor());
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.produce.refined")).setColor(getColor());
y += 12;
Collection<ItemStack> level2Products = new UniqueItemStackSet();
for (ItemStack stack : refinedProducts) {
level2Products.addAll(getAllProducts(stack));
}
y += 12;
Collection<ItemStack> level2Products = new UniqueItemStackSet();
for (ItemStack stack : refinedProducts) {
level2Products.addAll(getAllProducts(stack));
}
refinedProducts.addAll(level2Products);
level2Products = new UniqueItemStackSet();
for (ItemStack stack : refinedProducts) {
level2Products.addAll(getAllProducts(stack));
}
refinedProducts.addAll(level2Products);
level2Products = new UniqueItemStackSet();
for (ItemStack stack : refinedProducts) {
level2Products.addAll(getAllProducts(stack));
}
refinedProducts.addAll(level2Products);
Collection<FluidStack> allFluids = new ArrayList<>();
for (ItemStack stack2 : refinedProducts) {
for (FluidStack addition : getAllFluids(stack2)) {
boolean alreadyIn = false;
for (FluidStack existing : allFluids) {
if (existing.isFluidEqual(addition)) {
alreadyIn = true;
}
}
if (!alreadyIn) {
allFluids.add(addition);
}
}
}
refinedProducts.addAll(level2Products);
Collection<FluidStack> allFluids = new ArrayList<>();
for (ItemStack stack2 : refinedProducts) {
for (FluidStack addition : getAllFluids(stack2)) {
boolean alreadyIn = false;
for (FluidStack existing : allFluids) {
if (existing.isFluidEqual(addition)) {
alreadyIn = true;
}
}
if (!alreadyIn) {
allFluids.add(addition);
}
}
}
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 (ItemStack soilStack : refinedProducts) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy);
display.setItemStack(soilStack);
display.setTooltip();
dx += 18;
}
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 (ItemStack soilStack : refinedProducts) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy);
display.setItemStack(soilStack);
display.setTooltip();
dx += 18;
}
for (FluidStack soilStack2 : allFluids) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
for (FluidStack soilStack2 : allFluids) {
if (dx >= 18 * maxBiomePerLine) {
dx = 0;
dy += 18;
}
ItemStack container = null;
for (FluidContainerRegistry.FluidContainerData data : FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle)) && data.fluid.isFluidEqual(soilStack2)) {
container = data.filledContainer;
break;
}
ItemStack container = null;
for (FluidContainerRegistry.FluidContainerData data :
FluidContainerRegistry.getRegisteredFluidContainerData()) {
if (data.emptyContainer.isItemEqual(new ItemStack(Items.glass_bottle))
&& data.fluid.isFluidEqual(soilStack2)) {
container = data.filledContainer;
break;
}
if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket)) && data.fluid.isFluidEqual(soilStack2)) {
container = data.filledContainer;
break;
}
if (data.emptyContainer.isItemEqual(new ItemStack(Items.bucket))
&& data.fluid.isFluidEqual(soilStack2)) {
container = data.filledContainer;
break;
}
if (data.fluid.isFluidEqual(soilStack2)) {
container = data.filledContainer;
break;
}
}
if (data.fluid.isFluidEqual(soilStack2)) {
container = data.filledContainer;
break;
}
}
if (container == null) {
ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy);
display2.setItemStack(soilStack2);
display2.setTooltip();
} else {
ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy);
display3.setItemStack(container);
display3.setTooltip();
}
dx += 18;
}
setSize(new IPoint(w(), y + dy + 18 + 8));
}
if (container == null) {
ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy);
display2.setItemStack(soilStack2);
display2.setTooltip();
} else {
ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy);
display3.setItemStack(container);
display3.setTooltip();
}
dx += 18;
}
setSize(new IPoint(w(), y + dy + 18 + 8));
}
private void createProductEntry(ItemStack key, Float value, int y, float speed) {
ControlItemDisplay item = new ControlItemDisplay(this, 16.0f, y) {
@Override
public void getTooltip(Tooltip tooltip) {
super.getTooltip(tooltip);
Collection<ItemStack> products = getCentrifuge(key);
if (!products.isEmpty()) {
tooltip.add(I18N.localise("genetics.gui.analyst.produce.centrifuge") + " ");
for (ItemStack prod : products) {
NBTTagCompound nbt = new NBTTagCompound();
prod.writeToNBT(nbt);
tooltip.add(prod, prod.getDisplayName());
}
}
private void createProductEntry(ItemStack key, Float value, int y, float speed) {
ControlItemDisplay item = new ControlItemDisplay(this, 16.0f, y) {
@Override
public void getTooltip(Tooltip tooltip) {
super.getTooltip(tooltip);
Collection<ItemStack> products = getCentrifuge(key);
if (!products.isEmpty()) {
tooltip.add(I18N.localise("genetics.gui.analyst.produce.centrifuge") + " ");
for (ItemStack prod : products) {
NBTTagCompound nbt = new NBTTagCompound();
prod.writeToNBT(nbt);
tooltip.add(prod, prod.getDisplayName());
}
}
Collection<ItemStack> liquids = getSqueezer(key);
if (!liquids.isEmpty()) {
tooltip.add(I18N.localise("genetics.gui.analyst.produce.squeezes") + " ");
for (ItemStack prod2 : liquids) {
NBTTagCompound nbt2 = new NBTTagCompound();
prod2.writeToNBT(nbt2);
tooltip.add(prod2, prod2.getDisplayName());
}
}
}
};
Collection<ItemStack> liquids = getSqueezer(key);
if (!liquids.isEmpty()) {
tooltip.add(I18N.localise("genetics.gui.analyst.produce.squeezes") + " ");
for (ItemStack prod2 : liquids) {
NBTTagCompound nbt2 = new NBTTagCompound();
prod2.writeToNBT(nbt2);
tooltip.add(prod2, prod2.getDisplayName());
}
}
}
};
item.setTooltip();
ControlText textWidget = new ControlTextCentered(this, y + 4, "");
textWidget.setColor(getColor());
CraftGUIUtil.moveWidget(textWidget, new IPoint(12.0f, 0.0f));
item.setItemStack(key);
float time = (int) (PluginApiculture.ticksPerBeeWorkCycle / (speed * value));
textWidget.setValue(I18N.localise("genetics.gui.analyst.produce.everyTime", getTimeString(time)));
}
item.setTooltip();
ControlText textWidget = new ControlTextCentered(this, y + 4, "");
textWidget.setColor(getColor());
CraftGUIUtil.moveWidget(textWidget, new IPoint(12.0f, 0.0f));
item.setItemStack(key);
float time = (int) (PluginApiculture.ticksPerBeeWorkCycle / (speed * value));
textWidget.setValue(I18N.localise("genetics.gui.analyst.produce.everyTime", getTimeString(time)));
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.produce");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.produce");
}
}
@@ -15,139 +15,157 @@ import binnie.core.genetics.Tolerance;
import binnie.core.util.I18N;
import binnie.genetics.genetics.AlleleHelper;
import forestry.api.genetics.EnumTolerance;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageSoil extends ControlAnalystPage {
public AnalystPageSoil(IWidget parent, IArea area, IFlower flower) {
super(parent, area);
setColor(0x663300);
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 + getTitle())
.setColor(getColor());
public AnalystPageSoil(IWidget parent, IArea area, IFlower flower) {
super(parent, area);
setColor(0x663300);
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 + getTitle()).setColor(getColor());
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.moistureTolerance"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 16;
new ControlText(
this,
new IArea(4.0f, y, w() - 8.0f, 14.0f),
I18N.localise("genetics.gui.analyst.soil.moistureTolerance"),
TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
createMoisture(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
y += 12;
createMoisture(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.pHTolerance"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 16;
new ControlText(
this,
new IArea(4.0f, y, w() - 8.0f, 14.0f),
I18N.localise("genetics.gui.analyst.soil.pHTolerance"),
TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
createAcidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
y += 12;
createAcidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
y += 16;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.recommendedSoil"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 16;
new ControlText(
this,
new IArea(4.0f, y, w() - 8.0f, 14.0f),
I18N.localise("genetics.gui.analyst.soil.recommendedSoil"),
TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
EnumMoisture recomMoisture = EnumMoisture.NORMAL;
boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol);
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) {
recomMoisture = EnumMoisture.DRY;
}
} else {
if (canTolDry) {
recomMoisture = EnumMoisture.DRY;
} else if (canTolDamp) {
recomMoisture = EnumMoisture.DAMP;
}
}
y += 12;
EnumMoisture recomMoisture = EnumMoisture.NORMAL;
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) {
recomMoisture = EnumMoisture.DRY;
}
} else {
if (canTolDry) {
recomMoisture = EnumMoisture.DRY;
} else if (canTolDamp) {
recomMoisture = EnumMoisture.DAMP;
}
}
EnumAcidity recomPH = EnumAcidity.NEUTRAL;
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) {
recomPH = EnumAcidity.ALKALINE;
}
} else {
if (canTolAcid) {
recomPH = EnumAcidity.ACID;
}
if (canTolAlkaline) {
recomPH = EnumAcidity.ALKALINE;
}
}
EnumAcidity recomPH = EnumAcidity.NEUTRAL;
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) {
recomPH = EnumAcidity.ALKALINE;
}
} else {
if (canTolAcid) {
recomPH = EnumAcidity.ACID;
}
if (canTolAlkaline) {
recomPH = EnumAcidity.ALKALINE;
}
}
ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture));
ControlItemDisplay recomSoil = new ControlItemDisplay(this, (w() - 24.0f) / 2.0f, y, 24.0f);
recomSoil.setItemStack(stack);
recomSoil.setTooltip();
y += 32;
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), I18N.localise("genetics.gui.analyst.soil.otherSoils"), TextJustification.MIDDLE_CENTER)
.setColor(getColor());
ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture));
ControlItemDisplay recomSoil = new ControlItemDisplay(this, (w() - 24.0f) / 2.0f, y, 24.0f);
recomSoil.setItemStack(stack);
recomSoil.setTooltip();
y += 32;
new ControlText(
this,
new IArea(4.0f, y, w() - 8.0f, 14.0f),
I18N.localise("genetics.gui.analyst.soil.otherSoils"),
TextJustification.MIDDLE_CENTER)
.setColor(getColor());
y += 12;
List<ItemStack> stacks = new ArrayList<>();
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)));
}
}
}
y += 12;
List<ItemStack> stacks = new ArrayList<>();
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)));
}
}
}
float soilListWidth = 17 * stacks.size() - 1;
float soilListX = (w() - soilListWidth) / 2.0f;
int t = 0;
for (ItemStack soilStack : stacks) {
ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y);
display.setItemStack(soilStack);
display.setTooltip();
}
}
float soilListWidth = 17 * stacks.size() - 1;
float soilListX = (w() - soilListWidth) / 2.0f;
int t = 0;
for (ItemStack soilStack : stacks) {
ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y);
display.setItemStack(soilStack);
display.setTooltip();
}
}
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(EnumMoisture value) {
return AlleleHelper.toDisplay(value);
}
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(EnumMoisture value) {
return AlleleHelper.toDisplay(value);
}
@Override
protected int getColor(EnumMoisture value) {
return (new int[]{0xccffcc, 0x66ccff, 0x3366ff})[value.ordinal()];
}
}.setValues(value, tol);
}
@Override
protected int getColor(EnumMoisture value) {
return (new int[] {0xccffcc, 0x66ccff, 0x3366ff})[value.ordinal()];
}
}.setValues(value, 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(EnumAcidity value) {
return AlleleHelper.toDisplay(value);
}
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(EnumAcidity value) {
return AlleleHelper.toDisplay(value);
}
@Override
protected int getColor(EnumAcidity value) {
return (new int[]{0xff0066, 0x00ff00, 0x0066ff})[value.ordinal()];
}
}.setValues(value, tol);
}
@Override
protected int getColor(EnumAcidity value) {
return (new int[] {0xff0066, 0x00ff00, 0x0066ff})[value.ordinal()];
}
}.setValues(value, tol);
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.soil");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.soil");
}
}
@@ -8,20 +8,19 @@ import forestry.api.lepidopterology.IButterfly;
import net.minecraft.util.EnumChatFormatting;
public class AnalystPageSpecimen extends ControlAnalystPage {
public AnalystPageSpecimen(IWidget parent, IArea area, IButterfly ind) {
super(parent, area);
setColor(0x333333);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
public AnalystPageSpecimen(IWidget parent, IArea area, IButterfly ind) {
super(parent, area);
setColor(0x333333);
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
float w = (w() - 16.0f) * ind.getSize();
new ControlIndividualDisplay(this, (w() - w) / 2.0f, y + (w() - w) / 2.0f, w, ind);
}
y += 12;
float w = (w() - 16.0f) * ind.getSize();
new ControlIndividualDisplay(this, (w() - w) / 2.0f, y + (w() - w) / 2.0f, w, ind);
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.specimen");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.specimen");
}
}
@@ -14,77 +14,73 @@ import forestry.api.arboriculture.EnumTreeChromosome;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.ITreeGenome;
import forestry.api.genetics.IAlleleBoolean;
import java.util.Collection;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.Collection;
public class AnalystPageWood extends AnalystPageProduce {
public AnalystPageWood(IWidget parent, IArea area, ITree ind) {
super(parent, area);
setColor(0x663300);
ITreeGenome genome = ind.getGenome();
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle())
.setColor(getColor());
y += 12;
public AnalystPageWood(IWidget parent, IArea area, ITree ind) {
super(parent, area);
setColor(0x663300);
ITreeGenome genome = ind.getGenome();
int y = 4;
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + getTitle()).setColor(getColor());
y += 12;
if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) {
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconNoFire.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.wood.fireproof"));
} else {
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconFire.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.wood.flammable"));
}
y += 30;
Collection<ItemStack> products = new UniqueItemStackSet();
if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) {
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconNoFire.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.wood.fireproof"));
} else {
new ControlIconDisplay(this, (w() - 16.0f) / 2.0f, y, ModuleItem.iconFire.getIcon())
.addTooltip(I18N.localise("genetics.gui.analyst.wood.flammable"));
}
y += 30;
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);
}
genome.getPrimary().getGenerator().setLogBlock(genome, FakeWorld.instance, 0, 0, 0, ForgeDirection.UP);
ItemStack stackWood = FakeWorld.instance.getWooLog();
if (stackWood != null) {
products.add(stackWood);
}
// for (ItemStack stack :
// ind.getGenome().getFruitProvider().getProducts()) {
// products.add(stack);
// }
// for (ItemStack stack :
// ind.getGenome().getFruitProvider().getProducts()) {
// products.add(stack);
// }
if (products.size() > 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs"))
.setColor(getColor());
y += 10;
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 (products.size() > 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs")).setColor(getColor());
y += 10;
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;
}
Collection<ItemStack> allProducts = new UniqueItemStackSet();
allProducts.addAll(products);
Collection<ItemStack> allProducts = new UniqueItemStackSet();
allProducts.addAll(products);
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
if (refinedProducts.size() > 0) {
y = getRefined(I18N.localise("genetics.gui.analyst.wood.products"), y, refinedProducts);
y += 8;
}
Collection<ItemStack> refinedProducts = new UniqueItemStackSet();
refinedProducts.addAll(getAllProductsAndFluids(allProducts));
if (refinedProducts.size() > 0) {
y = getRefined(I18N.localise("genetics.gui.analyst.wood.products"), y, refinedProducts);
y += 8;
}
if (products.size() == 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits"))
.setColor(getColor());
y += 28;
}
setSize(new IPoint(w(), y + 8));
}
if (products.size() == 0) {
new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits")).setColor(getColor());
y += 28;
}
setSize(new IPoint(w(), y + 8));
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.wood");
}
@Override
public String getTitle() {
return I18N.localise("genetics.gui.analyst.wood");
}
}
@@ -18,43 +18,52 @@ import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.ISpeciesRoot;
public class ControlAnalystChromosome extends Control implements ITooltip {
IAllele allele0;
IAllele allele1;
IChromosomeType chromosomeType;
ISpeciesRoot root;
Texture Homozygous;
Texture Heterozygous;
IAllele allele0;
IAllele allele1;
IChromosomeType chromosomeType;
ISpeciesRoot root;
Texture Homozygous;
Texture Heterozygous;
public ControlAnalystChromosome(IWidget parent, float x, float y, ISpeciesRoot root, IChromosomeType type, IAllele allele0, IAllele allele1) {
super(parent, x, y, 16.0f, 22.0f);
Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
addAttribute(WidgetAttribute.MOUSE_OVER);
this.root = root;
chromosomeType = type;
this.allele0 = allele0;
this.allele1 = 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);
Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst);
addAttribute(WidgetAttribute.MOUSE_OVER);
this.root = root;
chromosomeType = type;
this.allele0 = allele0;
this.allele1 = allele1;
}
public boolean isHomozygous() {
return allele0.getUID().equals(allele1.getUID());
}
public boolean isHomozygous() {
return allele0.getUID().equals(allele1.getUID());
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
CraftGUI.render.texture(isHomozygous() ? Homozygous : Heterozygous, IPoint.ZERO);
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
CraftGUI.render.texture(isHomozygous() ? Homozygous : Heterozygous, IPoint.ZERO);
}
@Override
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(I18N.localise("genetics.gui.analyst.chromosome.active", system.getAlleleName(chromosomeType, allele0)));
tooltip.add(I18N.localise("genetics.gui.analyst.chromosome.inactive", system.getAlleleName(chromosomeType, allele1)));
}
}
@Override
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(I18N.localise(
"genetics.gui.analyst.chromosome.active", system.getAlleleName(chromosomeType, allele0)));
tooltip.add(I18N.localise(
"genetics.gui.analyst.chromosome.inactive", system.getAlleleName(chromosomeType, allele1)));
}
}
}
@@ -4,33 +4,32 @@ import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.util.I18N;
import java.text.DecimalFormat;
public abstract class ControlAnalystPage extends Control {
public ControlAnalystPage(IWidget parent, IArea area) {
super(parent, area);
hide();
}
public ControlAnalystPage(IWidget parent, IArea area) {
super(parent, area);
hide();
}
@Override
public void onRenderBackground() {
// ignored
}
@Override
public void onRenderBackground() {
// ignored
}
public abstract String getTitle();
public abstract String getTitle();
protected String getTimeString(float time) {
float seconds = time / 20.0f;
float minutes = seconds / 60.0f;
float hours = minutes / 60.0f;
DecimalFormat df = new DecimalFormat("#.#");
if (hours > 1.0f) {
return I18N.localise("genetics.gui.analyst.page.hours", df.format(hours));
}
if (minutes > 1.0f) {
return I18N.localise("genetics.gui.analyst.page.minutes", df.format(minutes));
}
return I18N.localise("genetics.gui.analyst.page.seconds", df.format(seconds));
}
protected String getTimeString(float time) {
float seconds = time / 20.0f;
float minutes = seconds / 60.0f;
float hours = minutes / 60.0f;
DecimalFormat df = new DecimalFormat("#.#");
if (hours > 1.0f) {
return I18N.localise("genetics.gui.analyst.page.hours", df.format(hours));
}
if (minutes > 1.0f) {
return I18N.localise("genetics.gui.analyst.page.minutes", df.format(minutes));
}
return I18N.localise("genetics.gui.analyst.page.seconds", df.format(seconds));
}
}
@@ -12,59 +12,59 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
public class ControlBiome extends Control implements ITooltip {
BiomeGenBase biome;
String iconCategory;
BiomeGenBase biome;
String iconCategory;
public ControlBiome(IWidget parent, float x, float y, float w, float h, BiomeGenBase biome) {
super(parent, x, y, w, h);
this.biome = null;
iconCategory = "plains";
this.biome = biome;
}
public ControlBiome(IWidget parent, float x, float y, float w, float h, BiomeGenBase biome) {
super(parent, x, y, w, h);
this.biome = null;
iconCategory = "plains";
this.biome = biome;
}
@Override
public void onRenderBackground() {
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MOUNTAIN) ||
BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.HILLS)) {
iconCategory = "hills";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)) {
iconCategory = "desert";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
iconCategory = "snow";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
iconCategory = "forest";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SWAMP)) {
iconCategory = "swamp";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.JUNGLE)) {
iconCategory = "jungle";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.COLD) &&
BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
iconCategory = "taiga";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) {
iconCategory = "mushroom";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.OCEAN)) {
iconCategory = "ocean";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) {
iconCategory = "nether";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END)) {
iconCategory = "end";
}
IIcon icon = TextureManager.getInstance().getDefault("habitats/" + iconCategory);
CraftGUI.render.iconItem(IPoint.ZERO, icon);
}
@Override
public void onRenderBackground() {
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MOUNTAIN)
|| BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.HILLS)) {
iconCategory = "hills";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SANDY)) {
iconCategory = "desert";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SNOWY)) {
iconCategory = "snow";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
iconCategory = "forest";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.SWAMP)) {
iconCategory = "swamp";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.JUNGLE)) {
iconCategory = "jungle";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.COLD)
&& BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.FOREST)) {
iconCategory = "taiga";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.MUSHROOM)) {
iconCategory = "mushroom";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.OCEAN)) {
iconCategory = "ocean";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.NETHER)) {
iconCategory = "nether";
}
if (BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END)) {
iconCategory = "end";
}
IIcon icon = TextureManager.getInstance().getDefault("habitats/" + iconCategory);
CraftGUI.render.iconItem(IPoint.ZERO, icon);
}
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add(biome.biomeName.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"));
}
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add(biome.biomeName.replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2"));
}
}
@@ -15,42 +15,42 @@ import binnie.extrabees.core.ExtraBeeTexture;
import forestry.api.genetics.IChromosomeType;
public class ControlChromoPicker extends Control implements ITooltip {
Texture Selected;
Texture Texture;
IChromosomeType type;
ControlChromosome parent;
Texture Selected;
Texture Texture;
IChromosomeType type;
ControlChromosome parent;
public ControlChromoPicker(ControlChromosome parent, float x, float y, IChromosomeType chromo) {
super(parent, x, y, 16.0f, 16.0f);
Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett);
Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett);
type = chromo;
addAttribute(WidgetAttribute.MOUSE_OVER);
this.parent = parent;
addSelfEventHandler(new EventWidget.StartMouseOver.Handler() {
@Override
public void onEvent(EventWidget.StartMouseOver event) {
callEvent(new EventValueChanged<Object>(getWidget(), type));
}
});
addSelfEventHandler(new EventWidget.EndMouseOver.Handler() {
@Override
public void onEvent(EventWidget.EndMouseOver event) {
callEvent(new EventValueChanged<>(getWidget(), null));
}
});
}
public ControlChromoPicker(ControlChromosome parent, float x, float y, IChromosomeType chromo) {
super(parent, x, y, 16.0f, 16.0f);
Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett);
Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett);
type = chromo;
addAttribute(WidgetAttribute.MOUSE_OVER);
this.parent = parent;
addSelfEventHandler(new EventWidget.StartMouseOver.Handler() {
@Override
public void onEvent(EventWidget.StartMouseOver event) {
callEvent(new EventValueChanged<Object>(getWidget(), type));
}
});
addSelfEventHandler(new EventWidget.EndMouseOver.Handler() {
@Override
public void onEvent(EventWidget.EndMouseOver event) {
callEvent(new EventValueChanged<>(getWidget(), null));
}
});
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
boolean selected = isMouseOver();
Texture text = selected ? Selected : Texture;
CraftGUI.render.texture(text, IPoint.ZERO);
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
boolean selected = isMouseOver();
Texture text = selected ? Selected : Texture;
CraftGUI.render.texture(text, IPoint.ZERO);
}
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add(Binnie.Genetics.getSystem(parent.getRoot()).getChromosomeName(type));
}
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add(Binnie.Genetics.getSystem(parent.getRoot()).getChromosomeName(type));
}
}
@@ -17,124 +17,124 @@ import forestry.api.genetics.ISpeciesRoot;
import forestry.api.lepidopterology.EnumButterflyChromosome;
public class ControlChromosome extends Control implements IControlValue<IChromosomeType> {
Texture BeeTexture;
Texture TreeTexture;
Texture MothTexture;
Texture FlowerTexture;
IChromosomeType chromo;
ISpeciesRoot species;
Texture BeeTexture;
Texture TreeTexture;
Texture MothTexture;
Texture FlowerTexture;
IChromosomeType chromo;
ISpeciesRoot species;
public ControlChromosome(IWidget parent, float x, float y) {
super(parent, x, y, 96.0f, 96.0f);
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 ControlChromosome(IWidget parent, float x, float y) {
super(parent, x, y, 96.0f, 96.0f);
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 species;
}
public ISpeciesRoot getRoot() {
return species;
}
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);
new ControlChromoPicker(this, 19.0f, 20.0f, EnumBeeChromosome.LIFESPAN);
new ControlChromoPicker(this, 55.0f, 65.0f, EnumBeeChromosome.FERTILITY);
new ControlChromoPicker(this, 28.0f, 1.0f, EnumBeeChromosome.TEMPERATURE_TOLERANCE);
new ControlChromoPicker(this, 61.0f, 37.0f, EnumBeeChromosome.NOCTURNAL);
new ControlChromoPicker(this, 81.0f, 76.0f, EnumBeeChromosome.HUMIDITY_TOLERANCE);
new ControlChromoPicker(this, 44.0f, 21.0f, EnumBeeChromosome.TOLERANT_FLYER);
new ControlChromoPicker(this, 3.0f, 37.0f, EnumBeeChromosome.CAVE_DWELLING);
new ControlChromoPicker(this, 4.0f, 65.0f, EnumBeeChromosome.FLOWER_PROVIDER);
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()) {
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);
new ControlChromoPicker(this, 25.0f, 63.0f, EnumTreeChromosome.FERTILITY);
new ControlChromoPicker(this, 72.0f, 57.0f, EnumTreeChromosome.FRUITS);
new ControlChromoPicker(this, 21.0f, 43.0f, EnumTreeChromosome.YIELD);
new ControlChromoPicker(this, 38.0f, 32.0f, EnumTreeChromosome.PLANT);
new ControlChromoPicker(this, 15.0f, 17.0f, EnumTreeChromosome.SAPPINESS);
new ControlChromoPicker(this, 75.0f, 78.0f, EnumTreeChromosome.TERRITORY);
new ControlChromoPicker(this, 67.0f, 15.0f, EnumTreeChromosome.EFFECT);
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()) {
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);
new ControlChromoPicker(this, 47.0f, 15.0f, EnumFlowerChromosome.FERTILITY);
new ControlChromoPicker(this, 54.0f, 31.0f, EnumFlowerChromosome.TERRITORY);
new ControlChromoPicker(this, 15.0f, 55.0f, EnumFlowerChromosome.EFFECT);
new ControlChromoPicker(this, 23.0f, 38.0f, EnumFlowerChromosome.LIFESPAN);
new ControlChromoPicker(this, 17.0f, 77.0f, EnumFlowerChromosome.TEMPERATURE_TOLERANCE);
new ControlChromoPicker(this, 52.0f, 51.0f, EnumFlowerChromosome.HUMIDITY_TOLERANCE);
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()) {
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);
new ControlChromoPicker(this, 11.0f, 27.0f, EnumButterflyChromosome.LIFESPAN);
new ControlChromoPicker(this, 16.0f, 12.0f, EnumButterflyChromosome.METABOLISM);
new ControlChromoPicker(this, 17.0f, 63.0f, EnumButterflyChromosome.FERTILITY);
new ControlChromoPicker(this, 34.0f, 12.0f, EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
new ControlChromoPicker(this, 22.0f, 46.0f, EnumButterflyChromosome.HUMIDITY_TOLERANCE);
new ControlChromoPicker(this, 53.0f, 26.0f, EnumButterflyChromosome.NOCTURNAL);
new ControlChromoPicker(this, 71.0f, 53.0f, EnumButterflyChromosome.TOLERANT_FLYER);
new ControlChromoPicker(this, 78.0f, 12.0f, EnumButterflyChromosome.FIRE_RESIST);
new ControlChromoPicker(this, 55.0f, 55.0f, EnumButterflyChromosome.FLOWER_PROVIDER);
new ControlChromoPicker(this, 27.0f, 31.0f, EnumButterflyChromosome.EFFECT);
new ControlChromoPicker(this, 87.0f, 45.0f, EnumButterflyChromosome.TERRITORY);
}
}
}
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);
new ControlChromoPicker(this, 19.0f, 20.0f, EnumBeeChromosome.LIFESPAN);
new ControlChromoPicker(this, 55.0f, 65.0f, EnumBeeChromosome.FERTILITY);
new ControlChromoPicker(this, 28.0f, 1.0f, EnumBeeChromosome.TEMPERATURE_TOLERANCE);
new ControlChromoPicker(this, 61.0f, 37.0f, EnumBeeChromosome.NOCTURNAL);
new ControlChromoPicker(this, 81.0f, 76.0f, EnumBeeChromosome.HUMIDITY_TOLERANCE);
new ControlChromoPicker(this, 44.0f, 21.0f, EnumBeeChromosome.TOLERANT_FLYER);
new ControlChromoPicker(this, 3.0f, 37.0f, EnumBeeChromosome.CAVE_DWELLING);
new ControlChromoPicker(this, 4.0f, 65.0f, EnumBeeChromosome.FLOWER_PROVIDER);
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()) {
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);
new ControlChromoPicker(this, 25.0f, 63.0f, EnumTreeChromosome.FERTILITY);
new ControlChromoPicker(this, 72.0f, 57.0f, EnumTreeChromosome.FRUITS);
new ControlChromoPicker(this, 21.0f, 43.0f, EnumTreeChromosome.YIELD);
new ControlChromoPicker(this, 38.0f, 32.0f, EnumTreeChromosome.PLANT);
new ControlChromoPicker(this, 15.0f, 17.0f, EnumTreeChromosome.SAPPINESS);
new ControlChromoPicker(this, 75.0f, 78.0f, EnumTreeChromosome.TERRITORY);
new ControlChromoPicker(this, 67.0f, 15.0f, EnumTreeChromosome.EFFECT);
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()) {
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);
new ControlChromoPicker(this, 47.0f, 15.0f, EnumFlowerChromosome.FERTILITY);
new ControlChromoPicker(this, 54.0f, 31.0f, EnumFlowerChromosome.TERRITORY);
new ControlChromoPicker(this, 15.0f, 55.0f, EnumFlowerChromosome.EFFECT);
new ControlChromoPicker(this, 23.0f, 38.0f, EnumFlowerChromosome.LIFESPAN);
new ControlChromoPicker(this, 17.0f, 77.0f, EnumFlowerChromosome.TEMPERATURE_TOLERANCE);
new ControlChromoPicker(this, 52.0f, 51.0f, EnumFlowerChromosome.HUMIDITY_TOLERANCE);
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()) {
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);
new ControlChromoPicker(this, 11.0f, 27.0f, EnumButterflyChromosome.LIFESPAN);
new ControlChromoPicker(this, 16.0f, 12.0f, EnumButterflyChromosome.METABOLISM);
new ControlChromoPicker(this, 17.0f, 63.0f, EnumButterflyChromosome.FERTILITY);
new ControlChromoPicker(this, 34.0f, 12.0f, EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
new ControlChromoPicker(this, 22.0f, 46.0f, EnumButterflyChromosome.HUMIDITY_TOLERANCE);
new ControlChromoPicker(this, 53.0f, 26.0f, EnumButterflyChromosome.NOCTURNAL);
new ControlChromoPicker(this, 71.0f, 53.0f, EnumButterflyChromosome.TOLERANT_FLYER);
new ControlChromoPicker(this, 78.0f, 12.0f, EnumButterflyChromosome.FIRE_RESIST);
new ControlChromoPicker(this, 55.0f, 55.0f, EnumButterflyChromosome.FLOWER_PROVIDER);
new ControlChromoPicker(this, 27.0f, 31.0f, EnumButterflyChromosome.EFFECT);
new ControlChromoPicker(this, 87.0f, 45.0f, EnumButterflyChromosome.TERRITORY);
}
}
}
@Override
public IChromosomeType getValue() {
return chromo;
}
@Override
public IChromosomeType getValue() {
return chromo;
}
@Override
public void setValue(IChromosomeType value) {
chromo = value;
}
@Override
public void setValue(IChromosomeType value) {
chromo = value;
}
@Override
public void onRenderBackground() {
if (species == null) {
return;
}
super.onRenderBackground();
Texture text = getTypeTexture();
CraftGUI.render.texture(text, IPoint.ZERO);
}
@Override
public void onRenderBackground() {
if (species == null) {
return;
}
super.onRenderBackground();
Texture text = getTypeTexture();
CraftGUI.render.texture(text, IPoint.ZERO);
}
private Texture getTypeTexture() {
if (species == Binnie.Genetics.getBeeRoot()) {
return BeeTexture;
}
if (species == Binnie.Genetics.getTreeRoot()) {
return TreeTexture;
}
if (species == Binnie.Genetics.getButterflyRoot()) {
return MothTexture;
}
if (species == Binnie.Genetics.getFlowerRoot()) {
return FlowerTexture;
}
return null;
}
private Texture getTypeTexture() {
if (species == Binnie.Genetics.getBeeRoot()) {
return BeeTexture;
}
if (species == Binnie.Genetics.getTreeRoot()) {
return TreeTexture;
}
if (species == Binnie.Genetics.getButterflyRoot()) {
return MothTexture;
}
if (species == Binnie.Genetics.getFlowerRoot()) {
return FlowerTexture;
}
return null;
}
}
@@ -8,23 +8,25 @@ import binnie.core.craftgui.geometry.TextJustification;
import binnie.core.genetics.Gene;
public class ControlGenesisOption extends ControlOption<Gene> {
public ControlGenesisOption(ControlList<Gene> parent, Gene gene, int y) {
super(parent, gene, y);
}
public ControlGenesisOption(ControlList<Gene> parent, Gene gene, int y) {
super(parent, gene, y);
}
String getAlleleName() {
return getValue().getAlleleName();
}
String getAlleleName() {
return getValue().getAlleleName();
}
String getChromosomeName() {
return getValue().getShortChromosomeName();
}
String getChromosomeName() {
return getValue().getShortChromosomeName();
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
CraftGUI.render.text(new IArea(0.0f, 0.0f, 70.0f, 22.0f), TextJustification.MIDDLE_CENTER, getChromosomeName(), getColor());
CraftGUI.render.text(new IArea(75.0f, 0.0f, 80.0f, 22.0f), TextJustification.MIDDLE_CENTER, getAlleleName(), getColor());
CraftGUI.render.solid(new IArea(70.0f, 2.0f, 1.0f, 16.0f), 0xff000000 + getColor());
}
@Override
public void onRenderBackground() {
super.onRenderBackground();
CraftGUI.render.text(
new IArea(0.0f, 0.0f, 70.0f, 22.0f), TextJustification.MIDDLE_CENTER, getChromosomeName(), getColor());
CraftGUI.render.text(
new IArea(75.0f, 0.0f, 80.0f, 22.0f), TextJustification.MIDDLE_CENTER, getAlleleName(), getColor());
CraftGUI.render.solid(new IArea(70.0f, 2.0f, 1.0f, 16.0f), 0xff000000 + getColor());
}
}
@@ -11,28 +11,28 @@ import forestry.api.genetics.IIndividual;
import net.minecraft.item.ItemStack;
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(IWidget parent, float x, float y, IIndividual ind) {
this(parent, x, y, 16.0f, ind);
}
public ControlIndividualDisplay(IWidget parent, float x, float y, float size, IIndividual ind) {
super(parent, x, y, size);
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()));
setTooltip();
}
public ControlIndividualDisplay(IWidget parent, float x, float y, float size, IIndividual ind) {
super(parent, x, y, size);
BreedingSystem system = Binnie.Genetics.getSystem(ind.getGenome().getSpeciesRoot());
setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()));
setTooltip();
}
@Override
public void getTooltip(Tooltip tooltip) {
ItemStack stack = getItemStack();
if (stack == null) {
return;
}
@Override
public void getTooltip(Tooltip tooltip) {
ItemStack stack = getItemStack();
if (stack == null) {
return;
}
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
if (ind == null) {
return;
}
tooltip.add(ind.getGenome().getPrimary().getName());
}
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
if (ind == null) {
return;
}
tooltip.add(ind.getGenome().getPrimary().getName());
}
}
@@ -11,65 +11,64 @@ import binnie.core.craftgui.geometry.IBorder;
import binnie.core.genetics.Tolerance;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.EnumTolerance;
import java.util.EnumSet;
import net.minecraft.util.EnumChatFormatting;
import java.util.EnumSet;
public abstract class ControlToleranceBar<T extends Enum<T>> extends Control implements ITooltip {
EnumSet<T> tolerated;
EnumSet<T> fullSet;
private Class<T> enumClass;
EnumSet<T> tolerated;
EnumSet<T> fullSet;
private Class<T> enumClass;
public ControlToleranceBar(IWidget parent, float x, float y, float width, float height, Class<T> clss) {
super(parent, x, y, width, height);
addAttribute(WidgetAttribute.MOUSE_OVER);
enumClass = clss;
tolerated = EnumSet.noneOf(enumClass);
fullSet = EnumSet.allOf(enumClass);
if (enumClass == EnumTemperature.class) {
fullSet.remove(EnumTemperature.NONE);
}
}
public ControlToleranceBar(IWidget parent, float x, float y, float width, float height, Class<T> clss) {
super(parent, x, y, width, height);
addAttribute(WidgetAttribute.MOUSE_OVER);
enumClass = clss;
tolerated = EnumSet.noneOf(enumClass);
fullSet = EnumSet.allOf(enumClass);
if (enumClass == EnumTemperature.class) {
fullSet.remove(EnumTemperature.NONE);
}
}
@Override
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));
}
}
}
@Override
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(T p0);
protected abstract String getName(T p0);
protected abstract int getColor(T p0);
protected abstract int getColor(T p0);
@Override
public void onRenderBackground() {
CraftGUI.render.gradientRect(getArea(), 0xaaaaaaaa, 0xaaaaaaaa);
float w = getArea().w() / fullSet.size();
int t = 0;
for (T value : fullSet) {
int col = (tolerated.contains(value) ? 0xff000000 : 0x33000000) + getColor(value);
IBorder inset = new IBorder(tolerated.contains(value) ? 1.0f : 3.0f);
CraftGUI.render.gradientRect(new IArea(w * t, 0.0f, w, h()).inset(inset), col, col);
++t;
}
}
@Override
public void onRenderBackground() {
CraftGUI.render.gradientRect(getArea(), 0xaaaaaaaa, 0xaaaaaaaa);
float w = getArea().w() / fullSet.size();
int t = 0;
for (T value : fullSet) {
int col = (tolerated.contains(value) ? 0xff000000 : 0x33000000) + getColor(value);
IBorder inset = new IBorder(tolerated.contains(value) ? 1.0f : 3.0f);
CraftGUI.render.gradientRect(new IArea(w * t, 0.0f, w, h()).inset(inset), col, col);
++t;
}
}
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;
}
tolerated.add(full);
}
}
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;
}
tolerated.add(full);
}
}
}
@@ -6,12 +6,12 @@ import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.controls.core.Control;
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);
}
public ControlTooltip(IWidget parent, float x, float y, float w, float h) {
super(parent, x, y, w, h);
}
@Override
public void getTooltip(Tooltip tooltip) {
// ignored
}
@Override
public void getTooltip(Tooltip tooltip) {
// ignored
}
}
@@ -39,458 +39,498 @@ import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IBreedingTracker;
import forestry.api.genetics.IIndividual;
import forestry.api.lepidopterology.IButterfly;
import java.util.ArrayList;
import java.util.List;
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;
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;
private Control analystNone;
private ControlSlide slideUpInv;
private Control analystNone;
private ControlSlide slideUpInv;
public WindowAnalyst(EntityPlayer player, IInventory inventory, Side side, boolean database, boolean master) {
super(312.0f, 230.0f, player, inventory, side);
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;
}
public WindowAnalyst(EntityPlayer player, IInventory inventory, Side side, boolean database, boolean master) {
super(312.0f, 230.0f, player, inventory, side);
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
protected AbstractMod getMod() {
return Genetics.instance;
}
@Override
protected AbstractMod getMod() {
return Genetics.instance;
}
@Override
protected String getName() {
return "Analyst";
}
@Override
protected String getName() {
return "Analyst";
}
private void setupValidators() {
if (!isDatabase) {
getWindowInventory().setValidator(0, new SlotValidator.Individual() {
@Override
public boolean isValid(ItemStack itemStack) {
return Analyser.isAnalysed(itemStack) || (Analyser.isAnalysable(itemStack) && getWindowInventory().getStackInSlot(1) != null);
}
});
getWindowInventory().setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.IconDye));
}
}
private void setupValidators() {
if (!isDatabase) {
getWindowInventory().setValidator(0, new SlotValidator.Individual() {
@Override
public boolean isValid(ItemStack itemStack) {
return Analyser.isAnalysed(itemStack)
|| (Analyser.isAnalysable(itemStack)
&& getWindowInventory().getStackInSlot(1) != null);
}
});
getWindowInventory()
.setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.IconDye));
}
}
@Override
public void initialiseServer() {
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
IBreedingTracker tracker = system.getSpeciesRoot().getBreedingTracker(getWorld(), getUsername());
if (tracker != null) {
tracker.synchToPlayer(getPlayer());
}
}
setupValidators();
}
@Override
public void initialiseServer() {
for (BreedingSystem system : Binnie.Genetics.getActiveSystems()) {
IBreedingTracker tracker = system.getSpeciesRoot().getBreedingTracker(getWorld(), getUsername());
if (tracker != null) {
tracker.synchToPlayer(getPlayer());
}
}
setupValidators();
}
@Override
public void initialiseClient() {
if (isDatabase) {
if (isMaster) {
setTitle(I18N.localise("genetics.item.registry.1.name"));
} else {
setTitle(I18N.localise("genetics.item.registry.0.name"));
}
} else {
setTitle(I18N.localise("genetics.item.analyst.name"));
}
@Override
public void initialiseClient() {
if (isDatabase) {
if (isMaster) {
setTitle(I18N.localise("genetics.item.registry.1.name"));
} else {
setTitle(I18N.localise("genetics.item.registry.0.name"));
}
} else {
setTitle(I18N.localise("genetics.item.analyst.name"));
}
getWindowInventory().createSlot(0);
baseWidget = new Widget(this);
int x = 16;
int y = 28;
getWindowInventory().createSlot(0);
baseWidget = new Widget(this);
int x = 16;
int y = 28;
if (isDatabase) {
for (BreedingSystem syst : Binnie.Genetics.getActiveSystems()) {
new Control(this, x, y, 20.0f, 20.0f) {
@Override
public void initialise() {
addAttribute(WidgetAttribute.MOUSE_OVER);
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
setSystem(syst);
}
});
}
if (isDatabase) {
for (BreedingSystem syst : Binnie.Genetics.getActiveSystems()) {
new Control(this, x, y, 20.0f, 20.0f) {
@Override
public void initialise() {
addAttribute(WidgetAttribute.MOUSE_OVER);
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
setSystem(syst);
}
});
}
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add(syst.getName());
}
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add(syst.getName());
}
@Override
public void onRenderBackground() {
CraftGUI.render.color(syst.getColor());
int outset = (getSystem() == syst) ? 1 : 0;
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().outset(outset));
if (getSystem() == syst) {
CraftGUI.render.color(1140850688 + syst.getColor());
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(outset));
}
CraftGUI.render.item(new IPoint(2.0f, 2.0f), syst.getItemStackRepresentative());
}
};
x += 22;
}
} 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;
setupValidators();
}
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(getArea(), 0x44ffffff, 0x66ffffff);
super.onRenderBackground();
}
@Override
public void onRenderBackground() {
CraftGUI.render.color(syst.getColor());
int outset = (getSystem() == syst) ? 1 : 0;
CraftGUI.render.texture(
CraftGUITexture.TabOutline, getArea().outset(outset));
if (getSystem() == syst) {
CraftGUI.render.color(1140850688 + syst.getColor());
CraftGUI.render.texture(
CraftGUITexture.TabSolid, getArea().outset(outset));
}
CraftGUI.render.item(new IPoint(2.0f, 2.0f), syst.getItemStackRepresentative());
}
};
x += 22;
}
} 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;
setupValidators();
}
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(getArea(), 0x44ffffff, 0x66ffffff);
super.onRenderBackground();
}
@Override
public void initialise() {
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 (getContent() == null) {
return;
}
CraftGUI.render.color(getContent().getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
}
};
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 (!isEnabled()) {
return;
}
if (leftPage.getContent() == null) {
return;
}
CraftGUI.render.gradientRect(getArea(), 1140850688 + leftPage.getContent().getColor(), 0x44000000 + leftPage.getContent().getColor());
CraftGUI.render.solid(getRenderArea(), leftPage.getContent().getColor());
}
};
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 (getContent() == null) {
return;
}
CraftGUI.render.color(getContent().getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
}
};
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 (!isEnabled()) {
return;
}
if (rightPage.getContent() == null) {
return;
}
CraftGUI.render.gradientRect(getArea(), 1140850688 + rightPage.getContent().getColor(), 0x44000000 + rightPage.getContent().getColor());
CraftGUI.render.solid(getRenderArea(), rightPage.getContent().getColor());
}
};
analystPageSize = new IArea(1.0f, 1.0f, sectionWidth, h() - 8.0f);
}
};
@Override
public void initialise() {
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 (getContent() == null) {
return;
}
CraftGUI.render.color(getContent().getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
}
};
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 (!isEnabled()) {
return;
}
if (leftPage.getContent() == null) {
return;
}
CraftGUI.render.gradientRect(
getArea(),
1140850688 + leftPage.getContent().getColor(),
0x44000000 + leftPage.getContent().getColor());
CraftGUI.render.solid(
getRenderArea(), leftPage.getContent().getColor());
}
};
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 (getContent() == null) {
return;
}
CraftGUI.render.color(getContent().getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea());
}
};
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 (!isEnabled()) {
return;
}
if (rightPage.getContent() == null) {
return;
}
CraftGUI.render.gradientRect(
getArea(),
1140850688 + rightPage.getContent().getColor(),
0x44000000 + rightPage.getContent().getColor());
CraftGUI.render.solid(
getRenderArea(), rightPage.getContent().getColor());
}
};
analystPageSize = new IArea(1.0f, 1.0f, sectionWidth, h() - 8.0f);
}
};
if (!isDatabase) {
slideUpInv = new ControlSlide(this, (getSize().x() - 244.0f) / 2.0f, getSize().y() - 80.0f + 1.0f, 244.0f, 80.0f, Position.BOTTOM);
new ControlPlayerInventory(slideUpInv, true);
slideUpInv.setSlide(false);
}
addEventHandler(new EventKey.Down.Handler() {
@Override
public void onEvent(EventKey.Down event) {
if (event.getKey() == 205) {
shiftPages(true);
}
if (event.getKey() == 203) {
shiftPages(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);
}
addEventHandler(new EventKey.Down.Handler() {
@Override
public void onEvent(EventKey.Down event) {
if (event.getKey() == 205) {
shiftPages(true);
}
if (event.getKey() == 203) {
shiftPages(false);
}
}
});
if (!isDatabase) {
analystNone = new Control(analystPanel, 0.0f, 0.0f, analystPanel.w(), analystPanel.h()) {
@Override
public void initialise() {
new ControlTextCentered(this, 20.0f, I18N.localise("genetics.gui.analyst.info")).setColor(0x444444);
new ControlPlayerInventory(this);
}
};
}
setIndividual(null);
setSystem(Binnie.Genetics.beeBreedingSystem);
}
if (!isDatabase) {
analystNone = new Control(analystPanel, 0.0f, 0.0f, analystPanel.w(), analystPanel.h()) {
@Override
public void initialise() {
new ControlTextCentered(this, 20.0f, I18N.localise("genetics.gui.analyst.info")).setColor(0x444444);
new ControlPlayerInventory(this);
}
};
}
setIndividual(null);
setSystem(Binnie.Genetics.beeBreedingSystem);
}
public void updatePages(boolean systemChange) {
int oldLeft = -1;
int oldRight = -1;
if (!systemChange) {
oldLeft = analystPages.indexOf(leftPage.getContent());
oldRight = analystPages.indexOf(rightPage.getContent());
}
public void updatePages(boolean systemChange) {
int oldLeft = -1;
int oldRight = -1;
if (!systemChange) {
oldLeft = analystPages.indexOf(leftPage.getContent());
oldRight = analystPages.indexOf(rightPage.getContent());
}
ControlAnalystPage databasePage = null;
if (isDatabase && !systemChange) {
databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null);
}
ControlAnalystPage databasePage = null;
if (isDatabase && !systemChange) {
databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null);
}
analystPages.clear();
setPage(leftPage, null);
setPage(rightPage, null);
if (isDatabase) {
analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster));
}
analystPages.clear();
setPage(leftPage, null);
setPage(rightPage, null);
if (isDatabase) {
analystPages.add(
(databasePage != null)
? databasePage
: new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster));
}
if (current != null) {
analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current));
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current));
if (!isDatabase) {
analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, false, current));
analystPages.add(new AnalystPageKaryogram(analystPanel, analystPageSize, 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 (!(current instanceof ITree)) {
analystPages.add(new AnalystPageClimate(analystPanel, analystPageSize, current));
}
if (!(current instanceof ITree)) {
analystPages.add(new AnalystPageClimate(analystPanel, analystPageSize, current));
}
if (current instanceof IBee) {
analystPages.add(new AnalystPageProducts(analystPanel, analystPageSize, (IBee) current));
} else if (current instanceof ITree) {
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));
}
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));
}
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));
}
analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster));
}
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));
}
analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster));
}
tabBar.deleteAllChildren();
float width = tabBar.w() / analystPages.size();
float x = 0.0f;
tabBar.deleteAllChildren();
float width = tabBar.w() / analystPages.size();
float x = 0.0f;
for (ControlAnalystPage page : analystPages) {
new ControlTooltip(tabBar, x, 0.0f, width, tabBar.h()) {
ControlAnalystPage value;
for (ControlAnalystPage page : analystPages) {
new ControlTooltip(tabBar, x, 0.0f, width, tabBar.h()) {
ControlAnalystPage value;
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add(value.getTitle());
}
@Override
public void getTooltip(Tooltip tooltip) {
tooltip.add(value.getTitle());
}
@Override
protected void initialise() {
super.initialise();
addAttribute(WidgetAttribute.MOUSE_OVER);
value = page;
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
int currentIndex = analystPages.indexOf(rightPage.getContent());
int clickedIndex = analystPages.indexOf(value);
if (isDatabase) {
if (clickedIndex != 0 && clickedIndex != currentIndex) {
setPage(rightPage, value);
}
} else {
if (clickedIndex < 0) {
clickedIndex = 0;
}
if (clickedIndex < currentIndex) {
++clickedIndex;
}
setPage(rightPage, null);
setPage(leftPage, null);
setPage(rightPage, analystPages.get(clickedIndex));
setPage(leftPage, analystPages.get(clickedIndex - 1));
}
}
});
}
@Override
protected void initialise() {
super.initialise();
addAttribute(WidgetAttribute.MOUSE_OVER);
value = page;
addSelfEventHandler(new EventMouse.Down.Handler() {
@Override
public void onEvent(EventMouse.Down event) {
int currentIndex = analystPages.indexOf(rightPage.getContent());
int clickedIndex = analystPages.indexOf(value);
if (isDatabase) {
if (clickedIndex != 0 && clickedIndex != currentIndex) {
setPage(rightPage, value);
}
} else {
if (clickedIndex < 0) {
clickedIndex = 0;
}
if (clickedIndex < currentIndex) {
++clickedIndex;
}
setPage(rightPage, null);
setPage(leftPage, null);
setPage(rightPage, analystPages.get(clickedIndex));
setPage(leftPage, analystPages.get(clickedIndex - 1));
}
}
});
}
@Override
public void onRenderBackground() {
boolean active = value == leftPage.getContent() || value == rightPage.getContent();
CraftGUI.render.color((active ? 0xff000000 : 0x44000000) + value.getColor());
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
CraftGUI.render.color(value.getColor());
CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().inset(1));
super.onRenderBackground();
}
};
x += width;
}
@Override
public void onRenderBackground() {
boolean active = value == leftPage.getContent() || value == rightPage.getContent();
CraftGUI.render.color((active ? 0xff000000 : 0x44000000) + value.getColor());
CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1));
CraftGUI.render.color(value.getColor());
CraftGUI.render.texture(
CraftGUITexture.TabOutline, getArea().inset(1));
super.onRenderBackground();
}
};
x += width;
}
if (analystPages.size() > 0) {
setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0));
}
if (analystPages.size() > 1) {
setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1));
}
}
if (analystPages.size() > 0) {
setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0));
}
if (analystPages.size() > 1) {
setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1));
}
}
public void shiftPages(boolean right) {
if (analystPages.size() < 2) {
return;
}
int leftIndex = analystPages.indexOf(leftPage.getContent());
int rightIndex = analystPages.indexOf(rightPage.getContent());
if (right && rightIndex + 1 >= analystPages.size()) {
return;
}
if (!lockedSearch && !right && leftIndex <= 0) {
return;
}
if (!lockedSearch && !right && rightIndex <= 1) {
return;
}
int newRightIndex = rightIndex + (right ? 1 : -1);
int newLeftIndex = lockedSearch ? 0 : (newRightIndex - 1);
float oldRightPercent = 0.0f;
float oldLeftPercent = 0.0f;
if (newLeftIndex == rightIndex) {
oldRightPercent = rightPage.getPercentageIndex();
}
if (newRightIndex == leftIndex) {
oldLeftPercent = leftPage.getPercentageIndex();
}
setPage(leftPage, null);
setPage(rightPage, null);
setPage(leftPage, analystPages.get(newLeftIndex));
setPage(rightPage, analystPages.get(newRightIndex));
analystPages.get(newLeftIndex).show();
if (oldRightPercent != 0.0f) {
leftPage.setPercentageIndex(oldRightPercent);
}
if (oldLeftPercent != 0.0f) {
rightPage.setPercentageIndex(oldLeftPercent);
}
}
public void shiftPages(boolean right) {
if (analystPages.size() < 2) {
return;
}
int leftIndex = analystPages.indexOf(leftPage.getContent());
int rightIndex = analystPages.indexOf(rightPage.getContent());
if (right && rightIndex + 1 >= analystPages.size()) {
return;
}
if (!lockedSearch && !right && leftIndex <= 0) {
return;
}
if (!lockedSearch && !right && rightIndex <= 1) {
return;
}
int newRightIndex = rightIndex + (right ? 1 : -1);
int newLeftIndex = lockedSearch ? 0 : (newRightIndex - 1);
float oldRightPercent = 0.0f;
float oldLeftPercent = 0.0f;
if (newLeftIndex == rightIndex) {
oldRightPercent = rightPage.getPercentageIndex();
}
if (newRightIndex == leftIndex) {
oldLeftPercent = leftPage.getPercentageIndex();
}
setPage(leftPage, null);
setPage(rightPage, null);
setPage(leftPage, analystPages.get(newLeftIndex));
setPage(rightPage, analystPages.get(newRightIndex));
analystPages.get(newLeftIndex).show();
if (oldRightPercent != 0.0f) {
leftPage.setPercentageIndex(oldRightPercent);
}
if (oldLeftPercent != 0.0f) {
rightPage.setPercentageIndex(oldLeftPercent);
}
}
public void setPage(ControlScrollableContent side, ControlAnalystPage page) {
ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent();
if (existingPage != null) {
existingPage.hide();
side.setScrollableContent(null);
}
if (page != null) {
page.show();
side.setScrollableContent(page);
side.setPercentageIndex(0.0f);
page.setPosition(side.pos().add(1.0f, 1.0f));
}
}
public void setPage(ControlScrollableContent side, ControlAnalystPage page) {
ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent();
if (existingPage != null) {
existingPage.hide();
side.setScrollableContent(null);
}
if (page != null) {
page.show();
side.setScrollableContent(page);
side.setPercentageIndex(0.0f);
page.setPosition(side.pos().add(1.0f, 1.0f));
}
}
@Override
public void onWindowInventoryChanged() {
super.onWindowInventoryChanged();
if (getWindowInventory().getStackInSlot(0) != null && !Analyser.isAnalysed(getWindowInventory().getStackInSlot(0))) {
getWindowInventory().setInventorySlotContents(0, Analyser.analyse(getWindowInventory().getStackInSlot(0)));
getWindowInventory().decrStackSize(1, 1);
}
@Override
public void onWindowInventoryChanged() {
super.onWindowInventoryChanged();
if (getWindowInventory().getStackInSlot(0) != null
&& !Analyser.isAnalysed(getWindowInventory().getStackInSlot(0))) {
getWindowInventory()
.setInventorySlotContents(
0, Analyser.analyse(getWindowInventory().getStackInSlot(0)));
getWindowInventory().decrStackSize(1, 1);
}
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(getWindowInventory().getStackInSlot(0));
if (ind != null) {
ind.getGenome().getSpeciesRoot().getBreedingTracker(getWorld(), getUsername()).registerBirth(ind);
}
IIndividual ind =
AlleleManager.alleleRegistry.getIndividual(getWindowInventory().getStackInSlot(0));
if (ind != null) {
ind.getGenome()
.getSpeciesRoot()
.getBreedingTracker(getWorld(), getUsername())
.registerBirth(ind);
}
if (isClient()) {
setStack(getWindowInventory().getStackInSlot(0));
}
}
if (isClient()) {
setStack(getWindowInventory().getStackInSlot(0));
}
}
public void setStack(ItemStack stack) {
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
setIndividual(ind);
}
public void setStack(ItemStack stack) {
IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack);
setIndividual(ind);
}
public IIndividual getIndividual() {
return current;
}
public IIndividual getIndividual() {
return current;
}
public void setIndividual(IIndividual ind) {
if (!isDatabase) {
if (ind == null) {
analystNone.show();
slideUpInv.hide();
} else {
analystNone.hide();
slideUpInv.show();
}
}
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;
}
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);
}
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 currentSystem;
}
public BreedingSystem getSystem() {
return currentSystem;
}
public void setSystem(BreedingSystem system) {
if (system == currentSystem) {
return;
}
public void setSystem(BreedingSystem system) {
if (system == currentSystem) {
return;
}
currentSystem = system;
current = null;
updatePages(true);
}
currentSystem = system;
current = null;
updatePages(true);
}
}