Improve/refactoring (#15)

* Improve the code

* Code improve in binnie.core.utils package

* Code improve in binnie.core.triggers package

* Code improve in binnie.core.resource package

* Code improve in binnie.core.proxy package

* Code improve readability in binnie.core package

* Add missed constructors

* Some improve code readabilty

* Expand import with *

* Revert "Expand import with *"

This reverts commit 3bb4a44f3b69a8559bd5753337e0f6793ad18dc4.

* Fix using fully qualified names in imports

* Fix missed unnessesary "this."

* Removed binnie.craftgui package
Optimised imports and removed unnessesary "this."

* Some refactoring code in binnie.core.craftgui package

* Merge from master1.7.10

* Improve code readability in binnie.core.craftgui.database package

* Improve code readability in binnie.core.craftgui.events package

* Improve code readability in binnie.core.craftgui.geometry package

* Improve code readability in binnie.core.craftgui.* package
This commit is contained in:
Alexander Kornilov authored and mezz committed 2017-04-26 15:09:09 -07:00
1 parent a3c2360ba6
commit f402cb155f
428 files changed
+9515 -10103

No files matched your search

@@ -5,30 +5,29 @@
package binnie.genetics.gui;
import java.text.DecimalFormat;
import binnie.craftgui.core.geometry.IPoint;
import binnie.core.craftgui.geometry.IPoint;
import binnie.botany.api.IFlower;
import net.minecraftforge.common.EnumPlantType;
import forestry.plugins.PluginApiculture;
import forestry.api.genetics.IChromosomeType;
import forestry.api.arboriculture.EnumTreeChromosome;
import binnie.Binnie;
import forestry.api.arboriculture.ITree;
import forestry.api.lepidopterology.IButterfly;
import binnie.craftgui.minecraft.control.ControlIconDisplay;
import binnie.core.craftgui.minecraft.control.ControlIconDisplay;
import binnie.genetics.item.ModuleItem;
import forestry.api.apiculture.IBee;
import binnie.craftgui.controls.ControlTextCentered;
import binnie.core.craftgui.controls.ControlTextCentered;
import forestry.api.genetics.IIndividual;
import binnie.craftgui.core.geometry.IArea;
import binnie.craftgui.core.IWidget;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.IWidget;
public class AnalystPageBiology extends ControlAnalystPage
{
public AnalystPageBiology(final IWidget parent, final IArea area, final IIndividual ind) {
super(parent, area);
this.setColour(26214);
this.setColor(26214);
int y = 4;
new ControlTextCentered(this, y, "§nBiology").setColour(this.getColour());
new ControlTextCentered(this, y, "§nBiology").setColor(this.getColor());
y += 12;
if (ind instanceof IBee) {
final IBee bee = (IBee) ind;
@@ -81,7 +80,7 @@ public class AnalystPageBiology extends ControlAnalystPage
y += 30;
}
else if (ind instanceof ITree) {
new ControlTextCentered(this, y, "§oSappiness: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColour(this.getColour());
new ControlTextCentered(this, y, "§oSappiness: " + Binnie.Genetics.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColor(this.getColor());
y += 20;
}
else {
@@ -90,49 +89,49 @@ public class AnalystPageBiology extends ControlAnalystPage
if (ind instanceof IBee) {
final IBee bee = (IBee) ind;
final int fertility = bee.getGenome().getFertility();
new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColour(this.getColour());
new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColor(this.getColor());
y += 22;
final int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle;
new ControlTextCentered(this, y, "Average Lifespan").setColour(this.getColour());
new ControlTextCentered(this, y, "Average Lifespan").setColor(this.getColor());
y += 12;
new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan * (bee.getGenome().getNocturnal() ? 1.0f : 2.0f))).setColour(this.getColour());
new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan * (bee.getGenome().getNocturnal() ? 1.0f : 2.0f))).setColor(this.getColor());
y += 22;
}
if (ind instanceof IButterfly) {
final IButterfly bee2 = (IButterfly) ind;
final int fertility = bee2.getGenome().getFertility();
new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColour(this.getColour());
new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColor(this.getColor());
y += 32;
final float caterpillarMatureTime = 1365.3999f * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2));
new ControlTextCentered(this, y, "Caterpillar Gestation").setColour(this.getColour());
new ControlTextCentered(this, y, "Caterpillar Gestation").setColor(this.getColor());
y += 12;
new ControlTextCentered(this, y, "§l" + this.getMCDayString(caterpillarMatureTime)).setColour(this.getColour());
new ControlTextCentered(this, y, "§l" + this.getMCDayString(caterpillarMatureTime)).setColor(this.getColor());
y += 22;
final int speed = (int) (20.0f * bee2.getGenome().getSpeed());
new ControlTextCentered(this, y, "Flight Speed").setColour(this.getColour());
new ControlTextCentered(this, y, "Flight Speed").setColor(this.getColor());
y += 12;
new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColour(this.getColour());
new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColor(this.getColor());
y += 22;
}
if (ind instanceof ITree) {
final ITree tree = (ITree) ind;
final int fertility = (int) (1.0f / tree.getGenome().getFertility());
new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColour(this.getColour());
new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColor(this.getColor());
y += 22;
final float butterflySpawn = 1365.3999f / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f);
new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn) + " per leaf").setColour(this.getColour());
new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn) + " per leaf").setColor(this.getColor());
y += 34;
new ControlTextCentered(this, y, "Plant Types").setColour(this.getColour());
new ControlTextCentered(this, y, "Plant Types").setColor(this.getColor());
y += 12;
for (final EnumPlantType type : tree.getGenome().getPlantTypes()) {
new ControlTextCentered(this, y, "§o" + type.name()).setColour(this.getColour());
new ControlTextCentered(this, y, "§o" + type.name()).setColor(this.getColor());
y += 12;
}
}
if (ind instanceof IFlower) {
final IFlower flower = (IFlower) ind;
final float butterflySpawn2 = 1365.3999f / (flower.getGenome().getSappiness() * 0.2f);
new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn2)).setColour(this.getColour());
new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn2)).setColor(this.getColor());
y += 30;
float CHANCE_DISPERSAL = 0.8f;
CHANCE_DISPERSAL += 0.2f * flower.getGenome().getFertility();
@@ -150,17 +149,17 @@ public class AnalystPageBiology extends ControlAnalystPage
final float lifespan2 = flower.getMaxAge() * 20.0f * 68.27f / flower.getGenome().getAgeChance();
float floweringLifespan = (flower.getMaxAge() - 1) * 20.0f * 68.27f / flower.getGenome().getAgeChance();
floweringLifespan -= 1365.3999f;
new ControlTextCentered(this, y, "Average Lifespan").setColour(this.getColour());
new ControlTextCentered(this, y, "Average Lifespan").setColor(this.getColor());
y += 12;
new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan2)).setColour(this.getColour());
new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan2)).setColor(this.getColor());
y += 22;
new ControlTextCentered(this, y, "Seed Dispersal").setColour(this.getColour());
new ControlTextCentered(this, y, "Seed Dispersal").setColor(this.getColor());
y += 12;
new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColour(this.getColour());
new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColor(this.getColor());
y += 22;
new ControlTextCentered(this, y, "Pollination").setColour(this.getColour());
new ControlTextCentered(this, y, "Pollination").setColor(this.getColor());
y += 12;
new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColour(this.getColour());
new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColor(this.getColor());
y += 22;
}
this.setSize(new IPoint(this.w(), y));