mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-15 17:55:04 +00:00
Improve code readability in binnie.genetics package
Drop unused (empty) method MachinePackage#register() from all classes
This commit is contained in:
1 parent
856f08b752
commit
730043ba9c
112 files changed
+4354
-4697
No files matched your search
@@ -1,7 +1,3 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.genetics.gui;
|
||||
|
||||
import binnie.Binnie;
|
||||
@@ -25,41 +21,38 @@ import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
public class AnalystPageSoil extends ControlAnalystPage
|
||||
{
|
||||
public AnalystPageSoil(final IWidget parent, final IArea area, final IFlower flower) {
|
||||
public class AnalystPageSoil extends ControlAnalystPage {
|
||||
public AnalystPageSoil(IWidget parent, IArea area, IFlower flower) {
|
||||
super(parent, area);
|
||||
this.setColor(6697728);
|
||||
final EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture();
|
||||
final EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture();
|
||||
final EnumAcidity pH = flower.getGenome().getPrimary().getPH();
|
||||
final EnumTolerance pHTol = flower.getGenome().getTolerancePH();
|
||||
setColor(6697728);
|
||||
EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture();
|
||||
EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture();
|
||||
EnumAcidity pH = flower.getGenome().getPrimary().getPH();
|
||||
EnumTolerance pHTol = flower.getGenome().getTolerancePH();
|
||||
int y = 4;
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Soil").setColor(this.getColor());
|
||||
new ControlTextCentered(this, y, EnumChatFormatting.UNDERLINE + "Soil").setColor(getColor());
|
||||
y += 16;
|
||||
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Moisture Tolerance", TextJustification.MiddleCenter).setColor(this.getColor());
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Moisture Tolerance", TextJustification.MiddleCenter).setColor(getColor());
|
||||
y += 12;
|
||||
this.createMoisture(this, (this.w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
|
||||
createMoisture(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, moisture, moistureTol);
|
||||
y += 16;
|
||||
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "pH Tolerance", TextJustification.MiddleCenter).setColor(this.getColor());
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "pH Tolerance", TextJustification.MiddleCenter).setColor(getColor());
|
||||
y += 12;
|
||||
this.createAcidity(this, (this.w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
|
||||
createAcidity(this, (w() - 100.0f) / 2.0f, y, 100.0f, 10.0f, pH, pHTol);
|
||||
y += 16;
|
||||
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Recommended Soil", TextJustification.MiddleCenter).setColor(this.getColor());
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Recommended Soil", TextJustification.MiddleCenter).setColor(getColor());
|
||||
y += 12;
|
||||
EnumMoisture recomMoisture = EnumMoisture.Normal;
|
||||
final boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.Normal, moistureTol);
|
||||
final boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.Damp, moistureTol);
|
||||
final boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.Dry, moistureTol);
|
||||
boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.Normal, moistureTol);
|
||||
boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.Damp, moistureTol);
|
||||
boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.Dry, moistureTol);
|
||||
if (canTolNormal) {
|
||||
if (canTolDamp && !canTolDry) {
|
||||
recomMoisture = EnumMoisture.Damp;
|
||||
}
|
||||
else if (canTolDry && !canTolDamp) {
|
||||
} else if (canTolDry && !canTolDamp) {
|
||||
recomMoisture = EnumMoisture.Dry;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (canTolDamp) {
|
||||
recomMoisture = EnumMoisture.Damp;
|
||||
}
|
||||
@@ -68,18 +61,16 @@ public class AnalystPageSoil extends ControlAnalystPage
|
||||
}
|
||||
}
|
||||
EnumAcidity recomPH = EnumAcidity.Neutral;
|
||||
final boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.Neutral, pHTol);
|
||||
final boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.Acid, pHTol);
|
||||
final boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.Alkaline, pHTol);
|
||||
boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.Neutral, pHTol);
|
||||
boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.Acid, pHTol);
|
||||
boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.Alkaline, pHTol);
|
||||
if (canTolNeutral) {
|
||||
if (canTolAcid && !canTolAlkaline) {
|
||||
recomPH = EnumAcidity.Acid;
|
||||
}
|
||||
else if (canTolAlkaline && !canTolAcid) {
|
||||
} else if (canTolAlkaline && !canTolAcid) {
|
||||
recomPH = EnumAcidity.Alkaline;
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (canTolAcid) {
|
||||
recomPH = EnumAcidity.Acid;
|
||||
}
|
||||
@@ -87,55 +78,55 @@ public class AnalystPageSoil extends ControlAnalystPage
|
||||
recomPH = EnumAcidity.Alkaline;
|
||||
}
|
||||
}
|
||||
final ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture));
|
||||
final ControlItemDisplay recomSoil = new ControlItemDisplay(this, (this.w() - 24.0f) / 2.0f, y, 24.0f);
|
||||
ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture));
|
||||
ControlItemDisplay recomSoil = new ControlItemDisplay(this, (w() - 24.0f) / 2.0f, y, 24.0f);
|
||||
recomSoil.setItemStack(stack);
|
||||
recomSoil.setTooltip();
|
||||
y += 32;
|
||||
new ControlText(this, new IArea(4.0f, y, this.w() - 8.0f, 14.0f), "Other Soils", TextJustification.MiddleCenter).setColor(this.getColor());
|
||||
new ControlText(this, new IArea(4.0f, y, w() - 8.0f, 14.0f), "Other Soils", TextJustification.MiddleCenter).setColor(getColor());
|
||||
y += 12;
|
||||
final List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
for (final EnumAcidity a : EnumSet.range(EnumAcidity.Acid, EnumAcidity.Alkaline)) {
|
||||
for (final EnumMoisture b : EnumSet.range(EnumMoisture.Dry, EnumMoisture.Damp)) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
for (EnumAcidity a : EnumSet.range(EnumAcidity.Acid, EnumAcidity.Alkaline)) {
|
||||
for (EnumMoisture b : EnumSet.range(EnumMoisture.Dry, EnumMoisture.Damp)) {
|
||||
if (Tolerance.canTolerate(pH, a, pHTol) && Tolerance.canTolerate(moisture, b, moistureTol) && (a != recomPH || b != recomMoisture)) {
|
||||
stacks.add(new ItemStack(Botany.soil, 1, BlockSoil.getMeta(a, b)));
|
||||
}
|
||||
}
|
||||
}
|
||||
final float soilListWidth = 17 * stacks.size() - 1;
|
||||
final float soilListX = (this.w() - soilListWidth) / 2.0f;
|
||||
float soilListWidth = 17 * stacks.size() - 1;
|
||||
float soilListX = (w() - soilListWidth) / 2.0f;
|
||||
int t = 0;
|
||||
for (final ItemStack soilStack : stacks) {
|
||||
final ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y);
|
||||
for (ItemStack soilStack : stacks) {
|
||||
ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y);
|
||||
display.setItemStack(soilStack);
|
||||
display.setTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
protected void createMoisture(final IWidget parent, final float x, final float y, final float w, final float h, final EnumMoisture value, final EnumTolerance tol) {
|
||||
protected void createMoisture(IWidget parent, float x, float y, float w, float h, EnumMoisture value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumMoisture>(parent, x, y, w, h, EnumMoisture.class) {
|
||||
@Override
|
||||
protected String getName(final EnumMoisture value) {
|
||||
protected String getName(EnumMoisture value) {
|
||||
return Binnie.Language.localise(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColour(final EnumMoisture value) {
|
||||
return (new int[] { 13434828, 6737151, 3368703 })[value.ordinal()];
|
||||
protected int getColour(EnumMoisture value) {
|
||||
return (new int[]{13434828, 6737151, 3368703})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
|
||||
protected void createAcidity(final IWidget parent, final float x, final float y, final float w, final float h, final EnumAcidity value, final EnumTolerance tol) {
|
||||
protected void createAcidity(IWidget parent, float x, float y, float w, float h, EnumAcidity value, EnumTolerance tol) {
|
||||
new ControlToleranceBar<EnumAcidity>(parent, x, y, w, h, EnumAcidity.class) {
|
||||
@Override
|
||||
protected String getName(final EnumAcidity value) {
|
||||
protected String getName(EnumAcidity value) {
|
||||
return Binnie.Language.localise(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getColour(final EnumAcidity value) {
|
||||
return (new int[] { 16711782, 65280, 26367 })[value.ordinal()];
|
||||
protected int getColour(EnumAcidity value) {
|
||||
return (new int[]{16711782, 65280, 26367})[value.ordinal()];
|
||||
}
|
||||
}.setValues(value, tol);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user