mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-18 03:25:07 +00:00
Remove genetics dependency on extrabees
This commit is contained in:
1 parent
60395a0ec7
commit
79ea282f9b
11 files changed
+371
-284
No files matched your search
+77
-51
@@ -2,7 +2,9 @@ package binnie.botany.genetics.gui.analyst;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.botany.api.genetics.IFlowerGenome;
|
||||
import binnie.core.Constants;
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.ITitledWidget;
|
||||
@@ -14,12 +16,14 @@ import binnie.genetics.api.IAnalystPagePlugin;
|
||||
import binnie.genetics.gui.analyst.AnalystConstants;
|
||||
import binnie.genetics.gui.analyst.AnalystPageBiology;
|
||||
import binnie.genetics.gui.analyst.tree.AnalystPageClimate;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class FlowerAnalystPagePlugin implements IAnalystPagePlugin<IFlower>, AnalystPageBiology.IBiologyPlugin<IFlower> {
|
||||
public class FlowerAnalystPagePlugin implements IAnalystPagePlugin<IFlower> {
|
||||
@Override
|
||||
public boolean handles(IIndividual individual) {
|
||||
return individual instanceof IFlower;
|
||||
@@ -28,64 +32,86 @@ public class FlowerAnalystPagePlugin implements IAnalystPagePlugin<IFlower>, Ana
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addAnalystPages(IFlower individual, IWidget parent, IArea pageSize, List<ITitledWidget> analystPages) {
|
||||
analystPages.add(new AnalystPageClimate(parent, pageSize, individual));
|
||||
analystPages.add(new AnalystPageClimate<>(parent, pageSize, individual, new ClimatePlugin()));
|
||||
analystPages.add(new AnalystPageSoil(parent, pageSize, individual));
|
||||
analystPages.add(new AnalystPageBiology<>(parent, pageSize, individual, this));
|
||||
analystPages.add(new AnalystPageBiology<>(parent, pageSize, individual, new BiologyPlugin()));
|
||||
analystPages.add(new AnalystPageAppearance(parent, pageSize, individual));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(IFlower flower, IWidget parent, int y) {
|
||||
y += 10;
|
||||
int butterflySpawn2 = Math.round(Constants.SPAWN_KOEF / (flower.getGenome().getSappiness() * 0.2f));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".mothSpawn", TimeUtil.getTimeString(butterflySpawn2)))
|
||||
.setColor(parent.getColor());
|
||||
y += 30;
|
||||
private static class BiologyPlugin implements AnalystPageBiology.IBiologyPlugin<IFlower> {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(IFlower flower, IWidget parent, int y) {
|
||||
y += 10;
|
||||
int butterflySpawn2 = Math.round(Constants.SPAWN_KOEF / (flower.getGenome().getSappiness() * 0.2f));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".mothSpawn", TimeUtil.getTimeString(butterflySpawn2)))
|
||||
.setColor(parent.getColor());
|
||||
y += 30;
|
||||
|
||||
int fertility = flower.getGenome().getFertility();
|
||||
float chanceDispersal = 0.8f;
|
||||
chanceDispersal += 0.2f * fertility;
|
||||
if (chanceDispersal > 1.0f) {
|
||||
chanceDispersal = 1.0f;
|
||||
int fertility = flower.getGenome().getFertility();
|
||||
float chanceDispersal = 0.8f;
|
||||
chanceDispersal += 0.2f * fertility;
|
||||
if (chanceDispersal > 1.0f) {
|
||||
chanceDispersal = 1.0f;
|
||||
}
|
||||
|
||||
float chancePollinate = 0.6f;
|
||||
chancePollinate += 0.25f * fertility;
|
||||
if (chancePollinate > 1.0f) {
|
||||
chancePollinate = 1.0f;
|
||||
}
|
||||
|
||||
float maxAge = flower.getMaxAge();
|
||||
float ageChance = flower.getGenome().getAgeChance();
|
||||
float dispersalTime = Constants.SPAWN_KOEF / chanceDispersal;
|
||||
float pollinateTime = Constants.SPAWN_KOEF / chancePollinate;
|
||||
float lifespan2 = maxAge * 20.0f * 68.27f / ageChance;
|
||||
float floweringLifespan = (maxAge - 1) * 20.0f * 68.27f / ageChance - Constants.SPAWN_KOEF;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".averageLifespan"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + TimeUtil.getMCDayString(lifespan2))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".seedDispersal"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".perLifetime", (int) (floweringLifespan / dispersalTime)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".pollination"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".perLifetime", (int) (floweringLifespan / pollinateTime)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ClimatePlugin implements AnalystPageClimate.IClimatePlugin<IFlower> {
|
||||
|
||||
@Override
|
||||
public EnumTolerance getTemperatureTolerance(IFlower flower) {
|
||||
IFlowerGenome genome = flower.getGenome();
|
||||
IAlleleTolerance tolerance = (IAlleleTolerance) genome.getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE);
|
||||
return tolerance.getValue();
|
||||
}
|
||||
|
||||
float chancePollinate = 0.6f;
|
||||
chancePollinate += 0.25f * fertility;
|
||||
if (chancePollinate > 1.0f) {
|
||||
chancePollinate = 1.0f;
|
||||
@Override
|
||||
public EnumTolerance getHumidityTolerance(IFlower flower) {
|
||||
return EnumTolerance.BOTH_5;
|
||||
}
|
||||
|
||||
float maxAge = flower.getMaxAge();
|
||||
float ageChance = flower.getGenome().getAgeChance();
|
||||
float dispersalTime = Constants.SPAWN_KOEF / chanceDispersal;
|
||||
float pollinateTime = Constants.SPAWN_KOEF / chancePollinate;
|
||||
float lifespan2 = maxAge * 20.0f * 68.27f / ageChance;
|
||||
float floweringLifespan = (maxAge - 1) * 20.0f * 68.27f / ageChance - Constants.SPAWN_KOEF;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".averageLifespan"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + TimeUtil.getMCDayString(lifespan2))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".seedDispersal"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".perLifetime", (int) (floweringLifespan / dispersalTime)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".pollination"))
|
||||
.setColor(parent.getColor());
|
||||
y += 12;
|
||||
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".perLifetime", (int) (floweringLifespan / pollinateTime)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
@Override
|
||||
public boolean showHumiditySection() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.genetics.IBreedingTracker;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -123,6 +124,15 @@ public class ManagerGenetics extends ManagerBase {
|
||||
return this.BREEDING_SYSTEMS.values();
|
||||
}
|
||||
|
||||
public IBreedingSystem getFirstActiveSystem() {
|
||||
Collection<IBreedingSystem> activeSystems = getActiveSystems();
|
||||
IBreedingSystem first = Iterables.getFirst(activeSystems, null);
|
||||
if (first == null) {
|
||||
throw new IllegalStateException("There are no breeding systems");
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
public void registerBreedingSystem(final IBreedingSystem system) {
|
||||
this.BREEDING_SYSTEMS.put(system.getSpeciesRoot(), system);
|
||||
}
|
||||
|
||||
+111
-81
@@ -19,8 +19,12 @@ import binnie.genetics.gui.analyst.AnalystPageBehaviour;
|
||||
import binnie.genetics.gui.analyst.AnalystPageBiology;
|
||||
import binnie.genetics.gui.analyst.tree.AnalystPageClimate;
|
||||
import binnie.genetics.item.ModuleItems;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IAlleleBeeEffect;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
@@ -28,7 +32,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class AnalystPagePlugin implements IAnalystPagePlugin<IBee>, AnalystPageBiology.IBiologyPlugin<IBee>, AnalystPageBehaviour.IBehaviourPlugin<IBee> {
|
||||
public class AnalystPagePlugin implements IAnalystPagePlugin<IBee> {
|
||||
@Override
|
||||
public boolean handles(IIndividual individual) {
|
||||
return individual instanceof IBee;
|
||||
@@ -37,97 +41,123 @@ public class AnalystPagePlugin implements IAnalystPagePlugin<IBee>, AnalystPageB
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addAnalystPages(IBee individual, IWidget parent, IArea pageSize, List<ITitledWidget> analystPages) {
|
||||
analystPages.add(new AnalystPageClimate(parent, pageSize, individual));
|
||||
analystPages.add(new AnalystPageClimate<>(parent, pageSize, individual, new ClimatePlugin()));
|
||||
analystPages.add(new AnalystPageBeeProducts(parent, pageSize, individual));
|
||||
analystPages.add(new AnalystPageBiology<>(parent, pageSize, individual, this));
|
||||
analystPages.add(new AnalystPageBehaviour<>(parent, pageSize, individual, this));
|
||||
analystPages.add(new AnalystPageBiology<>(parent, pageSize, individual, new BiologyPlugin()));
|
||||
analystPages.add(new AnalystPageBehaviour<>(parent, pageSize, individual, new BehaviorPlugin()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(IBee bee, IWidget parent, int y) {
|
||||
if (bee.getGenome().getNeverSleeps()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconAllDay)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".allDay"));
|
||||
} else if (bee.getGenome().getPrimary().isNocturnal()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconNight)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".night"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconDaytime)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".day"));
|
||||
}
|
||||
private static class BiologyPlugin implements AnalystPageBiology.IBiologyPlugin<IBee> {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(IBee bee, IWidget parent, int y) {
|
||||
if (bee.getGenome().getNeverSleeps()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconAllDay)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".allDay"));
|
||||
} else if (bee.getGenome().getPrimary().isNocturnal()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconNight)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".night"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconDaytime)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".day"));
|
||||
}
|
||||
|
||||
if (!bee.getGenome().getToleratesRain()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 24, y, ModuleItems.iconNoRain)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notRain"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 24, y, ModuleItems.iconRain)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".rain"));
|
||||
}
|
||||
if (!bee.getGenome().getToleratesRain()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 24, y, ModuleItems.iconNoRain)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notRain"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 24, y, ModuleItems.iconRain)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".rain"));
|
||||
}
|
||||
|
||||
if (bee.getGenome().getCaveDwelling()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 48, y, ModuleItems.iconNoSky)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".underground"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 48, y, ModuleItems.iconSky)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notUnderground"));
|
||||
}
|
||||
y += 30;
|
||||
if (bee.getGenome().getCaveDwelling()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 48, y, ModuleItems.iconNoSky)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".underground"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 48, y, ModuleItems.iconSky)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notUnderground"));
|
||||
}
|
||||
y += 30;
|
||||
|
||||
int fertility = bee.getGenome().getFertility();
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.drones", fertility))
|
||||
int fertility = bee.getGenome().getFertility();
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.drones", fertility))
|
||||
.setColor(parent.getColor());
|
||||
} else {
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.drone"))
|
||||
.setColor(parent.getColor());
|
||||
}
|
||||
|
||||
y += 22;
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".averageLifespan"))
|
||||
.setColor(parent.getColor());
|
||||
} else {
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.drone"))
|
||||
.setColor(parent.getColor());
|
||||
}
|
||||
|
||||
y += 22;
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".averageLifespan"))
|
||||
.setColor(parent.getColor());
|
||||
|
||||
y += 12;
|
||||
int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + TimeUtil.getMCDayString(lifespan * (bee.getGenome().getNeverSleeps() ? 1.0f : 2.0f)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBehaviourPages(IBee bee, IWidget parent, int y) {
|
||||
y += 8;
|
||||
int fertility = bee.getGenome().getFlowering();
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".pollinatesNearby") + "\n" + bee.getGenome().getFlowerProvider().getDescription())
|
||||
.setColor(parent.getColor());
|
||||
y += 20;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".everyTime", TimeUtil.getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100 / fertility)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
IAlleleBeeEffect effect = bee.getGenome().getEffect();
|
||||
Vec3i t = bee.getGenome().getTerritory();
|
||||
if (!effect.getUID().contains("None")) {
|
||||
String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc");
|
||||
String loc = effectDesc.isEmpty()
|
||||
? I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".effect", effect.getAlleleName())
|
||||
: effectDesc;
|
||||
|
||||
new ControlText(parent, new Area(4, y, parent.getWidth() - 8, 0), loc, TextJustification.TOP_CENTER)
|
||||
.setColor(parent.getColor());
|
||||
y += (int) (CraftGUI.RENDER.textHeight(loc, parent.getWidth() - 8) + 1.0f);
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".withinBlocks", (int) (t.getX() / 2.0f)))
|
||||
y += 12;
|
||||
int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + TimeUtil.getMCDayString(lifespan * (bee.getGenome().getNeverSleeps() ? 1.0f : 2.0f)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
private static class BehaviorPlugin implements AnalystPageBehaviour.IBehaviourPlugin<IBee> {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBehaviourPages(IBee bee, IWidget parent, int y) {
|
||||
y += 8;
|
||||
int fertility = bee.getGenome().getFlowering();
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".pollinatesNearby") + "\n" + bee.getGenome().getFlowerProvider().getDescription())
|
||||
.setColor(parent.getColor());
|
||||
y += 20;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".everyTime", TimeUtil.getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100 / fertility)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
IAlleleBeeEffect effect = bee.getGenome().getEffect();
|
||||
Vec3i t = bee.getGenome().getTerritory();
|
||||
if (!effect.getUID().contains("None")) {
|
||||
String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc");
|
||||
String loc = effectDesc.isEmpty()
|
||||
? I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".effect", effect.getAlleleName())
|
||||
: effectDesc;
|
||||
|
||||
new ControlText(parent, new Area(4, y, parent.getWidth() - 8, 0), loc, TextJustification.TOP_CENTER)
|
||||
.setColor(parent.getColor());
|
||||
y += (int) (CraftGUI.RENDER.textHeight(loc, parent.getWidth() - 8) + 1.0f);
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".withinBlocks", (int) (t.getX() / 2.0f)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
}
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".territory", t.getX(), t.getY(), t.getZ()))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ClimatePlugin implements AnalystPageClimate.IClimatePlugin<IBee> {
|
||||
|
||||
@Override
|
||||
public EnumTolerance getTemperatureTolerance(IBee bee) {
|
||||
IBeeGenome genome = bee.getGenome();
|
||||
IAlleleTolerance tolerance = (IAlleleTolerance) genome.getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
return tolerance.getValue();
|
||||
}
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".territory", t.getX(), t.getY(), t.getZ()))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
@Override
|
||||
public EnumTolerance getHumidityTolerance(IBee bee) {
|
||||
IBeeGenome genome = bee.getGenome();
|
||||
IAlleleTolerance tolerance = (IAlleleTolerance) genome.getActiveAllele(EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
return tolerance.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showHumiditySection() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+110
-81
@@ -21,6 +21,8 @@ import binnie.genetics.gui.analyst.AnalystPageBiology;
|
||||
import binnie.genetics.gui.analyst.butterfly.AnalystPageSpecimen;
|
||||
import binnie.genetics.gui.analyst.tree.AnalystPageClimate;
|
||||
import binnie.genetics.item.ModuleItems;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import forestry.api.lepidopterology.IAlleleButterflyEffect;
|
||||
@@ -30,7 +32,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ButterflyAnalystPagePlugin implements IAnalystPagePlugin<IButterfly>, AnalystPageBiology.IBiologyPlugin<IButterfly>, AnalystPageBehaviour.IBehaviourPlugin<IButterfly> {
|
||||
public class ButterflyAnalystPagePlugin implements IAnalystPagePlugin<IButterfly> {
|
||||
@Override
|
||||
public boolean handles(IIndividual individual) {
|
||||
return individual instanceof IButterfly;
|
||||
@@ -39,99 +41,126 @@ public class ButterflyAnalystPagePlugin implements IAnalystPagePlugin<IButterfly
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addAnalystPages(IButterfly individual, IWidget parent, IArea pageSize, List<ITitledWidget> analystPages) {
|
||||
analystPages.add(new AnalystPageClimate(parent, pageSize, individual));
|
||||
analystPages.add(new AnalystPageClimate<>(parent, pageSize, individual, new ClimatePlugin()));
|
||||
analystPages.add(new AnalystPageSpecimen(parent, pageSize, individual));
|
||||
analystPages.add(new AnalystPageBiology<>(parent, pageSize, individual, this));
|
||||
analystPages.add(new AnalystPageBehaviour<>(parent, pageSize, individual, this));
|
||||
analystPages.add(new AnalystPageBiology<>(parent, pageSize, individual, new BiologyPlugin()));
|
||||
analystPages.add(new AnalystPageBehaviour<>(parent, pageSize, individual, new BehaviorPlugin()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(IButterfly butterfly, IWidget parent, int y) {
|
||||
if (butterfly.getGenome().getNocturnal()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconAllDay)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".allDay"));
|
||||
} else if (butterfly.getGenome().getPrimary().isNocturnal()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconNight)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".night"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconDaytime)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".day"));
|
||||
}
|
||||
private static class BiologyPlugin implements AnalystPageBiology.IBiologyPlugin<IButterfly> {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(IButterfly butterfly, IWidget parent, int y) {
|
||||
if (butterfly.getGenome().getNocturnal()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconAllDay)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".allDay"));
|
||||
} else if (butterfly.getGenome().getPrimary().isNocturnal()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconNight)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".night"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2, y, ModuleItems.iconDaytime)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".day"));
|
||||
}
|
||||
|
||||
if (!butterfly.getGenome().getTolerantFlyer()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 24, y, ModuleItems.iconNoRain)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notRain"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 24, y, ModuleItems.iconRain)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".rain"));
|
||||
}
|
||||
if (!butterfly.getGenome().getTolerantFlyer()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 24, y, ModuleItems.iconNoRain)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".notRain"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 24, y, ModuleItems.iconRain)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".rain"));
|
||||
}
|
||||
|
||||
if (butterfly.getGenome().getFireResist()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 48, y, ModuleItems.iconNoFire)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".nonflammable"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 48, y, ModuleItems.iconFire)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".flammable"));
|
||||
}
|
||||
y += 30;
|
||||
if (butterfly.getGenome().getFireResist()) {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 48, y, ModuleItems.iconNoFire)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".nonflammable"));
|
||||
} else {
|
||||
new ControlIconDisplay(parent, (parent.getWidth() - 64) / 2 + 48, y, ModuleItems.iconFire)
|
||||
.addTooltip(I18N.localise(AnalystConstants.BIOLOGY_KEY + ".flammable"));
|
||||
}
|
||||
y += 30;
|
||||
|
||||
int fertility = butterfly.getGenome().getFertility();
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.moths", fertility))
|
||||
int fertility = butterfly.getGenome().getFertility();
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.moths", fertility))
|
||||
.setColor(parent.getColor());
|
||||
} else {
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.moth"))
|
||||
.setColor(parent.getColor());
|
||||
}
|
||||
|
||||
y += 32;
|
||||
float caterpillarMatureTime = Constants.SPAWN_KOEF * Math.round(butterfly.getGenome().getLifespan() / (butterfly.getGenome().getFertility() * 2));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".caterpillarGestation"))
|
||||
.setColor(parent.getColor());
|
||||
} else {
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.moth"))
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + TimeUtil.getMCDayString(caterpillarMatureTime))
|
||||
.setColor(parent.getColor());
|
||||
|
||||
y += 22;
|
||||
int speed = (int) (20.0f * butterfly.getGenome().getSpeed());
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".flightSpeed"))
|
||||
.setColor(parent.getColor());
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".blocksPerSec", speed))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
}
|
||||
|
||||
y += 32;
|
||||
float caterpillarMatureTime = Constants.SPAWN_KOEF * Math.round(butterfly.getGenome().getLifespan() / (butterfly.getGenome().getFertility() * 2));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".caterpillarGestation"))
|
||||
.setColor(parent.getColor());
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + TimeUtil.getMCDayString(caterpillarMatureTime))
|
||||
.setColor(parent.getColor());
|
||||
|
||||
y += 22;
|
||||
int speed = (int) (20.0f * butterfly.getGenome().getSpeed());
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".flightSpeed"))
|
||||
.setColor(parent.getColor());
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(parent, y, TextFormatting.BOLD + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".blocksPerSec", speed))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addBehaviourPages(IButterfly individual, IWidget parent, int y) {
|
||||
IButterflyGenome genome = individual.getGenome();
|
||||
String metabolismAlleleName = ExtraTrees.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, genome.getActiveAllele(EnumButterflyChromosome.METABOLISM));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".metabolism", metabolismAlleleName))
|
||||
.setColor(parent.getColor());
|
||||
y += 20;
|
||||
private static class BehaviorPlugin implements AnalystPageBehaviour.IBehaviourPlugin<IButterfly> {
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".pollinatesNearby") + "\n" + genome.getFlowerProvider().getDescription())
|
||||
.setColor(parent.getColor());
|
||||
y += 20;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".everyTime", TimeUtil.getTimeString(1500)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
IAlleleButterflyEffect effect2 = genome.getEffect();
|
||||
if (!effect2.getUID().contains("None")) {
|
||||
String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc");
|
||||
String loc2 = effectDesc2.isEmpty()
|
||||
? I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".effect", effect2.getAlleleName())
|
||||
: effectDesc2;
|
||||
|
||||
new ControlText(parent, new Area(4, y, parent.getWidth() - 8, 0), loc2, TextJustification.TOP_CENTER)
|
||||
@Override
|
||||
public int addBehaviourPages(IButterfly individual, IWidget parent, int y) {
|
||||
IButterflyGenome genome = individual.getGenome();
|
||||
String metabolismAlleleName = ExtraTrees.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, genome.getActiveAllele(EnumButterflyChromosome.METABOLISM));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".metabolism", metabolismAlleleName))
|
||||
.setColor(parent.getColor());
|
||||
y += 20;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".pollinatesNearby") + "\n" + genome.getFlowerProvider().getDescription())
|
||||
.setColor(parent.getColor());
|
||||
y += 20;
|
||||
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".everyTime", TimeUtil.getTimeString(1500)))
|
||||
.setColor(parent.getColor());
|
||||
y += 22;
|
||||
|
||||
IAlleleButterflyEffect effect2 = genome.getEffect();
|
||||
if (!effect2.getUID().contains("None")) {
|
||||
String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc");
|
||||
String loc2 = effectDesc2.isEmpty()
|
||||
? I18N.localise(AnalystConstants.BEHAVIOUR_KEY + ".effect", effect2.getAlleleName())
|
||||
: effectDesc2;
|
||||
|
||||
new ControlText(parent, new Area(4, y, parent.getWidth() - 8, 0), loc2, TextJustification.TOP_CENTER)
|
||||
.setColor(parent.getColor());
|
||||
}
|
||||
return y;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ClimatePlugin implements AnalystPageClimate.IClimatePlugin<IButterfly> {
|
||||
|
||||
@Override
|
||||
public EnumTolerance getTemperatureTolerance(IButterfly butterfly) {
|
||||
IButterflyGenome genome = butterfly.getGenome();
|
||||
IAlleleTolerance tolerance = (IAlleleTolerance) genome.getActiveAllele(EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
|
||||
return tolerance.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTolerance getHumidityTolerance(IButterfly butterfly) {
|
||||
IButterflyGenome genome = butterfly.getGenome();
|
||||
IAlleleTolerance tolerance = (IAlleleTolerance) genome.getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE);
|
||||
return tolerance.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showHumiditySection() {
|
||||
return true;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
}
|
||||
+29
-27
@@ -20,7 +20,7 @@ import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class TreeAnalystPagePlugin implements IAnalystPagePlugin<ITree>, AnalystPageBiology.IBiologyPlugin<ITree> {
|
||||
public class TreeAnalystPagePlugin implements IAnalystPagePlugin<ITree> {
|
||||
@Override
|
||||
public boolean handles(IIndividual individual) {
|
||||
return individual instanceof ITree;
|
||||
@@ -31,38 +31,40 @@ public class TreeAnalystPagePlugin implements IAnalystPagePlugin<ITree>, Analyst
|
||||
public void addAnalystPages(ITree individual, IWidget parent, IArea pageSize, List<ITitledWidget> analystPages) {
|
||||
analystPages.add(new AnalystPageFruit(parent, pageSize, individual));
|
||||
analystPages.add(new AnalystPageWood(parent, pageSize, individual));
|
||||
analystPages.add(new AnalystPageBiology<>(parent, pageSize, individual, this));
|
||||
analystPages.add(new AnalystPageBiology<>(parent, pageSize, individual, new BiologyPlugin()));
|
||||
analystPages.add(new AnalystPageGrowth(parent, pageSize, individual));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(ITree tree, IWidget parent, int y) {
|
||||
String alleleName = ModuleWood.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, tree.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".sappiness", alleleName))
|
||||
.setColor(parent.getColor());
|
||||
y += 20;
|
||||
private static class BiologyPlugin implements AnalystPageBiology.IBiologyPlugin<ITree> {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int addBiologyPages(ITree tree, IWidget parent, int y) {
|
||||
String alleleName = ModuleWood.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, tree.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS));
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + I18N.localise(AnalystConstants.BIOLOGY_KEY + ".sappiness", alleleName))
|
||||
.setColor(parent.getColor());
|
||||
y += 20;
|
||||
|
||||
int fertility = (int) (1.0f / tree.getGenome().getFertility());
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.leaves", fertility))
|
||||
int fertility = (int) (1.0f / tree.getGenome().getFertility());
|
||||
if (fertility > 1) {
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.leaves", fertility))
|
||||
.setColor(parent.getColor());
|
||||
} else {
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.leaf"))
|
||||
.setColor(parent.getColor());
|
||||
}
|
||||
|
||||
y += 22;
|
||||
int butterflySpawn = Math.round(Constants.SPAWN_KOEF / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".mothSpawn.perLeaf", TimeUtil.getTimeString(butterflySpawn)))
|
||||
.setColor(parent.getColor());
|
||||
} else {
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".fertility.leaf"))
|
||||
|
||||
y += 34;
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".plantTypes")).setColor(parent.getColor());
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + tree.getGenome().getPrimary().getPlantType().toString())
|
||||
.setColor(parent.getColor());
|
||||
return y;
|
||||
}
|
||||
|
||||
y += 22;
|
||||
int butterflySpawn = Math.round(Constants.SPAWN_KOEF / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f));
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".mothSpawn.perLeaf", TimeUtil.getTimeString(butterflySpawn)))
|
||||
.setColor(parent.getColor());
|
||||
|
||||
y += 34;
|
||||
new ControlTextCentered(parent, y, I18N.localise(AnalystConstants.BIOLOGY_KEY + ".plantTypes")).setColor(parent.getColor());
|
||||
|
||||
y += 12;
|
||||
new ControlTextCentered(parent, y, TextFormatting.ITALIC + tree.getGenome().getPrimary().getPlantType().toString())
|
||||
.setColor(parent.getColor());
|
||||
return y;
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,5 @@ dependencies {
|
||||
compile project(":genetics-api")
|
||||
|
||||
// TODO: remove these, they should add on to genetics instead
|
||||
// compile project(":botany")
|
||||
compile project(":botany-api")
|
||||
compile project(":extrabees-api")
|
||||
// compile project(":extratrees")
|
||||
}
|
||||
@@ -4,7 +4,10 @@ import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.ITitledWidget;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract class ControlAnalystPage extends Control implements ITitledWidget {
|
||||
public ControlAnalystPage(IWidget parent, IArea area) {
|
||||
super(parent, area);
|
||||
|
||||
@@ -2,6 +2,7 @@ package binnie.genetics.gui.analyst;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.core.AbstractMod;
|
||||
@@ -27,7 +28,6 @@ import binnie.core.gui.window.Panel;
|
||||
import binnie.core.machines.inventory.SlotValidator;
|
||||
import binnie.core.util.I18N;
|
||||
import binnie.core.util.Log;
|
||||
import binnie.extrabees.api.ExtraBeesAPI;
|
||||
import binnie.genetics.Genetics;
|
||||
import binnie.genetics.api.GeneticsApi;
|
||||
import binnie.genetics.api.IAnalystPagePlugin;
|
||||
@@ -124,8 +124,9 @@ public class WindowAnalyst extends Window {
|
||||
baseWidget = new Widget(this);
|
||||
int x = 16;
|
||||
int y = 28;
|
||||
Collection<IBreedingSystem> activeSystems = Binnie.GENETICS.getActiveSystems();
|
||||
if (isDatabase) {
|
||||
for (IBreedingSystem syst : Binnie.GENETICS.getActiveSystems()) {
|
||||
for (IBreedingSystem syst : activeSystems) {
|
||||
new ControlSystemButton(x, y, this, syst);
|
||||
x += 22;
|
||||
}
|
||||
@@ -161,7 +162,9 @@ public class WindowAnalyst extends Window {
|
||||
};
|
||||
}
|
||||
setIndividual(null);
|
||||
setSystem(ExtraBeesAPI.beeBreedingSystem);
|
||||
|
||||
IBreedingSystem first = Binnie.GENETICS.getFirstActiveSystem();
|
||||
setSystem(first);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -4,23 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import net.minecraft.init.Biomes;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.IAlleleTolerance;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
import forestry.api.lepidopterology.IButterfly;
|
||||
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.botany.api.genetics.IFlower;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import binnie.core.api.gui.IWidget;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import binnie.core.gui.controls.ControlText;
|
||||
import binnie.core.gui.controls.ControlTextCentered;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
@@ -31,28 +16,31 @@ import binnie.genetics.gui.analyst.AnalystConstants;
|
||||
import binnie.genetics.gui.analyst.ControlAnalystPage;
|
||||
import binnie.genetics.gui.analyst.ControlBiome;
|
||||
import binnie.genetics.gui.analyst.ControlToleranceBar;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import net.minecraft.init.Biomes;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
public class AnalystPageClimate extends ControlAnalystPage {
|
||||
public AnalystPageClimate(IWidget parent, IArea area, IIndividual ind) {
|
||||
public class AnalystPageClimate<T extends IIndividual> extends ControlAnalystPage {
|
||||
public interface IClimatePlugin<T extends IIndividual> {
|
||||
EnumTolerance getTemperatureTolerance(T individual);
|
||||
|
||||
EnumTolerance getHumidityTolerance(T individual);
|
||||
|
||||
boolean showHumiditySection();
|
||||
}
|
||||
|
||||
public AnalystPageClimate(IWidget parent, IArea area, T ind, IClimatePlugin<T> plugin) {
|
||||
super(parent, area);
|
||||
setColor(26163);
|
||||
EnumTemperature temp = ind.getGenome().getPrimary().getTemperature();
|
||||
forestry.api.genetics.EnumTolerance tempTol = forestry.api.genetics.EnumTolerance.NONE;
|
||||
EnumTolerance tempTol = plugin.getTemperatureTolerance(ind);
|
||||
EnumHumidity humid = ind.getGenome().getPrimary().getHumidity();
|
||||
forestry.api.genetics.EnumTolerance humidTol = forestry.api.genetics.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 IFlower) {
|
||||
tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumFlowerChromosome.TEMPERATURE_TOLERANCE)).getValue();
|
||||
humidTol = forestry.api.genetics.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();
|
||||
}
|
||||
EnumTolerance humidTol = plugin.getHumidityTolerance(ind);
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor());
|
||||
y += 16;
|
||||
@@ -60,7 +48,7 @@ public class AnalystPageClimate extends ControlAnalystPage {
|
||||
y += 12;
|
||||
createTemperatureBar(this, (getWidth() - 100) / 2, y, 100, 10, temp, tempTol);
|
||||
y += 16;
|
||||
if (!(ind instanceof IFlower)) {
|
||||
if (plugin.showHumiditySection()) {
|
||||
new ControlText(this, new Area(4, y, getWidth() - 8, 14), I18N.localise(AnalystConstants.CLIMATE_KEY + ".hum"), TextJustification.MIDDLE_CENTER).setColor(getColor());
|
||||
y += 12;
|
||||
createHumidity(this, (getWidth() - 100) / 2, y, 100, 10, humid, humidTol);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package binnie.genetics.gui.database.bee;
|
||||
|
||||
import binnie.extrabees.api.ExtraBeesAPI;
|
||||
import binnie.core.Binnie;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -21,7 +21,7 @@ import binnie.genetics.Genetics;
|
||||
|
||||
public class WindowApiaristDatabase extends WindowAbstractDatabase {
|
||||
public WindowApiaristDatabase(EntityPlayer player, Side side, boolean nei) {
|
||||
super(player, side, nei, ExtraBeesAPI.beeBreedingSystem, 110);
|
||||
super(player, side, nei, Binnie.GENETICS.getFirstActiveSystem(), 110);
|
||||
}
|
||||
|
||||
public static Window create(EntityPlayer player, Side side, boolean nei) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import binnie.core.api.genetics.IBreedingSystem;
|
||||
import binnie.core.api.gui.events.EventHandlerOrigin;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.window.WindowMachine;
|
||||
import binnie.extrabees.api.ExtraBeesAPI;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -111,7 +110,7 @@ public class WindowGeneBank extends WindowMachine {
|
||||
});
|
||||
this.genes = new ControlGeneScroll(scroll, 1, 1, geneBoxWidth, 116);
|
||||
scroll.setScrollableContent(this.genes);
|
||||
this.genes.setGenes(ExtraBeesAPI.beeBreedingSystem);
|
||||
this.genes.setGenes(Binnie.GENETICS.getFirstActiveSystem());
|
||||
final ControlTabBar<IBreedingSystem> tabBar = new ControlTabBar<IBreedingSystem>(this, boxX, 32, 24, 120, Alignment.LEFT, Binnie.GENETICS.getActiveSystems()) {
|
||||
@Override
|
||||
public ControlTab<IBreedingSystem> createTab(final int x, final int y, final int w, final int h, final IBreedingSystem value) {
|
||||
@@ -137,7 +136,7 @@ public class WindowGeneBank extends WindowMachine {
|
||||
};
|
||||
}
|
||||
};
|
||||
tabBar.setValue(ExtraBeesAPI.beeBreedingSystem);
|
||||
tabBar.setValue(Binnie.GENETICS.getFirstActiveSystem());
|
||||
boxX -= 8;
|
||||
final ControlTabBar<String> infoTabs = new ControlTabBar<>(this, boxX + 8, 160, 16, 50, Alignment.LEFT, Arrays.asList("Info", "Stats", "Ranking"));
|
||||
final Panel panelProject = new Panel(this, boxX + 24, 160, geneBoxWidth + 20, 50, MinecraftGUI.PanelType.BLACK);
|
||||
|
||||
Reference in new issue
Block a user