mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-25 06:24:26 +00:00
Improve code readability in binnie.extrabees package and other packages
* Improve code readability in binnie.extrabees package and other packages * Fix compile error after refactoring
This commit is contained in:
1 parent
b609d6688f
commit
c09ad04284
95 files changed
+3916
-3900
No files matched your search
@@ -1,31 +1,26 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowAlvearyFrame extends Window
|
||||
{
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
public class WindowAlvearyFrame extends Window {
|
||||
protected Machine machine;
|
||||
protected ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyFrame(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public WindowAlvearyFrame(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(176.0f, 144.0f, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -34,9 +29,9 @@ public class WindowAlvearyFrame extends Window
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Frame Housing");
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
||||
setTitle("Frame Housing");
|
||||
playerInventory = new ControlPlayerInventory(this);
|
||||
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
||||
slot.assign(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +1,27 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.extrabees.apiary.machine.AlvearyHatchery;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlotArray;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlotArray;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.apiary.machine.AlvearyHatchery;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowAlvearyHatchery extends Window
|
||||
{
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
public class WindowAlvearyHatchery extends Window {
|
||||
protected Machine machine;
|
||||
protected ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyHatchery(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public WindowAlvearyHatchery(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(176.0f, 144.0f, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -35,9 +30,9 @@ public class WindowAlvearyHatchery extends Window
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Hatchery");
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlotArray slot = new ControlSlotArray(this, 43, 30, 5, 1);
|
||||
setTitle("Hatchery");
|
||||
playerInventory = new ControlPlayerInventory(this);
|
||||
ControlSlotArray slot = new ControlSlotArray(this, 43, 30, 5, 1);
|
||||
slot.create(AlvearyHatchery.slotLarvae);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowAlvearyIndustrialFrame extends Window
|
||||
{
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
// TODO unused class?
|
||||
public class WindowAlvearyIndustrialFrame extends Window {
|
||||
protected Machine machine;
|
||||
protected ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyIndustrialFrame(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public WindowAlvearyIndustrialFrame(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(176.0f, 144.0f, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -34,9 +30,9 @@ public class WindowAlvearyIndustrialFrame extends Window
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Industrial Frame Housing");
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
||||
setTitle("Industrial Frame Housing");
|
||||
playerInventory = new ControlPlayerInventory(this);
|
||||
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
||||
slot.assign(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +1,32 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMutator;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.apiary.machine.AlvearyMutator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class WindowAlvearyMutator extends Window
|
||||
{
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
public class WindowAlvearyMutator extends Window {
|
||||
protected Machine machine;
|
||||
protected ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyMutator(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public WindowAlvearyMutator(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(176.0f, 176.0f, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -40,21 +35,24 @@ public class WindowAlvearyMutator extends Window
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Mutator");
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
final ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
||||
setTitle("Mutator");
|
||||
playerInventory = new ControlPlayerInventory(this);
|
||||
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
|
||||
slot.assign(0);
|
||||
new ControlText(this, new IArea(0.0f, 52.0f, this.w(), 16.0f), "Possible Mutagens:", TextJustification.MiddleCenter).setColor(5592405);
|
||||
final int size = AlvearyMutator.getMutagens().size();
|
||||
final int w = size * 18;
|
||||
if (size > 0) {
|
||||
float x = (this.w() - w) / 2.0f;
|
||||
for (final ItemStack stack : AlvearyMutator.getMutagens()) {
|
||||
final ControlItemDisplay display = new ControlItemDisplay(this, x, 66.0f);
|
||||
display.setItemStack(stack);
|
||||
display.hastooltip = true;
|
||||
x += 18.0f;
|
||||
}
|
||||
new ControlText(this, new IArea(0.0f, 52.0f, w(), 16.0f), "Possible Mutagens:", TextJustification.MiddleCenter).setColor(5592405);
|
||||
int size = AlvearyMutator.getMutagens().size();
|
||||
int w = size * 18;
|
||||
|
||||
if (size <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
float x = (w() - w) / 2.0f;
|
||||
for (ItemStack stack : AlvearyMutator.getMutagens()) {
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, x, 66.0f);
|
||||
display.setItemStack(stack);
|
||||
display.hastooltip = true;
|
||||
x += 18.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +1,29 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui;
|
||||
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.extrabees.apiary.machine.AlvearyStimulator;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.geometry.Position;
|
||||
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlEnergyBar;
|
||||
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.TileEntityMachine;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.apiary.machine.AlvearyStimulator;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowAlvearyStimulator extends Window
|
||||
{
|
||||
Machine machine;
|
||||
ControlPlayerInventory playerInventory;
|
||||
public class WindowAlvearyStimulator extends Window {
|
||||
protected Machine machine;
|
||||
protected ControlPlayerInventory playerInventory;
|
||||
|
||||
public WindowAlvearyStimulator(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public WindowAlvearyStimulator(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(176.0f, 144.0f, player, inventory, side);
|
||||
this.machine = ((TileEntityMachine) inventory).getMachine();
|
||||
machine = ((TileEntityMachine) inventory).getMachine();
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
if (player == null || inventory == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -37,11 +32,11 @@ public class WindowAlvearyStimulator extends Window
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Stimulator");
|
||||
setTitle("Stimulator");
|
||||
new ControlEnergyBar(this, 75, 29, 60, 16, Position.Left);
|
||||
final ControlSlot slot = new ControlSlot(this, 41.0f, 28.0f);
|
||||
ControlSlot slot = new ControlSlot(this, 41.0f, 28.0f);
|
||||
slot.assign(AlvearyStimulator.slotCircuit);
|
||||
this.playerInventory = new ControlPlayerInventory(this);
|
||||
playerInventory = new ControlPlayerInventory(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,54 +1,51 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.database;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.Binnie;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import java.util.ArrayList;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import java.util.List;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class ControlBiomes extends Control implements ITooltip
|
||||
{
|
||||
List<Integer> tolerated;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public ControlBiomes(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
public class ControlBiomes extends Control implements ITooltip {
|
||||
protected List<Integer> tolerated;
|
||||
|
||||
public ControlBiomes(IWidget parent, int x, int y, int width, int height) {
|
||||
super(parent, x, y, width * 16, height * 16);
|
||||
this.tolerated = new ArrayList<Integer>();
|
||||
this.addAttribute(WidgetAttribute.MouseOver);
|
||||
tolerated = new ArrayList<>();
|
||||
addAttribute(WidgetAttribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltip) {
|
||||
if (this.tolerated.isEmpty()) {
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (tolerated.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final int x = (int) (this.getRelativeMousePosition().x() / 16.0f);
|
||||
final int y = (int) (this.getRelativeMousePosition().y() / 16.0f);
|
||||
final int i = x + y * 8;
|
||||
if (i < this.tolerated.size()) {
|
||||
tooltip.add(BiomeGenBase.getBiome(this.tolerated.get(i)).biomeName);
|
||||
|
||||
int x = (int) (getRelativeMousePosition().x() / 16.0f);
|
||||
int y = (int) (getRelativeMousePosition().y() / 16.0f);
|
||||
int i = x + y * 8;
|
||||
if (i < tolerated.size()) {
|
||||
tooltip.add(BiomeGenBase.getBiome(tolerated.get(i)).biomeName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderForeground() {
|
||||
for (int i = 0; i < this.tolerated.size(); ++i) {
|
||||
final int x = i % 8 * 16;
|
||||
final int y = i / 8 * 16;
|
||||
for (int i = 0; i < 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);
|
||||
}
|
||||
@@ -56,12 +53,14 @@ public class ControlBiomes extends Control implements ITooltip
|
||||
}
|
||||
}
|
||||
|
||||
public void setSpecies(final IAlleleBeeSpecies species) {
|
||||
this.tolerated.clear();
|
||||
public void setSpecies(IAlleleBeeSpecies species) {
|
||||
tolerated.clear();
|
||||
if (species == null) {
|
||||
return;
|
||||
}
|
||||
final IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
|
||||
final IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
|
||||
|
||||
// TODO unused code?
|
||||
IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
|
||||
IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
|
||||
}
|
||||
}
|
||||
@@ -1,156 +1,157 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.database;
|
||||
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import binnie.Binnie;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import java.util.ArrayList;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import java.util.List;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
|
||||
public class ControlClimateBar extends Control implements ITooltip
|
||||
{
|
||||
boolean isHumidity;
|
||||
List<Integer> tolerated;
|
||||
int[] tempColours;
|
||||
int[] humidColours;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public ControlClimateBar(final IWidget parent, final int x, final int y, final int width, final int height) {
|
||||
public class ControlClimateBar extends Control implements ITooltip {
|
||||
protected boolean isHumidity;
|
||||
protected List<Integer> tolerated;
|
||||
protected int[] tempColours;
|
||||
protected int[] humidColours;
|
||||
|
||||
public ControlClimateBar(IWidget parent, int x, int y, int width, int height) {
|
||||
super(parent, x, y, width, height);
|
||||
this.isHumidity = false;
|
||||
this.tolerated = new ArrayList<Integer>();
|
||||
this.tempColours = new int[] { 65531, 7912447, 5242672, 16776960, 16753152, 16711680 };
|
||||
this.humidColours = new int[] { 16770979, 1769216, 3177727 };
|
||||
this.addAttribute(WidgetAttribute.MouseOver);
|
||||
isHumidity = false;
|
||||
tolerated = new ArrayList<>();
|
||||
tempColours = new int[]{0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000};
|
||||
humidColours = new int[]{0xffe7a3, 0x1aff00, 0x307cff};
|
||||
addAttribute(WidgetAttribute.MouseOver);
|
||||
}
|
||||
|
||||
public ControlClimateBar(final IWidget parent, final int x, final int y, final int width, final int height, final boolean humidity) {
|
||||
public ControlClimateBar(IWidget parent, int x, int y, int width, int height, boolean humidity) {
|
||||
super(parent, x, y, width, height);
|
||||
this.isHumidity = false;
|
||||
this.tolerated = new ArrayList<Integer>();
|
||||
this.tempColours = new int[] { 65531, 7912447, 5242672, 16776960, 16753152, 16711680 };
|
||||
this.humidColours = new int[] { 16770979, 1769216, 3177727 };
|
||||
this.addAttribute(WidgetAttribute.MouseOver);
|
||||
this.isHumidity = true;
|
||||
tolerated = new ArrayList<>();
|
||||
tempColours = new int[]{0x00fffb, 0x78bbff, 0x4fff30, 0xffff00, 0xffa200, 0xff0000};
|
||||
humidColours = new int[]{0xffe7a3, 0x1aff00, 0x307cff};
|
||||
addAttribute(WidgetAttribute.MouseOver);
|
||||
isHumidity = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltip) {
|
||||
if (this.tolerated.isEmpty()) {
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (tolerated.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final int types = this.isHumidity ? 3 : 6;
|
||||
final int type = (int) ((int) (this.getRelativeMousePosition().x() - 1.0f) / ((this.getSize().x() - 2.0f) / types));
|
||||
if (!this.tolerated.contains(type)) {
|
||||
|
||||
int types = isHumidity ? 3 : 6;
|
||||
int type = (int) ((int) (getRelativeMousePosition().x() - 1.0f) / ((getSize().x() - 2.0f) / types));
|
||||
if (!tolerated.contains(type) || type >= types) {
|
||||
return;
|
||||
}
|
||||
if (type < types) {
|
||||
if (this.isHumidity) {
|
||||
tooltip.add(EnumHumidity.values()[type].name);
|
||||
}
|
||||
else {
|
||||
tooltip.add(EnumTemperature.values()[type + 1].name);
|
||||
}
|
||||
|
||||
if (isHumidity) {
|
||||
tooltip.add(EnumHumidity.values()[type].name);
|
||||
} else {
|
||||
tooltip.add(EnumTemperature.values()[type + 1].name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.texture(CraftGUITexture.EnergyBarBack, this.getArea());
|
||||
final int types = this.isHumidity ? 3 : 6;
|
||||
final int w = (int) ((this.getSize().x() - 2.0f) / types);
|
||||
CraftGUI.Render.texture(CraftGUITexture.EnergyBarBack, getArea());
|
||||
int types = isHumidity ? 3 : 6;
|
||||
int w = (int) ((getSize().x() - 2.0f) / types);
|
||||
for (int i = 0; i < types; ++i) {
|
||||
final int x = i * w;
|
||||
if (this.tolerated.contains(i)) {
|
||||
int colour = 0;
|
||||
if (this.isHumidity) {
|
||||
colour = this.humidColours[i];
|
||||
int x = i * w;
|
||||
if (tolerated.contains(i)) {
|
||||
int colour;
|
||||
if (isHumidity) {
|
||||
colour = humidColours[i];
|
||||
} else {
|
||||
colour = tempColours[i];
|
||||
}
|
||||
else {
|
||||
colour = this.tempColours[i];
|
||||
}
|
||||
CraftGUI.Render.solid(new IArea(x + 1, 1.0f, w, this.getSize().y() - 2.0f), colour);
|
||||
CraftGUI.Render.solid(new IArea(x + 1, 1.0f, w, getSize().y() - 2.0f), colour);
|
||||
}
|
||||
}
|
||||
CraftGUI.Render.texture(CraftGUITexture.EnergyBarGlass, this.getArea());
|
||||
CraftGUI.Render.texture(CraftGUITexture.EnergyBarGlass, getArea());
|
||||
}
|
||||
|
||||
public void setSpecies(final IAlleleBeeSpecies species) {
|
||||
this.tolerated.clear();
|
||||
public void setSpecies(IAlleleBeeSpecies species) {
|
||||
tolerated.clear();
|
||||
if (species == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int main;
|
||||
EnumTolerance tolerance;
|
||||
if (!this.isHumidity) {
|
||||
if (!isHumidity) {
|
||||
main = species.getTemperature().ordinal() - 1;
|
||||
final IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
|
||||
IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
|
||||
tolerance = genome.getToleranceTemp();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
main = species.getHumidity().ordinal();
|
||||
final IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
|
||||
IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID()));
|
||||
tolerance = genome.getToleranceHumid();
|
||||
}
|
||||
this.tolerated.add(main);
|
||||
|
||||
tolerated.add(main);
|
||||
switch (tolerance) {
|
||||
case BOTH_5:
|
||||
case UP_5: {
|
||||
this.tolerated.add(main + 5);
|
||||
}
|
||||
case BOTH_4:
|
||||
case UP_4: {
|
||||
this.tolerated.add(main + 4);
|
||||
}
|
||||
case BOTH_3:
|
||||
case UP_3: {
|
||||
this.tolerated.add(main + 3);
|
||||
}
|
||||
case BOTH_2:
|
||||
case UP_2: {
|
||||
this.tolerated.add(main + 2);
|
||||
}
|
||||
case BOTH_1:
|
||||
case UP_1: {
|
||||
this.tolerated.add(main + 1);
|
||||
break;
|
||||
}
|
||||
case BOTH_5:
|
||||
case UP_5:
|
||||
tolerated.add(main + 5);
|
||||
break;
|
||||
|
||||
case BOTH_4:
|
||||
case UP_4:
|
||||
tolerated.add(main + 4);
|
||||
break;
|
||||
|
||||
case BOTH_3:
|
||||
case UP_3:
|
||||
tolerated.add(main + 3);
|
||||
break;
|
||||
|
||||
case BOTH_2:
|
||||
case UP_2:
|
||||
tolerated.add(main + 2);
|
||||
break;
|
||||
|
||||
case BOTH_1:
|
||||
case UP_1:
|
||||
tolerated.add(main + 1);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (tolerance) {
|
||||
case BOTH_5:
|
||||
case DOWN_5: {
|
||||
this.tolerated.add(main - 5);
|
||||
}
|
||||
case BOTH_4:
|
||||
case DOWN_4: {
|
||||
this.tolerated.add(main - 4);
|
||||
}
|
||||
case BOTH_3:
|
||||
case DOWN_3: {
|
||||
this.tolerated.add(main - 3);
|
||||
}
|
||||
case BOTH_2:
|
||||
case DOWN_2: {
|
||||
this.tolerated.add(main - 2);
|
||||
}
|
||||
case BOTH_1:
|
||||
case DOWN_1: {
|
||||
this.tolerated.add(main - 1);
|
||||
break;
|
||||
}
|
||||
case BOTH_5:
|
||||
case DOWN_5:
|
||||
tolerated.add(main - 5);
|
||||
break;
|
||||
|
||||
case BOTH_4:
|
||||
case DOWN_4:
|
||||
tolerated.add(main - 4);
|
||||
break;
|
||||
|
||||
case BOTH_3:
|
||||
case DOWN_3:
|
||||
tolerated.add(main - 3);
|
||||
break;
|
||||
|
||||
case BOTH_2:
|
||||
case DOWN_2:
|
||||
tolerated.add(main - 2);
|
||||
break;
|
||||
|
||||
case BOTH_1:
|
||||
case DOWN_1:
|
||||
tolerated.add(main - 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,74 +1,73 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.database;
|
||||
|
||||
import java.util.List;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.Binnie;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import binnie.core.craftgui.controls.listbox.ControlListBox;
|
||||
|
||||
public class ControlProductsBox extends ControlListBox<ControlProductsBox.Product>
|
||||
{
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ControlProductsBox extends ControlListBox<ControlProductsBox.Product> {
|
||||
protected IAlleleBeeSpecies species;
|
||||
|
||||
private int index;
|
||||
private Type type;
|
||||
IAlleleBeeSpecies species;
|
||||
|
||||
@Override
|
||||
public IWidget createOption(final Product value, final int y) {
|
||||
return new ControlProductsItem(getContent(), value, y);
|
||||
}
|
||||
|
||||
public ControlProductsBox(final IWidget parent, final int x, final int y, final int width, final int height, final Type type) {
|
||||
public ControlProductsBox(IWidget parent, int x, int y, int width, int height, Type type) {
|
||||
super(parent, x, y, width, height, 12.0f);
|
||||
this.species = null;
|
||||
species = null;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setSpecies(final IAlleleBeeSpecies species) {
|
||||
@Override
|
||||
public IWidget createOption(Product value, int y) {
|
||||
return new ControlProductsItem(getContent(), value, y);
|
||||
}
|
||||
|
||||
public void setSpecies(IAlleleBeeSpecies species) {
|
||||
if (species != this.species && (this.species = species) != null) {
|
||||
final IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
|
||||
IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
|
||||
if (template == null) {
|
||||
return;
|
||||
}
|
||||
final IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
|
||||
final float speed = genome.getSpeed();
|
||||
final float modeSpeed = Binnie.Genetics.getBeeRoot().getBeekeepingMode(BinnieCore.proxy.getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f);
|
||||
final List<Product> strings = new ArrayList<Product>();
|
||||
if (this.type == Type.Products) {
|
||||
for (final Map.Entry<ItemStack, Float> entry : species.getProductChances().entrySet()) {
|
||||
|
||||
IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
|
||||
float speed = genome.getSpeed();
|
||||
float modeSpeed = Binnie.Genetics.getBeeRoot()
|
||||
.getBeekeepingMode(BinnieCore.proxy.getWorld())
|
||||
.getBeeModifier()
|
||||
.getProductionModifier(genome, 1.0f);
|
||||
|
||||
List<Product> strings = new ArrayList<>();
|
||||
if (type == Type.Products) {
|
||||
for (Map.Entry<ItemStack, Float> entry : species.getProductChances().entrySet()) {
|
||||
strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue()));
|
||||
}
|
||||
} else {
|
||||
for (Map.Entry<ItemStack, Float> entry : species.getSpecialtyChances().entrySet()) {
|
||||
strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (final Map.Entry<ItemStack, Float> entry : species.getSpecialtyChances().entrySet()) {
|
||||
strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue()));
|
||||
}
|
||||
}
|
||||
this.setOptions(strings);
|
||||
setOptions(strings);
|
||||
}
|
||||
}
|
||||
|
||||
enum Type
|
||||
{
|
||||
enum Type {
|
||||
Products,
|
||||
Specialties;
|
||||
Specialties
|
||||
}
|
||||
|
||||
class Product
|
||||
{
|
||||
ItemStack item;
|
||||
float chance;
|
||||
class Product {
|
||||
protected ItemStack item;
|
||||
protected float chance;
|
||||
|
||||
public Product(final ItemStack item, final float chance) {
|
||||
public Product(ItemStack item, float chance) {
|
||||
this.item = item;
|
||||
this.chance = chance;
|
||||
}
|
||||
|
||||
@@ -1,43 +1,41 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.database;
|
||||
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import java.text.DecimalFormat;
|
||||
import binnie.core.craftgui.geometry.CraftGUIUtil;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.controls.listbox.ControlList;
|
||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.core.craftgui.controls.listbox.ControlOption;
|
||||
import binnie.core.craftgui.geometry.CraftGUIUtil;
|
||||
import binnie.core.craftgui.geometry.IPoint;
|
||||
import binnie.core.craftgui.minecraft.control.ControlItemDisplay;
|
||||
|
||||
public class ControlProductsItem extends ControlOption<ControlProductsBox.Product>
|
||||
{
|
||||
ControlItemDisplay item;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public ControlProductsItem(final ControlList<ControlProductsBox.Product> controlList, final ControlProductsBox.Product value, final int y) {
|
||||
public class ControlProductsItem extends ControlOption<ControlProductsBox.Product> {
|
||||
protected 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)).setTooltip();
|
||||
final ControlText textWidget = new ControlTextCentered(this, 2.0f, "");
|
||||
(item = new ControlItemDisplay(this, 4.0f, 4.0f)).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);
|
||||
final float time = (int) (55000.0 / value.chance);
|
||||
final float seconds = time / 20.0f;
|
||||
final float minutes = seconds / 60.0f;
|
||||
final float hours = minutes / 60.0f;
|
||||
final 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.");
|
||||
}
|
||||
|
||||
if (value == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
item.setItemStack(value.item);
|
||||
float time = (int) (55000.0 / 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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,30 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.database;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.database.PageSpecies;
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
|
||||
public class PageSpeciesClimate extends PageSpecies
|
||||
{
|
||||
ControlClimateBar tempBar;
|
||||
ControlClimateBar humidBar;
|
||||
ControlBiomes biomes;
|
||||
public class PageSpeciesClimate extends PageSpecies {
|
||||
protected ControlClimateBar tempBar;
|
||||
protected ControlClimateBar humidBar;
|
||||
protected ControlBiomes biomes;
|
||||
|
||||
public PageSpeciesClimate(final IWidget parent, final DatabaseTab tab) {
|
||||
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);
|
||||
tempBar = new ControlClimateBar(this, 8, 24, 128, 12);
|
||||
humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true);
|
||||
new ControlTextCentered(this, 70.0f, "Biomes");
|
||||
this.biomes = new ControlBiomes(this, 8, 90, 8, 4);
|
||||
biomes = new ControlBiomes(this, 8, 90, 8, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(final IAlleleSpecies species) {
|
||||
this.tempBar.setSpecies((IAlleleBeeSpecies) species);
|
||||
this.humidBar.setSpecies((IAlleleBeeSpecies) species);
|
||||
this.biomes.setSpecies((IAlleleBeeSpecies) species);
|
||||
public void onValueChanged(IAlleleSpecies species) {
|
||||
tempBar.setSpecies((IAlleleBeeSpecies) species);
|
||||
humidBar.setSpecies((IAlleleBeeSpecies) species);
|
||||
biomes.setSpecies((IAlleleBeeSpecies) species);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,35 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.database;
|
||||
|
||||
import binnie.Binnie;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.core.craftgui.database.PageSpecies;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.Binnie;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.database.PageSpecies;
|
||||
|
||||
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 class PageSpeciesGenome extends PageSpecies {
|
||||
protected ControlText title;
|
||||
protected ControlText speedText;
|
||||
protected ControlText lifespanText;
|
||||
protected ControlText fertilityText;
|
||||
protected ControlText floweringText;
|
||||
protected ControlText territoryText;
|
||||
protected ControlText nocturnalText;
|
||||
protected ControlText caveDwellingText;
|
||||
protected ControlText tolerantFlyerText;
|
||||
protected ControlText flowerText;
|
||||
protected ControlText effectText;
|
||||
|
||||
public PageSpeciesGenome(final IWidget parent, final DatabaseTab tab) {
|
||||
public PageSpeciesGenome(IWidget parent, DatabaseTab tab) {
|
||||
super(parent, tab);
|
||||
this.pageSpeciesGenome_Title = new ControlTextCentered(this, 8.0f, "Genome");
|
||||
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);
|
||||
@@ -45,57 +40,21 @@ public class PageSpeciesGenome extends PageSpecies
|
||||
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);
|
||||
final 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);
|
||||
int x = 72;
|
||||
|
||||
speedText = new ControlText(this, new IArea(x, 32.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
lifespanText = new ControlText(this, new IArea(x, 44.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
fertilityText = new ControlText(this, new IArea(x, 56.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
floweringText = new ControlText(this, new IArea(x, 68.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
territoryText = new ControlText(this, new IArea(x, 80.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
nocturnalText = new ControlText(this, new IArea(x, 97.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
caveDwellingText = new ControlText(this, new IArea(x, 109.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
tolerantFlyerText = new ControlText(this, new IArea(x, 121.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
flowerText = new ControlText(this, new IArea(x, 138.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
effectText = new ControlText(this, new IArea(x, 155.0f, 72.0f, 30.0f), "", TextJustification.TopLeft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(final IAlleleSpecies species) {
|
||||
final IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
|
||||
if (template != null) {
|
||||
final IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
|
||||
final 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()));
|
||||
final 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(final int flowering) {
|
||||
public static String rateFlowering(int flowering) {
|
||||
if (flowering >= 99) {
|
||||
return "Maximum";
|
||||
}
|
||||
@@ -120,7 +79,7 @@ public class PageSpeciesGenome extends PageSpecies
|
||||
return "Slowest";
|
||||
}
|
||||
|
||||
public static String rateSpeed(final float speed) {
|
||||
public static String rateSpeed(float speed) {
|
||||
if (speed >= 1.7f) {
|
||||
return "Fastest";
|
||||
}
|
||||
@@ -142,7 +101,7 @@ public class PageSpeciesGenome extends PageSpecies
|
||||
return "Slowest";
|
||||
}
|
||||
|
||||
public static String rateLifespan(final int life) {
|
||||
public static String rateLifespan(int life) {
|
||||
if (life >= 70) {
|
||||
return "Longest";
|
||||
}
|
||||
@@ -170,10 +129,50 @@ public class PageSpeciesGenome extends PageSpecies
|
||||
return "Shortest";
|
||||
}
|
||||
|
||||
public static String tolerated(final boolean t) {
|
||||
public static String tolerated(boolean t) {
|
||||
if (t) {
|
||||
return "Tolerated";
|
||||
}
|
||||
return "Not Tolerated";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(IAlleleSpecies species) {
|
||||
IAllele[] template = Binnie.Genetics.getBeeRoot().getTemplate(species.getUID());
|
||||
if (template == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template);
|
||||
IBee bee = Binnie.Genetics.getBeeRoot().getBee(BinnieCore.proxy.getWorld(), genome);
|
||||
speedText.setValue(rateSpeed(genome.getSpeed()));
|
||||
lifespanText.setValue(rateLifespan(genome.getLifespan()));
|
||||
fertilityText.setValue(genome.getFertility() + " children");
|
||||
floweringText.setValue(rateFlowering(genome.getFlowering()));
|
||||
int[] area = genome.getTerritory();
|
||||
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";
|
||||
}
|
||||
|
||||
nocturnalText.setValue(behavior);
|
||||
if (genome.getCaveDwelling()) {
|
||||
caveDwellingText.setValue("Not Needed");
|
||||
} else {
|
||||
caveDwellingText.setValue("Required");
|
||||
}
|
||||
|
||||
tolerantFlyerText.setValue(tolerated(genome.getTolerantFlyer()));
|
||||
if (genome.getFlowerProvider() != null) {
|
||||
flowerText.setValue(genome.getFlowerProvider().getDescription());
|
||||
} else {
|
||||
flowerText.setValue("None");
|
||||
}
|
||||
effectText.setValue(genome.getEffect().getName());
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,30 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.database;
|
||||
|
||||
import forestry.api.apiculture.IAlleleBeeSpecies;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.controls.ControlTextCentered;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.core.craftgui.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 class PageSpeciesProducts extends PageSpecies {
|
||||
protected ControlText title;
|
||||
protected ControlProductsBox products;
|
||||
protected ControlText title2;
|
||||
protected ControlProductsBox specialties;
|
||||
|
||||
public PageSpeciesProducts(final IWidget parent, final DatabaseTab tab) {
|
||||
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);
|
||||
title = new ControlTextCentered(this, 8.0f, "Products");
|
||||
products = new ControlProductsBox(this, 4, 20, 136, 48, ControlProductsBox.Type.Products);
|
||||
title2 = new ControlTextCentered(this, 68.0f, "Specialties");
|
||||
specialties = new ControlProductsBox(this, 4, 80, 136, 48, ControlProductsBox.Type.Specialties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValueChanged(final IAlleleSpecies species) {
|
||||
this.pageSpeciesProducts_Products.setSpecies((IAlleleBeeSpecies) species);
|
||||
this.pageSpeciesProducts_Specialties.setSpecies((IAlleleBeeSpecies) species);
|
||||
public void onValueChanged(IAlleleSpecies species) {
|
||||
products.setSpecies((IAlleleBeeSpecies) species);
|
||||
specialties.setSpecies((IAlleleBeeSpecies) species);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,44 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.database;
|
||||
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.Binnie;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import binnie.core.craftgui.database.PageBreeder;
|
||||
import binnie.core.craftgui.database.PageBranchSpecies;
|
||||
import binnie.core.craftgui.database.PageBranchOverview;
|
||||
import binnie.core.craftgui.database.PageSpeciesMutations;
|
||||
import binnie.core.craftgui.database.PageSpeciesResultant;
|
||||
import binnie.core.craftgui.database.PageSpeciesClassification;
|
||||
import binnie.core.AbstractMod;
|
||||
import binnie.core.craftgui.database.DatabaseTab;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.core.craftgui.database.PageBranchOverview;
|
||||
import binnie.core.craftgui.database.PageBranchSpecies;
|
||||
import binnie.core.craftgui.database.PageBreeder;
|
||||
import binnie.core.craftgui.database.PageSpeciesClassification;
|
||||
import binnie.core.craftgui.database.PageSpeciesMutations;
|
||||
import binnie.core.craftgui.database.PageSpeciesOverview;
|
||||
import binnie.core.craftgui.database.PageSpeciesResultant;
|
||||
import binnie.core.craftgui.database.WindowAbstractDatabase;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class WindowApiaristDatabase extends WindowAbstractDatabase
|
||||
{
|
||||
@Override
|
||||
protected void addTabs() {
|
||||
new PageSpeciesOverview(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.overview", 0));
|
||||
new PageSpeciesClassification(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.classification", 0));
|
||||
new PageSpeciesGenome(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.genome", 0));
|
||||
new PageSpeciesProducts(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.products", 0));
|
||||
new PageSpeciesClimate(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.climate", 0));
|
||||
new PageSpeciesResultant(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.resultant", 0));
|
||||
new PageSpeciesMutations(this.getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.further", 0));
|
||||
new PageBranchOverview(this.getInfoPages(Mode.Branches), new DatabaseTab(ExtraBees.instance, "branches.overview", 0));
|
||||
new PageBranchSpecies(this.getInfoPages(Mode.Branches), new DatabaseTab(ExtraBees.instance, "branches.species", 0));
|
||||
new PageBreeder(this.getInfoPages(Mode.Breeder), this.getUsername(), new DatabaseTab(ExtraBees.instance, "breeder", 0));
|
||||
}
|
||||
|
||||
public WindowApiaristDatabase(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
public class WindowApiaristDatabase extends WindowAbstractDatabase {
|
||||
public WindowApiaristDatabase(EntityPlayer player, Side side, boolean nei) {
|
||||
super(player, side, nei, Binnie.Genetics.beeBreedingSystem, 110.0f);
|
||||
}
|
||||
|
||||
public static Window create(final EntityPlayer player, final Side side, final boolean nei) {
|
||||
public static Window create(EntityPlayer player, Side side, boolean nei) {
|
||||
return new WindowApiaristDatabase(player, side, nei);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addTabs() {
|
||||
new PageSpeciesOverview(getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.overview", 0));
|
||||
new PageSpeciesClassification(getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.classification", 0));
|
||||
new PageSpeciesGenome(getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.genome", 0));
|
||||
new PageSpeciesProducts(getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.products", 0));
|
||||
new PageSpeciesClimate(getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.climate", 0));
|
||||
new PageSpeciesResultant(getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.resultant", 0));
|
||||
new PageSpeciesMutations(getInfoPages(Mode.Species), new DatabaseTab(ExtraBees.instance, "species.further", 0));
|
||||
new PageBranchOverview(getInfoPages(Mode.Branches), new DatabaseTab(ExtraBees.instance, "branches.overview", 0));
|
||||
new PageBranchSpecies(getInfoPages(Mode.Branches), new DatabaseTab(ExtraBees.instance, "branches.species", 0));
|
||||
new PageBreeder(getInfoPages(Mode.Breeder), getUsername(), new DatabaseTab(ExtraBees.instance, "breeder", 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMod getMod() {
|
||||
return ExtraBees.instance;
|
||||
@@ -54,30 +49,29 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase
|
||||
return "Database";
|
||||
}
|
||||
|
||||
enum SpeciesTab
|
||||
{
|
||||
Overview(255),
|
||||
Genome(16776960),
|
||||
Productivity(65535),
|
||||
Climate(16711680),
|
||||
ResultantMutations(16711935),
|
||||
FurtherMutations(65280);
|
||||
// TODO unused class?
|
||||
enum SpeciesTab {
|
||||
Overview(0xff),
|
||||
Genome(0xffff00),
|
||||
Productivity(0xffff),
|
||||
Climate(0xff0000),
|
||||
ResultantMutations(0xff00ff),
|
||||
FurtherMutations(0xff00);
|
||||
|
||||
public int colour;
|
||||
|
||||
private SpeciesTab(final int colour) {
|
||||
SpeciesTab(int colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
}
|
||||
|
||||
enum BranchesTab
|
||||
{
|
||||
enum BranchesTab {
|
||||
Overview(255),
|
||||
Species(16711680);
|
||||
|
||||
public int colour;
|
||||
|
||||
private BranchesTab(final int colour) {
|
||||
BranchesTab(int colour) {
|
||||
this.colour = colour;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +1,45 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.ITooltip;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.Tooltip;
|
||||
import binnie.core.craftgui.WidgetAttribute;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.controls.core.IControlValue;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
public class ControlChromosome extends Control implements IControlValue<IChromosomeType>, ITooltip
|
||||
{
|
||||
IChromosomeType value;
|
||||
// TODO unused class?
|
||||
public class ControlChromosome extends Control implements IControlValue<IChromosomeType>, ITooltip {
|
||||
protected IChromosomeType value;
|
||||
|
||||
protected ControlChromosome(final IWidget parent, final float x, final float y, final IChromosomeType type) {
|
||||
protected ControlChromosome(IWidget parent, float x, float y, IChromosomeType type) {
|
||||
super(parent, x, y, 16.0f, 16.0f);
|
||||
this.setValue(type);
|
||||
this.addAttribute(WidgetAttribute.MouseOver);
|
||||
setValue(type);
|
||||
addAttribute(WidgetAttribute.MouseOver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IChromosomeType getValue() {
|
||||
return this.value;
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(final IChromosomeType value) {
|
||||
public void setValue(IChromosomeType value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRenderBackground() {
|
||||
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome, this.getArea());
|
||||
CraftGUI.Render.colour(16711680);
|
||||
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome2, this.getArea());
|
||||
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome, getArea());
|
||||
CraftGUI.Render.colour(0xff0000);
|
||||
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome2, getArea());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTooltip(final Tooltip tooltip) {
|
||||
if (this.value != null) {
|
||||
tooltip.add(this.value.getName());
|
||||
public void getTooltip(Tooltip tooltip) {
|
||||
if (value != null) {
|
||||
tooltip.add(value.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,24 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import java.util.List;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import java.util.LinkedList;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.IWidget;
|
||||
import binnie.core.craftgui.controls.ControlText;
|
||||
import binnie.core.craftgui.controls.core.Control;
|
||||
import binnie.core.craftgui.geometry.IArea;
|
||||
import binnie.core.craftgui.geometry.TextJustification;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
|
||||
public class ControlPunnett extends Control
|
||||
{
|
||||
static int boxWidth;
|
||||
static int boxHeight;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
protected ControlPunnett(final IWidget parent, final float x, final float y) {
|
||||
public class ControlPunnett extends Control {
|
||||
protected static int boxWidth = 80;
|
||||
protected static int boxHeight = 28;
|
||||
|
||||
protected ControlPunnett(IWidget parent, float x, float y) {
|
||||
super(parent, x, y, ControlPunnett.boxWidth * 3, ControlPunnett.boxWidth * 3);
|
||||
}
|
||||
|
||||
@@ -34,50 +30,47 @@ public class ControlPunnett extends Control
|
||||
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth * 2, ControlPunnett.boxHeight / 2.0f, 1.0f, ControlPunnett.boxHeight * 2.5f), 11184810);
|
||||
}
|
||||
|
||||
public void setup(final IChromosomeType chromosome, final IIndividual ind1, final IIndividual ind2, final ISpeciesRoot root) {
|
||||
this.deleteAllChildren();
|
||||
// TODO unused method?
|
||||
public void setup(IChromosomeType chromosome, IIndividual ind1, IIndividual ind2, ISpeciesRoot root) {
|
||||
deleteAllChildren();
|
||||
if (chromosome == null || ind1 == null || ind2 == null || root == null) {
|
||||
return;
|
||||
}
|
||||
final IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome);
|
||||
final IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome);
|
||||
final IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome);
|
||||
final IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome);
|
||||
|
||||
IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome);
|
||||
IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome);
|
||||
IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome);
|
||||
IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome);
|
||||
int x = 1;
|
||||
int y = 1;
|
||||
for (final IAllele allele1 : new IAllele[] { primary1, secondary1 }) {
|
||||
int y;
|
||||
|
||||
for (IAllele allele1 : new IAllele[]{primary1, secondary1}) {
|
||||
y = 1;
|
||||
for (final IAllele allele2 : new IAllele[] { primary2, secondary2 }) {
|
||||
final List<IAllele> alleles = new LinkedList<IAllele>();
|
||||
for (IAllele allele2 : new IAllele[]{primary2, secondary2}) {
|
||||
List<IAllele> alleles = new LinkedList<IAllele>();
|
||||
if (allele1.isDominant() && !allele2.isDominant()) {
|
||||
alleles.add(allele1);
|
||||
}
|
||||
else if (allele2.isDominant() && !allele1.isDominant()) {
|
||||
} else if (allele2.isDominant() && !allele1.isDominant()) {
|
||||
alleles.add(allele2);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
alleles.add(allele1);
|
||||
if (allele1 != allele2) {
|
||||
alleles.add(allele2);
|
||||
}
|
||||
}
|
||||
|
||||
String text = "";
|
||||
for (final IAllele allele3 : alleles) {
|
||||
for (IAllele allele3 : alleles) {
|
||||
text = text + allele3.getName() + ": " + 25.0f / alleles.size() + "%\n";
|
||||
}
|
||||
new ControlText(this, new IArea(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text, TextJustification.TopCenter).setColor(11184810);
|
||||
++y;
|
||||
y++;
|
||||
}
|
||||
++x;
|
||||
x++;
|
||||
}
|
||||
new ControlText(this, new IArea(ControlPunnett.boxWidth, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(ControlPunnett.boxWidth * 2, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColor(11184810);
|
||||
}
|
||||
|
||||
static {
|
||||
ControlPunnett.boxWidth = 80;
|
||||
ControlPunnett.boxHeight = 28;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,6 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
public enum ExtraBeeGUITexture
|
||||
{
|
||||
public enum ExtraBeeGUITexture {
|
||||
Chromosome,
|
||||
Chromosome2;
|
||||
Chromosome2
|
||||
}
|
||||
@@ -1,38 +1,34 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extrabees.gui.punnett;
|
||||
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.craftgui.resource.StyleSheet;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.core.AbstractMod;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.CraftGUI;
|
||||
import binnie.core.craftgui.minecraft.Window;
|
||||
import binnie.core.craftgui.minecraft.control.ControlSlot;
|
||||
import binnie.core.craftgui.resource.StyleSheet;
|
||||
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
|
||||
import binnie.core.craftgui.resource.minecraft.StandardTexture;
|
||||
import binnie.extrabees.ExtraBees;
|
||||
import binnie.extrabees.core.ExtraBeeTexture;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class WindowPunnettSquare extends Window
|
||||
{
|
||||
// TODO unused class?
|
||||
public class WindowPunnettSquare extends Window {
|
||||
ControlSlot bee1;
|
||||
ControlSlot bee2;
|
||||
ControlPunnett punnett;
|
||||
ISpeciesRoot root;
|
||||
|
||||
public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
return new WindowPunnettSquare(player, inventory, side);
|
||||
public WindowPunnettSquare(EntityPlayer player, IInventory inventory, Side side) {
|
||||
super(245.0f, 205.0f, player, inventory, side);
|
||||
root = null;
|
||||
}
|
||||
|
||||
public WindowPunnettSquare(final EntityPlayer player, final IInventory inventory, final Side side) {
|
||||
super(245.0f, 205.0f, player, inventory, side);
|
||||
this.root = null;
|
||||
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
|
||||
return new WindowPunnettSquare(player, inventory, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,17 +43,16 @@ public class WindowPunnettSquare extends Window
|
||||
|
||||
@Override
|
||||
public void initialiseClient() {
|
||||
this.setTitle("Punnett Square");
|
||||
setTitle("Punnett Square");
|
||||
CraftGUI.Render.stylesheet(new StyleSheetPunnett());
|
||||
}
|
||||
|
||||
static class StyleSheetPunnett extends StyleSheet
|
||||
{
|
||||
static class StyleSheetPunnett extends StyleSheet {
|
||||
public StyleSheetPunnett() {
|
||||
this.textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, ExtraBeeTexture.GUIPunnett, 32, 32, 32, 32));
|
||||
this.textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
this.textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, ExtraBeeTexture.GUIPunnett, 32, 32, 32, 32));
|
||||
textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, ExtraBeeTexture.GUIPunnett));
|
||||
textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user