use of forestry.core.genetics.alleles.AlleleBoolean in project ForestryMC by ForestryMC.
the class FlutterlyzerPlugin method drawAnalyticsPage2.
@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
if (gui instanceof GuiAlyzer) {
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
IButterfly butterfly = ButterflyManager.butterflyRoot.getMember(itemStack);
if (butterfly == null) {
return;
}
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
textLayout.newLine();
textLayout.newLine();
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getTemperature()), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getTemperature()), butterfly, EnumButterflyChromosome.SPECIES);
textLayout.newLine();
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
guiAlyzer.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
guiAlyzer.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
textLayout.newLine();
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getHumidity()), AlleleManager.climateHelper.toDisplay(butterfly.getGenome().getPrimary().getHumidity()), butterfly, EnumButterflyChromosome.SPECIES);
textLayout.newLine();
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
guiAlyzer.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
guiAlyzer.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
textLayout.newLine();
textLayout.newLine();
String yes = Translator.translateToLocal("for.yes");
String no = Translator.translateToLocal("for.no");
String diurnal0, diurnal1, nocturnal0, nocturnal1;
if (butterfly.getGenome().getNocturnal()) {
nocturnal0 = diurnal0 = yes;
} else {
nocturnal0 = butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
diurnal0 = !butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
}
if (((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.NOCTURNAL)).getValue()) {
nocturnal1 = diurnal1 = yes;
} else {
nocturnal1 = butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
diurnal1 = !butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
}
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
textLayout.newLine();
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
textLayout.newLine();
String primary = StringUtil.readableBoolean(butterfly.getGenome().getTolerantFlyer(), yes, no);
String secondary = StringUtil.readableBoolean(((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TOLERANT_FLYER)).getValue(), yes, no);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, butterfly, EnumButterflyChromosome.TOLERANT_FLYER);
textLayout.newLine();
primary = StringUtil.readableBoolean(butterfly.getGenome().getFireResist(), yes, no);
secondary = StringUtil.readableBoolean(((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FIRE_RESIST)).getValue(), yes, no);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.fireresist"), primary, secondary, butterfly, EnumButterflyChromosome.FIRE_RESIST);
textLayout.endPage();
}
}
use of forestry.core.genetics.alleles.AlleleBoolean in project ForestryMC by ForestryMC.
the class BeeAlyzerPlugin method drawAnalyticsPage2.
@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage2(GuiScreen gui, ItemStack itemStack) {
if (gui instanceof GuiAlyzer) {
GuiAlyzer guiAlyzer = (GuiAlyzer) gui;
IBee bee = BeeManager.beeRoot.getMember(itemStack);
if (bee == null) {
return;
}
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
TextLayoutHelper textLayout = guiAlyzer.getTextLayout();
textLayout.startPage(GuiAlyzer.COLUMN_0, GuiAlyzer.COLUMN_1, GuiAlyzer.COLUMN_2);
textLayout.drawLine(Translator.translateToLocal("for.gui.active"), GuiAlyzer.COLUMN_1);
textLayout.drawLine(Translator.translateToLocal("for.gui.inactive"), GuiAlyzer.COLUMN_2);
textLayout.newLine();
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.climate"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getTemperature()), AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getTemperature()), bee, EnumBeeChromosome.SPECIES);
textLayout.newLine();
IAlleleTolerance tempToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
IAlleleTolerance tempToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
guiAlyzer.drawToleranceInfo(tempToleranceActive, GuiAlyzer.COLUMN_1);
guiAlyzer.drawToleranceInfo(tempToleranceInactive, GuiAlyzer.COLUMN_2);
textLayout.newLine(16);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.humidity"), AlleleManager.climateHelper.toDisplay(bee.getGenome().getPrimary().getHumidity()), AlleleManager.climateHelper.toDisplay(bee.getGenome().getSecondary().getHumidity()), bee, EnumBeeChromosome.SPECIES);
textLayout.newLine();
IAlleleTolerance humidToleranceActive = (IAlleleTolerance) bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
IAlleleTolerance humidToleranceInactive = (IAlleleTolerance) bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
textLayout.drawLine(" " + Translator.translateToLocal("for.gui.tolerance"), GuiAlyzer.COLUMN_0);
guiAlyzer.drawToleranceInfo(humidToleranceActive, GuiAlyzer.COLUMN_1);
guiAlyzer.drawToleranceInfo(humidToleranceInactive, GuiAlyzer.COLUMN_2);
textLayout.newLine(16);
String yes = Translator.translateToLocal("for.yes");
String no = Translator.translateToLocal("for.no");
String diurnal0, diurnal1, nocturnal0, nocturnal1;
if (bee.getGenome().getNeverSleeps()) {
nocturnal0 = diurnal0 = yes;
} else {
nocturnal0 = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
diurnal0 = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
}
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.NEVER_SLEEPS)).getValue()) {
nocturnal1 = diurnal1 = yes;
} else {
nocturnal1 = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
diurnal1 = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
}
textLayout.drawLine(Translator.translateToLocal("for.gui.diurnal"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(diurnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
textLayout.drawLine(diurnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
textLayout.newLineCompressed();
textLayout.drawLine(Translator.translateToLocal("for.gui.nocturnal"), GuiAlyzer.COLUMN_0);
textLayout.drawLine(nocturnal0, GuiAlyzer.COLUMN_1, guiAlyzer.getColorCoding(false));
textLayout.drawLine(nocturnal1, GuiAlyzer.COLUMN_2, guiAlyzer.getColorCoding(false));
textLayout.newLineCompressed();
String primary = StringUtil.readableBoolean(bee.getGenome().getToleratesRain(), yes, no);
String secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERATES_RAIN)).getValue(), yes, no);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.flyer"), primary, secondary, bee, EnumBeeChromosome.TOLERATES_RAIN);
textLayout.newLineCompressed();
primary = StringUtil.readableBoolean(bee.getGenome().getCaveDwelling(), yes, no);
secondary = StringUtil.readableBoolean(((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
guiAlyzer.drawRow(Translator.translateToLocal("for.gui.cave"), primary, secondary, bee, EnumBeeChromosome.CAVE_DWELLING);
textLayout.newLine();
String displayText;
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
String displayTextKey = "for.bees.stock.pristine";
if (!bee.isNatural()) {
displayTextKey = "for.bees.stock.ignoble";
}
displayText = Translator.translateToLocal(displayTextKey);
textLayout.drawCenteredLine(displayText, 8, 208, guiAlyzer.getFontColor().get("gui.beealyzer.binomial"));
}
if (bee.getGeneration() >= 0) {
textLayout.newLineCompressed();
displayText = Translator.translateToLocalFormatted("for.gui.beealyzer.generations", bee.getGeneration());
textLayout.drawCenteredLine(displayText, 8, 208, guiAlyzer.getFontColor().get("gui.beealyzer.binomial"));
}
textLayout.endPage();
}
}
use of forestry.core.genetics.alleles.AlleleBoolean in project ForestryMC by ForestryMC.
the class ButterflyDatabaseTab method createElements.
@Override
public void createElements(IGuiElementHelper elementHelper, IButterfly butterfly, ItemStack itemStack) {
boolean active = tab == EnumDatabaseTab.ACTIVE_SPECIES;
IAlleleButterflySpecies primarySpecies = butterfly.getGenome().getPrimary();
elementHelper.addText(Translator.translateToLocal("for.gui.database.tab." + tab.name().toLowerCase() + ".name"), GuiElementAlignment.CENTER, 0xcfb53b);
elementHelper.addAllele(Translator.translateToLocal("for.gui.species"), butterfly, EnumButterflyChromosome.SPECIES, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.size"), butterfly, EnumButterflyChromosome.SIZE, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.lifespan"), butterfly, EnumButterflyChromosome.LIFESPAN, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.speed"), butterfly, EnumButterflyChromosome.SPEED, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.metabolism"), (IAlleleInteger a) -> GenericRatings.rateMetabolism(a.getValue()), butterfly, EnumButterflyChromosome.METABOLISM, active);
IAlleleInteger fertility = (IAlleleInteger) (active ? butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.FERTILITY) : butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FERTILITY));
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.fertility"), GuiElementAlignment.CENTER);
elementHelper.addFertilityInfo(fertility, 0, 8);
elementHelper.addAllele(Translator.translateToLocal("for.gui.flowers"), butterfly, EnumButterflyChromosome.FLOWER_PROVIDER, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.effect"), butterfly, EnumButterflyChromosome.EFFECT, active);
IAlleleTolerance tempTolerance = (IAlleleTolerance) (active ? butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE) : butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE));
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.climate"), GuiElementAlignment.CENTER);
elementHelper.addToleranceInfo(tempTolerance, primarySpecies, AlleleManager.climateHelper.toDisplay(primarySpecies.getTemperature()));
IAlleleTolerance humidTolerance = (IAlleleTolerance) (active ? butterfly.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE) : butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE));
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.humidity"), GuiElementAlignment.CENTER);
elementHelper.addToleranceInfo(humidTolerance, primarySpecies, AlleleManager.climateHelper.toDisplay(primarySpecies.getHumidity()));
String yes = Translator.translateToLocal("for.yes");
String no = Translator.translateToLocal("for.no");
String diurnal, nocturnal;
if (active) {
if (butterfly.getGenome().getNocturnal()) {
nocturnal = diurnal = yes;
} else {
nocturnal = butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
diurnal = !butterfly.getGenome().getPrimary().isNocturnal() ? yes : no;
}
} else {
if (((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.NOCTURNAL)).getValue()) {
nocturnal = diurnal = yes;
} else {
nocturnal = butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
diurnal = !butterfly.getGenome().getSecondary().isNocturnal() ? yes : no;
}
}
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.diurnal"), GuiElementAlignment.CENTER);
elementHelper.addText(diurnal, GuiElementAlignment.CENTER, elementHelper.factory().getColorCoding(false));
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.nocturnal"), GuiElementAlignment.CENTER);
elementHelper.addText(nocturnal, GuiElementAlignment.CENTER, elementHelper.factory().getColorCoding(false));
String flyer = StringUtil.readableBoolean(active ? butterfly.getGenome().getTolerantFlyer() : ((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.TOLERANT_FLYER)).getValue(), yes, no);
elementHelper.addAllele(Translator.translateToLocal("for.gui.flyer"), (a) -> flyer, butterfly, EnumButterflyChromosome.TOLERANT_FLYER, active);
String fireresist = StringUtil.readableBoolean(active ? butterfly.getGenome().getFireResist() : ((AlleleBoolean) butterfly.getGenome().getInactiveAllele(EnumButterflyChromosome.FIRE_RESIST)).getValue(), yes, no);
elementHelper.addAllele(Translator.translateToLocal("for.gui.fireresist"), (a) -> fireresist, butterfly, EnumButterflyChromosome.FIRE_RESIST, active);
}
use of forestry.core.genetics.alleles.AlleleBoolean in project ForestryMC by ForestryMC.
the class BeeDatabaseTab method createElements.
@Override
public void createElements(IGuiElementHelper elementHelper, IBee bee, ItemStack itemStack) {
EnumBeeType type = BeeManager.beeRoot.getType(itemStack);
if (type == null) {
return;
}
IAlleleSpecies primarySpecies = bee.getGenome().getPrimary();
boolean active = tab == EnumDatabaseTab.ACTIVE_SPECIES;
elementHelper.addText(Translator.translateToLocal("for.gui.database.tab." + tab.name().toLowerCase() + ".name"), GuiElementAlignment.CENTER, 0xcfb53b);
elementHelper.addAllele(Translator.translateToLocal("for.gui.species"), bee, EnumBeeChromosome.SPECIES, active);
IAlleleTolerance tempTolerance = (IAlleleTolerance) (active ? bee.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE) : bee.getGenome().getInactiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE));
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.climate"), GuiElementAlignment.CENTER);
elementHelper.addToleranceInfo(tempTolerance, primarySpecies, AlleleManager.climateHelper.toDisplay(primarySpecies.getTemperature()));
IAlleleTolerance humidTolerance = (IAlleleTolerance) (active ? bee.getGenome().getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE) : bee.getGenome().getInactiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE));
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.humidity"), GuiElementAlignment.CENTER);
elementHelper.addToleranceInfo(humidTolerance, primarySpecies, AlleleManager.climateHelper.toDisplay(primarySpecies.getHumidity()));
elementHelper.addAllele(Translator.translateToLocal("for.gui.lifespan"), bee, EnumBeeChromosome.LIFESPAN, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.speed"), bee, EnumBeeChromosome.SPEED, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.pollination"), bee, EnumBeeChromosome.FLOWERING, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.flowers"), bee, EnumBeeChromosome.FLOWER_PROVIDER, active);
IAlleleInteger primaryFertility = (IAlleleInteger) (active ? bee.getGenome().getActiveAllele(EnumBeeChromosome.FERTILITY) : bee.getGenome().getInactiveAllele(EnumBeeChromosome.FERTILITY));
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.fertility"), GuiElementAlignment.CENTER);
elementHelper.addFertilityInfo(primaryFertility, 0, 0);
elementHelper.addAllele(Translator.translateToLocal("for.gui.area"), bee, EnumBeeChromosome.TERRITORY, active);
elementHelper.addAllele(Translator.translateToLocal("for.gui.effect"), bee, EnumBeeChromosome.EFFECT, active);
String yes = Translator.translateToLocal("for.yes");
String no = Translator.translateToLocal("for.no");
String diurnal, nocturnal;
if (active) {
if (bee.getGenome().getNeverSleeps()) {
nocturnal = diurnal = yes;
} else {
nocturnal = bee.getGenome().getPrimary().isNocturnal() ? yes : no;
diurnal = !bee.getGenome().getPrimary().isNocturnal() ? yes : no;
}
} else {
if (((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumButterflyChromosome.NOCTURNAL)).getValue()) {
nocturnal = diurnal = yes;
} else {
nocturnal = bee.getGenome().getSecondary().isNocturnal() ? yes : no;
diurnal = !bee.getGenome().getSecondary().isNocturnal() ? yes : no;
}
}
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.diurnal"), GuiElementAlignment.CENTER);
elementHelper.addText(diurnal, GuiElementAlignment.CENTER, elementHelper.factory().getColorCoding(false));
elementHelper.addText(TextFormatting.UNDERLINE + Translator.translateToLocal("for.gui.nocturnal"), GuiElementAlignment.CENTER);
elementHelper.addText(nocturnal, GuiElementAlignment.CENTER, elementHelper.factory().getColorCoding(false));
String flyer = StringUtil.readableBoolean(active ? bee.getGenome().getToleratesRain() : ((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.TOLERATES_RAIN)).getValue(), yes, no);
elementHelper.addAllele(Translator.translateToLocal("for.gui.flyer"), (a) -> flyer, bee, EnumButterflyChromosome.TOLERANT_FLYER, active);
String cave = StringUtil.readableBoolean(active ? bee.getGenome().getCaveDwelling() : ((AlleleBoolean) bee.getGenome().getInactiveAllele(EnumBeeChromosome.CAVE_DWELLING)).getValue(), yes, no);
elementHelper.addAllele(Translator.translateToLocal("for.gui.fireresist"), (a) -> cave, bee, EnumButterflyChromosome.FIRE_RESIST, active);
String displayText;
if (type == EnumBeeType.PRINCESS || type == EnumBeeType.QUEEN) {
String displayTextKey = "for.bees.stock.pristine";
if (!bee.isNatural()) {
displayTextKey = "for.bees.stock.ignoble";
}
displayText = Translator.translateToLocal(displayTextKey);
elementHelper.addText(displayText, GuiElementAlignment.CENTER, ColourProperties.INSTANCE.get("gui.beealyzer.binomial"));
}
}
Aggregations