diff options
Diffstat (limited to 'src/Java/binnie/extrabees/gui/database')
8 files changed, 727 insertions, 0 deletions
diff --git a/src/Java/binnie/extrabees/gui/database/ControlBiomes.java b/src/Java/binnie/extrabees/gui/database/ControlBiomes.java new file mode 100644 index 0000000000..1299df72ca --- /dev/null +++ b/src/Java/binnie/extrabees/gui/database/ControlBiomes.java @@ -0,0 +1,75 @@ +package binnie.extrabees.gui.database; + +import binnie.Binnie; +import binnie.core.BinnieCore; +import binnie.core.genetics.ManagerGenetics; +import binnie.core.proxy.BinnieProxy; +import binnie.craftgui.controls.core.Control; +import binnie.craftgui.core.Attribute; +import binnie.craftgui.core.CraftGUI; +import binnie.craftgui.core.ITooltip; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.Tooltip; +import binnie.craftgui.core.geometry.IArea; +import binnie.craftgui.core.geometry.IPoint; +import binnie.craftgui.core.renderer.Renderer; +import binnie.craftgui.resource.minecraft.CraftGUITexture; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.apiculture.IBee; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeRoot; +import java.util.ArrayList; +import java.util.List; +import net.minecraft.world.biome.BiomeGenBase; + +public class ControlBiomes + extends Control + implements ITooltip +{ + public ControlBiomes(IWidget parent, int x, int y, int width, int height) + { + super(parent, x, y, width * 16, height * 16); + addAttribute(Attribute.MouseOver); + } + + List<Integer> tolerated = new ArrayList(); + + public void getTooltip(Tooltip list) + { + if (this.tolerated.isEmpty()) { + return; + } + int x = (int)(getRelativeMousePosition().x() / 16.0F); + int y = (int)(getRelativeMousePosition().y() / 16.0F); + + int i = x + y * 8; + if (i < this.tolerated.size()) { + list.add(BiomeGenBase.getBiome(((Integer)this.tolerated.get(i)).intValue()).biomeName); + } + } + + public void onRenderForeground() + { + for (int i = 0; i < this.tolerated.size(); i++) + { + int x = i % 8 * 16; + int y = i / 8 * 16; + if (BiomeGenBase.getBiome(i) != null) { + CraftGUI.Render.colour(BiomeGenBase.getBiome(i).color); + } + CraftGUI.Render.texture(CraftGUITexture.Button, new IArea(x, y, 16.0F, 16.0F)); + } + } + + public void setSpecies(IAlleleBeeSpecies species) + { + this.tolerated.clear(); + if (species == null) { + return; + } + IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID())); + + + IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome); + } +} diff --git a/src/Java/binnie/extrabees/gui/database/ControlClimateBar.java b/src/Java/binnie/extrabees/gui/database/ControlClimateBar.java new file mode 100644 index 0000000000..688bbd40c5 --- /dev/null +++ b/src/Java/binnie/extrabees/gui/database/ControlClimateBar.java @@ -0,0 +1,153 @@ +package binnie.extrabees.gui.database; + +import binnie.Binnie; +import binnie.core.genetics.ManagerGenetics; +import binnie.craftgui.controls.core.Control; +import binnie.craftgui.core.Attribute; +import binnie.craftgui.core.CraftGUI; +import binnie.craftgui.core.ITooltip; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.Tooltip; +import binnie.craftgui.core.geometry.IArea; +import binnie.craftgui.core.geometry.IPoint; +import binnie.craftgui.core.renderer.Renderer; +import binnie.craftgui.resource.minecraft.CraftGUITexture; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeRoot; +import forestry.api.core.EnumHumidity; +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.EnumTolerance; +import java.util.ArrayList; +import java.util.List; + +public class ControlClimateBar + extends Control + implements ITooltip +{ + public ControlClimateBar(IWidget parent, int x, int y, int width, int height) + { + super(parent, x, y, width, height); + addAttribute(Attribute.MouseOver); + } + + public ControlClimateBar(IWidget parent, int x, int y, int width, int height, boolean humidity) + { + super(parent, x, y, width, height); + addAttribute(Attribute.MouseOver); + this.isHumidity = true; + } + + boolean isHumidity = false; + List<Integer> tolerated = new ArrayList(); + + public void getTooltip(Tooltip list) + { + if (this.tolerated.isEmpty()) { + return; + } + int types = this.isHumidity ? 3 : 6; + + int type = (int)((int)(getRelativeMousePosition().x() - 1.0F) / ((getSize().x() - 2.0F) / types)); + if (!this.tolerated.contains(Integer.valueOf(type))) { + return; + } + if (type < types) { + if (this.isHumidity) { + list.add(EnumHumidity.values()[type].name); + } else { + list.add(EnumTemperature.values()[(type + 1)].name); + } + } + } + + int[] tempColours = { 65531, 7912447, 5242672, 16776960, 16753152, 16711680 }; + int[] humidColours = { 16770979, 1769216, 3177727 }; + + public void onRenderBackground() + { + CraftGUI.Render.texture(CraftGUITexture.EnergyBarBack, getArea()); + + int types = this.isHumidity ? 3 : 6; + int w = (int)((getSize().x() - 2.0F) / types); + for (int i = 0; i < types; i++) + { + int x = i * w; + if (this.tolerated.contains(Integer.valueOf(i))) + { + int colour = 0; + if (this.isHumidity) { + colour = this.humidColours[i]; + } else { + colour = this.tempColours[i]; + } + CraftGUI.Render.solid(new IArea(x + 1, 1.0F, w, getSize().y() - 2.0F), colour); + } + } + CraftGUI.Render.texture(CraftGUITexture.EnergyBarGlass, getArea()); + } + + public void setSpecies(IAlleleBeeSpecies species) + { + this.tolerated.clear(); + if (species == null) { + return; + } + EnumTolerance tolerance; + int main; + EnumTolerance tolerance; + if (!this.isHumidity) + { + int main = species.getTemperature().ordinal() - 1; + IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID())); + + + tolerance = genome.getToleranceTemp(); + } + else + { + main = species.getHumidity().ordinal(); + IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID())); + + + tolerance = genome.getToleranceHumid(); + } + this.tolerated.add(Integer.valueOf(main)); + switch (1.$SwitchMap$forestry$api$genetics$EnumTolerance[tolerance.ordinal()]) + { + case 1: + case 2: + this.tolerated.add(Integer.valueOf(main + 5)); + case 3: + case 4: + this.tolerated.add(Integer.valueOf(main + 4)); + case 5: + case 6: + this.tolerated.add(Integer.valueOf(main + 3)); + case 7: + case 8: + this.tolerated.add(Integer.valueOf(main + 2)); + case 9: + case 10: + this.tolerated.add(Integer.valueOf(main + 1)); + } + switch (1.$SwitchMap$forestry$api$genetics$EnumTolerance[tolerance.ordinal()]) + { + case 1: + case 11: + this.tolerated.add(Integer.valueOf(main - 5)); + case 3: + case 12: + this.tolerated.add(Integer.valueOf(main - 4)); + case 5: + case 13: + this.tolerated.add(Integer.valueOf(main - 3)); + case 7: + case 14: + this.tolerated.add(Integer.valueOf(main - 2)); + case 9: + case 15: + this.tolerated.add(Integer.valueOf(main - 1)); + } + } +} diff --git a/src/Java/binnie/extrabees/gui/database/ControlProductsBox.java b/src/Java/binnie/extrabees/gui/database/ControlProductsBox.java new file mode 100644 index 0000000000..f6103f9bba --- /dev/null +++ b/src/Java/binnie/extrabees/gui/database/ControlProductsBox.java @@ -0,0 +1,92 @@ +package binnie.extrabees.gui.database; + +import binnie.Binnie; +import binnie.core.BinnieCore; +import binnie.core.genetics.ManagerGenetics; +import binnie.core.proxy.BinnieProxy; +import binnie.craftgui.controls.listbox.ControlList; +import binnie.craftgui.controls.listbox.ControlListBox; +import binnie.craftgui.core.IWidget; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeRoot; +import forestry.api.apiculture.IBeekeepingMode; +import forestry.api.genetics.IAllele; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import net.minecraft.item.ItemStack; + +public class ControlProductsBox + extends ControlListBox<Product> +{ + private int index; + private Type type; + + public IWidget createOption(Product value, int y) + { + return new ControlProductsItem((ControlList)getContent(), value, y); + } + + static enum Type + { + Products, Specialties; + + private Type() {} + } + + class Product + { + ItemStack item; + float chance; + + public Product(ItemStack item, float chance) + { + this.item = item; + this.chance = chance; + } + } + + public ControlProductsBox(IWidget parent, int x, int y, int width, int height, Type type) + { + super(parent, x, y, width, height, 12.0F); + this.type = type; + } + + IAlleleBeeSpecies species = null; + + public void setSpecies(IAlleleBeeSpecies species) + { + if (species != this.species) + { + this.species = species; + if (species != null) + { + IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()); + if (template == null) { + return; + } + IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template); + + float speed = genome.getSpeed(); + + float modeSpeed = Binnie.Genetics.getBeeRoot().getBeekeepingMode(BinnieCore.proxy.getWorld()).getProductionModifier(genome, 1.0F); + + + + List<Product> strings = new ArrayList(); + if (this.type == Type.Products) { + for (Map.Entry<ItemStack, Integer> entry : species.getProducts().entrySet()) { + strings.add(new Product((ItemStack)entry.getKey(), speed * modeSpeed * ((Integer)entry.getValue()).intValue())); + } + } else { + for (Map.Entry<ItemStack, Integer> entry : species.getSpecialty().entrySet()) { + strings.add(new Product((ItemStack)entry.getKey(), speed * modeSpeed * ((Integer)entry.getValue()).intValue())); + } + } + setOptions(strings); + } + } + } +} diff --git a/src/Java/binnie/extrabees/gui/database/ControlProductsItem.java b/src/Java/binnie/extrabees/gui/database/ControlProductsItem.java new file mode 100644 index 0000000000..4f449e3558 --- /dev/null +++ b/src/Java/binnie/extrabees/gui/database/ControlProductsItem.java @@ -0,0 +1,44 @@ +package binnie.extrabees.gui.database; + +import binnie.craftgui.controls.ControlText; +import binnie.craftgui.controls.ControlTextCentered; +import binnie.craftgui.controls.listbox.ControlList; +import binnie.craftgui.controls.listbox.ControlOption; +import binnie.craftgui.core.geometry.CraftGUIUtil; +import binnie.craftgui.core.geometry.IPoint; +import binnie.craftgui.minecraft.control.ControlItemDisplay; +import java.text.DecimalFormat; + +public class ControlProductsItem + extends ControlOption<ControlProductsBox.Product> +{ + ControlItemDisplay item; + + public ControlProductsItem(ControlList<ControlProductsBox.Product> controlList, ControlProductsBox.Product value, int y) + { + super(controlList, value, y); + this.item = new ControlItemDisplay(this, 4.0F, 4.0F); + this.item.setTooltip(); + + ControlText textWidget = new ControlTextCentered(this, 2.0F, ""); + CraftGUIUtil.moveWidget(textWidget, new IPoint(12.0F, 0.0F)); + if (value != null) + { + this.item.setItemStack(value.item); + float time = (int)(55000.0D / value.chance); + + float seconds = time / 20.0F; + float minutes = seconds / 60.0F; + float hours = minutes / 60.0F; + + DecimalFormat df = new DecimalFormat("#.0"); + if (hours > 1.0F) { + textWidget.setValue("Every " + df.format(hours) + " hours"); + } else if (minutes > 1.0F) { + textWidget.setValue("Every " + df.format(minutes) + " min."); + } else { + textWidget.setValue("Every " + df.format(seconds) + " sec."); + } + } + } +} diff --git a/src/Java/binnie/extrabees/gui/database/PageSpeciesClimate.java b/src/Java/binnie/extrabees/gui/database/PageSpeciesClimate.java new file mode 100644 index 0000000000..3b93ff1b3c --- /dev/null +++ b/src/Java/binnie/extrabees/gui/database/PageSpeciesClimate.java @@ -0,0 +1,36 @@ +package binnie.extrabees.gui.database; + +import binnie.craftgui.controls.ControlTextCentered; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.mod.database.DatabaseTab; +import binnie.craftgui.mod.database.PageSpecies; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.genetics.IAlleleSpecies; + +public class PageSpeciesClimate + extends PageSpecies +{ + ControlClimateBar tempBar; + ControlClimateBar humidBar; + ControlBiomes biomes; + + public PageSpeciesClimate(IWidget parent, DatabaseTab tab) + { + super(parent, tab); + + new ControlTextCentered(this, 8.0F, "Climate"); + + this.tempBar = new ControlClimateBar(this, 8, 24, 128, 12); + this.humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true); + new ControlTextCentered(this, 70.0F, "Biomes"); + + this.biomes = new ControlBiomes(this, 8, 90, 8, 4); + } + + public void onValueChanged(IAlleleSpecies species) + { + this.tempBar.setSpecies((IAlleleBeeSpecies)species); + this.humidBar.setSpecies((IAlleleBeeSpecies)species); + this.biomes.setSpecies((IAlleleBeeSpecies)species); + } +} diff --git a/src/Java/binnie/extrabees/gui/database/PageSpeciesGenome.java b/src/Java/binnie/extrabees/gui/database/PageSpeciesGenome.java new file mode 100644 index 0000000000..a69e528d51 --- /dev/null +++ b/src/Java/binnie/extrabees/gui/database/PageSpeciesGenome.java @@ -0,0 +1,206 @@ +package binnie.extrabees.gui.database; + +import binnie.Binnie; +import binnie.core.BinnieCore; +import binnie.core.genetics.ManagerGenetics; +import binnie.core.proxy.BinnieProxy; +import binnie.craftgui.controls.ControlText; +import binnie.craftgui.controls.ControlTextCentered; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.core.geometry.IArea; +import binnie.craftgui.core.geometry.TextJustification; +import binnie.craftgui.mod.database.DatabaseTab; +import binnie.craftgui.mod.database.PageSpecies; +import forestry.api.apiculture.IAlleleBeeEffect; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.apiculture.IBee; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeRoot; +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IAlleleSpecies; +import forestry.api.genetics.IFlowerProvider; + +public class PageSpeciesGenome + extends PageSpecies +{ + ControlText pageSpeciesGenome_Title; + ControlText pageSpeciesGenome_SpeedText; + ControlText pageSpeciesGenome_LifespanText; + ControlText pageSpeciesGenome_FertilityText; + ControlText pageSpeciesGenome_FloweringText; + ControlText pageSpeciesGenome_TerritoryText; + ControlText pageSpeciesGenome_NocturnalText; + ControlText pageSpeciesGenome_CaveDwellingText; + ControlText pageSpeciesGenome_TolerantFlyerText; + ControlText pageSpeciesGenome_FlowerText; + ControlText pageSpeciesGenome_EffectText; + + public PageSpeciesGenome(IWidget parent, DatabaseTab tab) + { + super(parent, tab); + + this.pageSpeciesGenome_Title = new ControlTextCentered(this, 8.0F, "Genome"); + + new ControlText(this, new IArea(0.0F, 32.0F, 68.0F, 30.0F), "Speed:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 44.0F, 68.0F, 30.0F), "Lifespan:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 56.0F, 68.0F, 30.0F), "Fertility:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 68.0F, 68.0F, 30.0F), "Flowering:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 80.0F, 68.0F, 30.0F), "Territory:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 97.0F, 68.0F, 30.0F), "Behavior:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 109.0F, 68.0F, 30.0F), "Sunlight:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 121.0F, 68.0F, 30.0F), "Rain:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 138.0F, 68.0F, 30.0F), "Flower:", TextJustification.TopRight); + new ControlText(this, new IArea(0.0F, 155.0F, 68.0F, 30.0F), "Effect:", TextJustification.TopRight); + + int x = 72; + + this.pageSpeciesGenome_SpeedText = new ControlText(this, new IArea(x, 32.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_LifespanText = new ControlText(this, new IArea(x, 44.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_FertilityText = new ControlText(this, new IArea(x, 56.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_FloweringText = new ControlText(this, new IArea(x, 68.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_TerritoryText = new ControlText(this, new IArea(x, 80.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_NocturnalText = new ControlText(this, new IArea(x, 97.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_CaveDwellingText = new ControlText(this, new IArea(x, 109.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_TolerantFlyerText = new ControlText(this, new IArea(x, 121.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_FlowerText = new ControlText(this, new IArea(x, 138.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + + this.pageSpeciesGenome_EffectText = new ControlText(this, new IArea(x, 155.0F, 72.0F, 30.0F), "", TextJustification.TopLeft); + } + + public void onValueChanged(IAlleleSpecies species) + { + IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()); + if (template != null) + { + IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template); + + IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome); + + + this.pageSpeciesGenome_SpeedText.setValue(rateSpeed(genome.getSpeed())); + this.pageSpeciesGenome_LifespanText.setValue(rateLifespan(genome.getLifespan())); + + this.pageSpeciesGenome_FertilityText.setValue(genome.getFertility() + " children"); + + this.pageSpeciesGenome_FloweringText.setValue(rateFlowering(genome.getFlowering())); + int[] area = genome.getTerritory(); + this.pageSpeciesGenome_TerritoryText.setValue(area[0] + "x" + area[1] + "x" + area[2]); + + + String behavior = "Daytime"; + if (genome.getPrimary().isNocturnal()) { + behavior = "Nighttime"; + } + if (genome.getNocturnal()) { + behavior = "All Day"; + } + this.pageSpeciesGenome_NocturnalText.setValue(behavior); + if (genome.getCaveDwelling()) { + this.pageSpeciesGenome_CaveDwellingText.setValue("Not Needed"); + } else { + this.pageSpeciesGenome_CaveDwellingText.setValue("Required"); + } + this.pageSpeciesGenome_TolerantFlyerText.setValue(tolerated(genome.getTolerantFlyer())); + if (genome.getFlowerProvider() != null) { + this.pageSpeciesGenome_FlowerText.setValue(genome.getFlowerProvider().getDescription()); + } else { + this.pageSpeciesGenome_FlowerText.setValue("None"); + } + this.pageSpeciesGenome_EffectText.setValue(genome.getEffect().getName()); + } + } + + public static String rateFlowering(int flowering) + { + if (flowering >= 99) { + return "Maximum"; + } + if (flowering >= 35) { + return "Fastest"; + } + if (flowering >= 30) { + return "Faster"; + } + if (flowering >= 25) { + return "Fast"; + } + if (flowering >= 20) { + return "Normal"; + } + if (flowering >= 15) { + return "Slow"; + } + if (flowering >= 10) { + return "Slower"; + } + return "Slowest"; + } + + public static String rateSpeed(float speed) + { + if (speed >= 1.7F) { + return "Fastest"; + } + if (speed >= 1.4F) { + return "Faster"; + } + if (speed >= 1.2F) { + return "Fast"; + } + if (speed >= 1.0F) { + return "Normal"; + } + if (speed >= 0.8F) { + return "Slow"; + } + if (speed >= 0.6F) { + return "Slower"; + } + return "Slowest"; + } + + public static String rateLifespan(int life) + { + if (life >= 70) { + return "Longest"; + } + if (life >= 60) { + return "Longer"; + } + if (life >= 50) { + return "Long"; + } + if (life >= 45) { + return "Elongated"; + } + if (life >= 40) { + return "Normal"; + } + if (life >= 35) { + return "Shortened"; + } + if (life >= 30) { + return "Short"; + } + if (life >= 20) { + return "Shorter"; + } + return "Shortest"; + } + + public static String tolerated(boolean t) + { + if (t) { + return "Tolerated"; + } + return "Not Tolerated"; + } +} diff --git a/src/Java/binnie/extrabees/gui/database/PageSpeciesProducts.java b/src/Java/binnie/extrabees/gui/database/PageSpeciesProducts.java new file mode 100644 index 0000000000..f8af0ef3bd --- /dev/null +++ b/src/Java/binnie/extrabees/gui/database/PageSpeciesProducts.java @@ -0,0 +1,38 @@ +package binnie.extrabees.gui.database; + +import binnie.craftgui.controls.ControlText; +import binnie.craftgui.controls.ControlTextCentered; +import binnie.craftgui.core.IWidget; +import binnie.craftgui.mod.database.DatabaseTab; +import binnie.craftgui.mod.database.PageSpecies; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.genetics.IAlleleSpecies; + +public class PageSpeciesProducts + extends PageSpecies +{ + ControlText pageSpeciesProducts_Title; + ControlProductsBox pageSpeciesProducts_Products; + ControlText pageSpeciesProducts_Title2; + ControlProductsBox pageSpeciesProducts_Specialties; + + public PageSpeciesProducts(IWidget parent, DatabaseTab tab) + { + super(parent, tab); + + this.pageSpeciesProducts_Title = new ControlTextCentered(this, 8.0F, "Products"); + + this.pageSpeciesProducts_Products = new ControlProductsBox(this, 4, 20, 136, 48, ControlProductsBox.Type.Products); + + + this.pageSpeciesProducts_Title2 = new ControlTextCentered(this, 68.0F, "Specialties"); + + this.pageSpeciesProducts_Specialties = new ControlProductsBox(this, 4, 80, 136, 48, ControlProductsBox.Type.Specialties); + } + + public void onValueChanged(IAlleleSpecies species) + { + this.pageSpeciesProducts_Products.setSpecies((IAlleleBeeSpecies)species); + this.pageSpeciesProducts_Specialties.setSpecies((IAlleleBeeSpecies)species); + } +} diff --git a/src/Java/binnie/extrabees/gui/database/WindowApiaristDatabase.java b/src/Java/binnie/extrabees/gui/database/WindowApiaristDatabase.java new file mode 100644 index 0000000000..d77ee87251 --- /dev/null +++ b/src/Java/binnie/extrabees/gui/database/WindowApiaristDatabase.java @@ -0,0 +1,83 @@ +package binnie.extrabees.gui.database; + +import binnie.Binnie; +import binnie.core.AbstractMod; +import binnie.core.genetics.ManagerGenetics; +import binnie.craftgui.minecraft.Window; +import binnie.craftgui.mod.database.DatabaseTab; +import binnie.craftgui.mod.database.PageBranchOverview; +import binnie.craftgui.mod.database.PageBranchSpecies; +import binnie.craftgui.mod.database.PageBreeder; +import binnie.craftgui.mod.database.PageSpeciesClassification; +import binnie.craftgui.mod.database.PageSpeciesMutations; +import binnie.craftgui.mod.database.PageSpeciesOverview; +import binnie.craftgui.mod.database.PageSpeciesResultant; +import binnie.craftgui.mod.database.WindowAbstractDatabase; +import binnie.craftgui.mod.database.WindowAbstractDatabase.Mode; +import binnie.extrabees.ExtraBees; +import cpw.mods.fml.relauncher.Side; +import net.minecraft.entity.player.EntityPlayer; + +public class WindowApiaristDatabase + extends WindowAbstractDatabase +{ + static enum SpeciesTab + { + Overview(255), Genome(16776960), Productivity(65535), Climate(16711680), ResultantMutations(16711935), FurtherMutations(65280); + + public int colour; + + private SpeciesTab(int colour) + { + this.colour = colour; + } + } + + static enum BranchesTab + { + Overview(255), Species(16711680); + + public int colour; + + private BranchesTab(int colour) + { + this.colour = colour; + } + } + + protected void addTabs() + { + new PageSpeciesOverview(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.overview", 0)); + new PageSpeciesClassification(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.classification", 0)); + new PageSpeciesGenome(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.genome", 0)); + new PageSpeciesProducts(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.products", 0)); + new PageSpeciesClimate(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.climate", 0)); + new PageSpeciesResultant(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.resultant", 0)); + new PageSpeciesMutations(getInfoPages(WindowAbstractDatabase.Mode.Species), new DatabaseTab(ExtraBees.instance, "species.further", 0)); + + new PageBranchOverview(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(ExtraBees.instance, "branches.overview", 0)); + new PageBranchSpecies(getInfoPages(WindowAbstractDatabase.Mode.Branches), new DatabaseTab(ExtraBees.instance, "branches.species", 0)); + + new PageBreeder(getInfoPages(WindowAbstractDatabase.Mode.Breeder), getUsername(), new DatabaseTab(ExtraBees.instance, "breeder", 0)); + } + + public WindowApiaristDatabase(EntityPlayer player, Side side, boolean nei) + { + super(player, side, nei, Binnie.Genetics.beeBreedingSystem, 110.0F); + } + + public static Window create(EntityPlayer player, Side side, boolean nei) + { + return new WindowApiaristDatabase(player, side, nei); + } + + public AbstractMod getMod() + { + return ExtraBees.instance; + } + + public String getName() + { + return "Database"; + } +} |