diff --git a/src/main/java/binnie/core/craftgui/database/DatabaseTab.java b/src/main/java/binnie/core/craftgui/database/DatabaseTab.java index faa3a760..5c259cb9 100644 --- a/src/main/java/binnie/core/craftgui/database/DatabaseTab.java +++ b/src/main/java/binnie/core/craftgui/database/DatabaseTab.java @@ -6,21 +6,21 @@ import binnie.core.craftgui.Tooltip; import binnie.core.util.I18N; public class DatabaseTab implements ITooltipHelp { - private AbstractMod mod; + private String mod; private String unloc; public DatabaseTab(AbstractMod mod, String unloc) { - this.mod = mod; + this.mod = mod.getModID(); this.unloc = unloc; } @Override public String toString() { - return I18N.localise(mod.getModID() + ".gui.database.tab." + unloc); + return I18N.localise(mod + ".gui.database.tab." + unloc); } @Override public void getHelpTooltip(Tooltip tooltip) { - tooltip.add(I18N.localiseOrBlank(mod.getModID() + ".gui.database.tab." + unloc + ".help")); + tooltip.add(I18N.localiseOrBlank(mod + ".gui.database.tab." + unloc + ".help")); } } diff --git a/src/main/java/binnie/extrabees/gui/WindowAlvearyFrame.java b/src/main/java/binnie/extrabees/gui/WindowAlvearyFrame.java index 79725e7f..b92cb851 100644 --- a/src/main/java/binnie/extrabees/gui/WindowAlvearyFrame.java +++ b/src/main/java/binnie/extrabees/gui/WindowAlvearyFrame.java @@ -6,6 +6,7 @@ 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.core.util.I18N; import binnie.extrabees.ExtraBees; import cpw.mods.fml.relauncher.Side; import net.minecraft.entity.player.EntityPlayer; @@ -29,7 +30,7 @@ public class WindowAlvearyFrame extends Window { @Override public void initialiseClient() { - setTitle("Frame Housing"); + setTitle(I18N.localise("extrabees.machine.alveay.frame")); playerInventory = new ControlPlayerInventory(this); ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f); slot.assign(0); diff --git a/src/main/java/binnie/extrabees/gui/WindowAlvearyHatchery.java b/src/main/java/binnie/extrabees/gui/WindowAlvearyHatchery.java index 5370d463..76ab9257 100644 --- a/src/main/java/binnie/extrabees/gui/WindowAlvearyHatchery.java +++ b/src/main/java/binnie/extrabees/gui/WindowAlvearyHatchery.java @@ -6,6 +6,7 @@ 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.core.util.I18N; import binnie.extrabees.ExtraBees; import binnie.extrabees.apiary.machine.hatchery.AlvearyHatchery; import cpw.mods.fml.relauncher.Side; @@ -30,7 +31,7 @@ public class WindowAlvearyHatchery extends Window { @Override public void initialiseClient() { - setTitle("Hatchery"); + setTitle(I18N.localise("extrabees.machine.alveay.hatchery")); playerInventory = new ControlPlayerInventory(this); ControlSlotArray slot = new ControlSlotArray(this, 43, 30, 5, 1); slot.create(AlvearyHatchery.SLOT_LARVAE); diff --git a/src/main/java/binnie/extrabees/gui/WindowAlvearyMutator.java b/src/main/java/binnie/extrabees/gui/WindowAlvearyMutator.java index 5c5fed97..51be575b 100644 --- a/src/main/java/binnie/extrabees/gui/WindowAlvearyMutator.java +++ b/src/main/java/binnie/extrabees/gui/WindowAlvearyMutator.java @@ -10,6 +10,7 @@ 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.core.util.I18N; import binnie.extrabees.ExtraBees; import binnie.extrabees.apiary.machine.mutator.AlvearyMutator; import cpw.mods.fml.relauncher.Side; @@ -35,11 +36,12 @@ public class WindowAlvearyMutator extends Window { @Override public void initialiseClient() { - setTitle("Mutator"); + setTitle(I18N.localise("extrabees.machine.alveay.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, w(), 16.0f), "Possible Mutagens:", TextJustification.MIDDLE_CENTER).setColor(5592405); + slot.assign(AlvearyMutator.SLOT_MUTATOR); + new ControlText(this, new IArea(0.0f, 52.0f, w(), 16.0f), I18N.localise("extrabees.machine.alveay.mutator.mutagens"), TextJustification.MIDDLE_CENTER) + .setColor(0x555555); int size = AlvearyMutator.getMutagens().size(); int w = size * 18; diff --git a/src/main/java/binnie/extrabees/gui/WindowAlvearyStimulator.java b/src/main/java/binnie/extrabees/gui/WindowAlvearyStimulator.java index 09f2fbb7..d81a12e6 100644 --- a/src/main/java/binnie/extrabees/gui/WindowAlvearyStimulator.java +++ b/src/main/java/binnie/extrabees/gui/WindowAlvearyStimulator.java @@ -8,6 +8,7 @@ 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.core.util.I18N; import binnie.extrabees.ExtraBees; import binnie.extrabees.apiary.machine.stimulator.AlvearyStimulator; import cpw.mods.fml.relauncher.Side; @@ -32,7 +33,7 @@ public class WindowAlvearyStimulator extends Window { @Override public void initialiseClient() { - setTitle("Stimulator"); + setTitle(I18N.localise("extrabees.machine.alveay.stimulator")); new ControlEnergyBar(this, 75, 29, 60, 16, Position.LEFT); ControlSlot slot = new ControlSlot(this, 41.0f, 28.0f); slot.assign(AlvearyStimulator.SLOT_CIRCUIT); diff --git a/src/main/java/binnie/extrabees/gui/database/ControlClimateBar.java b/src/main/java/binnie/extrabees/gui/database/ControlClimateBar.java index 25016c85..d7e8512f 100644 --- a/src/main/java/binnie/extrabees/gui/database/ControlClimateBar.java +++ b/src/main/java/binnie/extrabees/gui/database/ControlClimateBar.java @@ -94,13 +94,12 @@ public class ControlClimateBar extends Control implements ITooltip { int main; EnumTolerance tolerance; + IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(Binnie.Genetics.getBeeRoot().getTemplate(species.getUID())); if (!isHumidity) { 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(); } diff --git a/src/main/java/binnie/extrabees/gui/database/PageSpeciesClimate.java b/src/main/java/binnie/extrabees/gui/database/PageSpeciesClimate.java index 5103100a..08c10a30 100644 --- a/src/main/java/binnie/extrabees/gui/database/PageSpeciesClimate.java +++ b/src/main/java/binnie/extrabees/gui/database/PageSpeciesClimate.java @@ -4,6 +4,7 @@ import binnie.core.craftgui.IWidget; import binnie.core.craftgui.controls.ControlTextCentered; import binnie.core.craftgui.database.DatabaseTab; import binnie.core.craftgui.database.PageSpecies; +import binnie.core.util.I18N; import forestry.api.apiculture.IAlleleBeeSpecies; import forestry.api.genetics.IAlleleSpecies; @@ -14,10 +15,10 @@ public class PageSpeciesClimate extends PageSpecies { public PageSpeciesClimate(IWidget parent, DatabaseTab tab) { super(parent, tab); - new ControlTextCentered(this, 8.0f, "Climate"); + new ControlTextCentered(this, 8.0f, I18N.localise("extrabees.gui.database.tab.species.climate")); tempBar = new ControlClimateBar(this, 8, 24, 128, 12); humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true); - new ControlTextCentered(this, 70.0f, "Biomes"); + new ControlTextCentered(this, 70.0f, I18N.localise("extrabees.gui.database.tab.species.biomes")); biomes = new ControlBiomes(this, 8, 90, 8, 4); } diff --git a/src/main/java/binnie/extrabees/gui/database/PageSpeciesGenome.java b/src/main/java/binnie/extrabees/gui/database/PageSpeciesGenome.java index b8865fc6..b152c438 100644 --- a/src/main/java/binnie/extrabees/gui/database/PageSpeciesGenome.java +++ b/src/main/java/binnie/extrabees/gui/database/PageSpeciesGenome.java @@ -8,9 +8,13 @@ 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 binnie.core.util.I18N; +import binnie.genetics.genetics.AlleleHelper; import forestry.api.apiculture.IBeeGenome; +import forestry.api.genetics.EnumTolerance; import forestry.api.genetics.IAllele; import forestry.api.genetics.IAlleleSpecies; +import forestry.core.genetics.alleles.EnumAllele; public class PageSpeciesGenome extends PageSpecies { protected ControlText title; @@ -27,17 +31,17 @@ public class PageSpeciesGenome extends PageSpecies { public PageSpeciesGenome(IWidget parent, DatabaseTab tab) { super(parent, tab); - title = new ControlTextCentered(this, 8.0f, "Genome"); - new ControlText(this, new IArea(0.0f, 32.0f, 68.0f, 30.0f), "Speed:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 44.0f, 68.0f, 30.0f), "Lifespan:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 56.0f, 68.0f, 30.0f), "Fertility:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 68.0f, 68.0f, 30.0f), "Flowering:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 80.0f, 68.0f, 30.0f), "Territory:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 97.0f, 68.0f, 30.0f), "Behavior:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 109.0f, 68.0f, 30.0f), "Sunlight:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 121.0f, 68.0f, 30.0f), "Rain:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 138.0f, 68.0f, 30.0f), "Flower:", TextJustification.TOP_RIGHT); - new ControlText(this, new IArea(0.0f, 155.0f, 68.0f, 30.0f), "Effect:", TextJustification.TOP_RIGHT); + title = new ControlTextCentered(this, 8.0f, I18N.localise("extrabees.gui.database.tab.species.genome")); + new ControlText(this, new IArea(0.0f, 32.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.speed"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 44.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.lifespan"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 56.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.fertility"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 68.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.flowering"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 80.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.territory"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 97.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.behavior"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 109.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.sunlight"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 121.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.rain"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 138.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.flower"), TextJustification.TOP_RIGHT); + new ControlText(this, new IArea(0.0f, 155.0f, 68.0f, 30.0f), I18N.localise("extrabees.gui.database.tab.species.genome.effect"), TextJustification.TOP_RIGHT); int x = 72; speedText = new ControlText(this, new IArea(x, 32.0f, 72.0f, 30.0f), "", TextJustification.TOP_LEFT); @@ -54,84 +58,84 @@ public class PageSpeciesGenome extends PageSpecies { public static String rateFlowering(int flowering) { if (flowering >= 99) { - return "Maximum"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.MAXIMUM); } if (flowering >= 35) { - return "Fastest"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.FASTEST); } if (flowering >= 30) { - return "Faster"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.FASTER); } if (flowering >= 25) { - return "Fast"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.FAST); } if (flowering >= 20) { - return "Normal"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.AVERAGE); } if (flowering >= 15) { - return "Slow"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.SLOW); } if (flowering >= 10) { - return "Slower"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.SLOWER); } - return "Slowest"; + return AlleleHelper.toDisplay(EnumAllele.Flowering.SLOWEST); } public static String rateSpeed(float speed) { if (speed >= 1.7f) { - return "Fastest"; + return AlleleHelper.toDisplay(EnumAllele.Speed.FASTEST); } if (speed >= 1.4f) { - return "Faster"; + return AlleleHelper.toDisplay(EnumAllele.Speed.FASTER); } if (speed >= 1.2f) { - return "Fast"; + return AlleleHelper.toDisplay(EnumAllele.Speed.FAST); } if (speed >= 1.0f) { - return "Normal"; + return AlleleHelper.toDisplay(EnumAllele.Speed.NORMAL); } if (speed >= 0.8f) { - return "Slow"; + return AlleleHelper.toDisplay(EnumAllele.Speed.SLOW); } if (speed >= 0.6f) { - return "Slower"; + return AlleleHelper.toDisplay(EnumAllele.Speed.SLOWER); } - return "Slowest"; + return AlleleHelper.toDisplay(EnumAllele.Speed.SLOWEST); } public static String rateLifespan(int life) { if (life >= 70) { - return "Longest"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.LONGEST); } if (life >= 60) { - return "Longer"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.LONGER); } if (life >= 50) { - return "Long"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.LONG); } if (life >= 45) { - return "Elongated"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.ELONGATED); } if (life >= 40) { - return "Normal"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.NORMAL); } if (life >= 35) { - return "Shortened"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORTENED); } if (life >= 30) { - return "Short"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORT); } if (life >= 20) { - return "Shorter"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORTER); } - return "Shortest"; + return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORTEST); } public static String tolerated(boolean t) { if (t) { - return "Tolerated"; + return I18N.localise("extrabees.gui.database.tab.species.genome.tolerated"); } - return "Not Tolerated"; + return AlleleHelper.toDisplay(EnumTolerance.NONE); } @Override @@ -144,31 +148,32 @@ public class PageSpeciesGenome extends PageSpecies { IBeeGenome genome = Binnie.Genetics.getBeeRoot().templateAsGenome(template); speedText.setValue(rateSpeed(genome.getSpeed())); lifespanText.setValue(rateLifespan(genome.getLifespan())); - fertilityText.setValue(genome.getFertility() + " children"); + fertilityText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.children", genome.getFertility())); 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"; - } + String behavior; if (genome.getNocturnal()) { - behavior = "All Day"; + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.allDay"); + } else if (genome.getPrimary().isNocturnal()) { + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.nighttime"); + } else { + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.daytime"); } - + nocturnalText.setValue(behavior); if (genome.getCaveDwelling()) { - caveDwellingText.setValue("Not Needed"); + caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.notNeeded")); } else { - caveDwellingText.setValue("Required"); + caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.required")); } tolerantFlyerText.setValue(tolerated(genome.getTolerantFlyer())); if (genome.getFlowerProvider() != null) { flowerText.setValue(genome.getFlowerProvider().getDescription()); } else { - flowerText.setValue("None"); + flowerText.setValue(AlleleHelper.toDisplay(EnumTolerance.NONE)); } effectText.setValue(genome.getEffect().getName()); } diff --git a/src/main/java/binnie/extrabees/gui/database/WindowApiaristDatabase.java b/src/main/java/binnie/extrabees/gui/database/WindowApiaristDatabase.java index f60be856..66258cfc 100644 --- a/src/main/java/binnie/extrabees/gui/database/WindowApiaristDatabase.java +++ b/src/main/java/binnie/extrabees/gui/database/WindowApiaristDatabase.java @@ -12,7 +12,9 @@ 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.core.util.I18N; import binnie.extrabees.ExtraBees; +import binnie.extrabees.gui.database.product.PageSpeciesProducts; import cpw.mods.fml.relauncher.Side; import net.minecraft.entity.player.EntityPlayer; @@ -46,6 +48,6 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase { @Override public String getName() { - return "Database"; + return I18N.localise("extrabees.gui.database"); } } diff --git a/src/main/java/binnie/extrabees/gui/database/ControlProductsBox.java b/src/main/java/binnie/extrabees/gui/database/product/ControlProductsBox.java similarity index 63% rename from src/main/java/binnie/extrabees/gui/database/ControlProductsBox.java rename to src/main/java/binnie/extrabees/gui/database/product/ControlProductsBox.java index a3276a1c..d310f862 100644 --- a/src/main/java/binnie/extrabees/gui/database/ControlProductsBox.java +++ b/src/main/java/binnie/extrabees/gui/database/product/ControlProductsBox.java @@ -1,4 +1,4 @@ -package binnie.extrabees.gui.database; +package binnie.extrabees.gui.database.product; import binnie.Binnie; import binnie.core.BinnieCore; @@ -12,16 +12,17 @@ import net.minecraft.item.ItemStack; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; -public class ControlProductsBox extends ControlListBox { +public class ControlProductsBox extends ControlListBox { protected IAlleleBeeSpecies species; - private Type type; + private ProductType type; - public ControlProductsBox(IWidget parent, int x, int y, int width, int height, Type type) { + public ControlProductsBox(IWidget parent, int x, int y, int width, int height, ProductType type) { super(parent, x, y, width, height, 12.0f); - species = null; this.type = type; + species = null; } @Override @@ -44,31 +45,17 @@ public class ControlProductsBox extends ControlListBox strings = new ArrayList<>(); - if (type == Type.Products) { - for (Map.Entry entry : species.getProductChances().entrySet()) { - strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); - } + Set> chances; + if (type == ProductType.PRODUCTS) { + chances = species.getProductChances().entrySet(); } else { - for (Map.Entry entry : species.getSpecialtyChances().entrySet()) { - strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); - } + chances = species.getSpecialtyChances().entrySet(); + } + + for (Map.Entry entry : chances) { + strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); } setOptions(strings); } } - - enum Type { - Products, - Specialties - } - - class Product { - protected ItemStack item; - protected float chance; - - public Product(ItemStack item, float chance) { - this.item = item; - this.chance = chance; - } - } } diff --git a/src/main/java/binnie/extrabees/gui/database/ControlProductsItem.java b/src/main/java/binnie/extrabees/gui/database/product/ControlProductsItem.java similarity index 85% rename from src/main/java/binnie/extrabees/gui/database/ControlProductsItem.java rename to src/main/java/binnie/extrabees/gui/database/product/ControlProductsItem.java index fd9caa59..f36964b2 100644 --- a/src/main/java/binnie/extrabees/gui/database/ControlProductsItem.java +++ b/src/main/java/binnie/extrabees/gui/database/product/ControlProductsItem.java @@ -1,4 +1,4 @@ -package binnie.extrabees.gui.database; +package binnie.extrabees.gui.database.product; import binnie.core.craftgui.controls.ControlText; import binnie.core.craftgui.controls.ControlTextCentered; @@ -11,10 +11,10 @@ import binnie.core.util.I18N; import java.text.DecimalFormat; -public class ControlProductsItem extends ControlOption { +public class ControlProductsItem extends ControlOption { protected ControlItemDisplay item; - public ControlProductsItem(ControlList controlList, ControlProductsBox.Product value, int y) { + public ControlProductsItem(ControlList controlList, Product value, int y) { super(controlList, value, y); (item = new ControlItemDisplay(this, 4.0f, 4.0f)).setTooltip(); ControlText textWidget = new ControlTextCentered(this, 2.0f, ""); diff --git a/src/main/java/binnie/extrabees/gui/database/PageSpeciesProducts.java b/src/main/java/binnie/extrabees/gui/database/product/PageSpeciesProducts.java similarity index 59% rename from src/main/java/binnie/extrabees/gui/database/PageSpeciesProducts.java rename to src/main/java/binnie/extrabees/gui/database/product/PageSpeciesProducts.java index 17fca049..ff118192 100644 --- a/src/main/java/binnie/extrabees/gui/database/PageSpeciesProducts.java +++ b/src/main/java/binnie/extrabees/gui/database/product/PageSpeciesProducts.java @@ -1,25 +1,24 @@ -package binnie.extrabees.gui.database; +package binnie.extrabees.gui.database.product; 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.util.I18N; import forestry.api.apiculture.IAlleleBeeSpecies; import forestry.api.genetics.IAlleleSpecies; public class PageSpeciesProducts extends PageSpecies { - protected ControlText title; protected ControlProductsBox products; - protected ControlText title2; protected ControlProductsBox specialties; public PageSpeciesProducts(IWidget parent, DatabaseTab tab) { super(parent, tab); - 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); + new ControlTextCentered(this, 8.0f, I18N.localise("extrabees.gui.database.tab.species.products")); + products = new ControlProductsBox(this, 4, 20, 136, 48, ProductType.PRODUCTS); + + new ControlTextCentered(this, 68.0f, I18N.localise("extrabees.gui.database.tab.species.specialties")); + specialties = new ControlProductsBox(this, 4, 80, 136, 48, ProductType.SPECIALTIES); } @Override diff --git a/src/main/java/binnie/extrabees/gui/database/product/Product.java b/src/main/java/binnie/extrabees/gui/database/product/Product.java new file mode 100644 index 00000000..4d6d56c3 --- /dev/null +++ b/src/main/java/binnie/extrabees/gui/database/product/Product.java @@ -0,0 +1,13 @@ +package binnie.extrabees.gui.database.product; + +import net.minecraft.item.ItemStack; + +public class Product { + protected ItemStack item; + protected float chance; + + public Product(ItemStack item, float chance) { + this.item = item; + this.chance = chance; + } +} diff --git a/src/main/java/binnie/extrabees/gui/database/product/ProductType.java b/src/main/java/binnie/extrabees/gui/database/product/ProductType.java new file mode 100644 index 00000000..bbc9ec6f --- /dev/null +++ b/src/main/java/binnie/extrabees/gui/database/product/ProductType.java @@ -0,0 +1,6 @@ +package binnie.extrabees.gui.database.product; + +public enum ProductType { + PRODUCTS, + SPECIALTIES +} diff --git a/src/main/java/binnie/extrabees/products/EnumHoneyDrop.java b/src/main/java/binnie/extrabees/products/EnumHoneyDrop.java index a49728a5..11f0f606 100644 --- a/src/main/java/binnie/extrabees/products/EnumHoneyDrop.java +++ b/src/main/java/binnie/extrabees/products/EnumHoneyDrop.java @@ -68,9 +68,10 @@ public enum EnumHoneyDrop implements IItemEnum { public void addRecipe() { FluidStack liquid = Binnie.Liquid.getLiquidStack(liquidName, 200); - if (liquid != null) { - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{get(1)}, liquid, remenant, 100); + if (liquid == null) { + return; } + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{get(1)}, liquid, remenant, 100); } @Override diff --git a/src/main/java/binnie/extrabees/products/EnumPropolis.java b/src/main/java/binnie/extrabees/products/EnumPropolis.java index ce716dc5..052b53b9 100644 --- a/src/main/java/binnie/extrabees/products/EnumPropolis.java +++ b/src/main/java/binnie/extrabees/products/EnumPropolis.java @@ -42,9 +42,10 @@ public enum EnumPropolis implements IItemEnum { public void addRecipe() { FluidStack liquid = Binnie.Liquid.getLiquidStack(liquidName, 500); - if (liquid != null) { - RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{get(1)}, liquid, null, 0); + if (liquid == null) { + return; } + RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{get(1)}, liquid, null, 0); } @Override diff --git a/src/main/java/binnie/extratrees/block/BlockETLog.java b/src/main/java/binnie/extratrees/block/BlockETLog.java index d8ea8167..e736a11f 100644 --- a/src/main/java/binnie/extratrees/block/BlockETLog.java +++ b/src/main/java/binnie/extratrees/block/BlockETLog.java @@ -99,12 +99,12 @@ public class BlockETLog extends BlockLog implements IBlockMetadata { } @Override - public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { + public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) { return BlockMetadata.breakBlock(this, player, world, x, y, z); } @Override - public TileEntity createNewTileEntity(World var1, int i) { + public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityMetadata(); } diff --git a/src/main/java/binnie/extratrees/block/BlockETPlanks.java b/src/main/java/binnie/extratrees/block/BlockETPlanks.java index a9a91df4..23cd94fc 100644 --- a/src/main/java/binnie/extratrees/block/BlockETPlanks.java +++ b/src/main/java/binnie/extratrees/block/BlockETPlanks.java @@ -39,7 +39,7 @@ public class BlockETPlanks extends BlockWood implements IBlockMetadata { } @Override - public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z) { + public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z, boolean willHarvest) { return BlockMetadata.breakBlock(this, player, world, x, y, z); } diff --git a/src/main/java/binnie/extratrees/block/GateItemRenderer.java b/src/main/java/binnie/extratrees/block/GateItemRenderer.java index 38033aff..98141302 100644 --- a/src/main/java/binnie/extratrees/block/GateItemRenderer.java +++ b/src/main/java/binnie/extratrees/block/GateItemRenderer.java @@ -13,7 +13,6 @@ public class GateItemRenderer implements IItemRenderer { private void renderStairBlock(RenderBlocks renderBlocks, ItemStack item, float f, float g, float h) { Tessellator tessellator = Tessellator.instance; Block block = ((ItemBlock) item.getItem()).field_150939_a; - IIcon textureIndex = WoodManager.getPlankType(item.getItemDamage()).getIcon(); for (int k = 0; k < 3; ++k) { float f2 = 0.0625f; if (k == 0) { diff --git a/src/main/java/binnie/extratrees/block/ItemETDoor.java b/src/main/java/binnie/extratrees/block/ItemETDoor.java index a6d7e219..52654987 100644 --- a/src/main/java/binnie/extratrees/block/ItemETDoor.java +++ b/src/main/java/binnie/extratrees/block/ItemETDoor.java @@ -42,9 +42,7 @@ public class ItemETDoor extends ItemMetadata { boolean flag = world.getBlock(x - b0, y, z - b2) == block || world.getBlock(x - b0, y + 1, z - b2) == block; boolean flag2 = world.getBlock(x + b0, y, z + b2) == block || world.getBlock(x + b0, y + 1, z + b2) == block; boolean flag3 = false; - if (flag && !flag2) { - flag3 = true; - } else if (j1 > i1) { + if (flag && !flag2 || j1 > i1) { flag3 = true; } diff --git a/src/main/java/binnie/extratrees/block/ItemETSlab.java b/src/main/java/binnie/extratrees/block/ItemETSlab.java index fef0fe06..9586eaa9 100644 --- a/src/main/java/binnie/extratrees/block/ItemETSlab.java +++ b/src/main/java/binnie/extratrees/block/ItemETSlab.java @@ -50,7 +50,8 @@ public class ItemETSlab extends ItemMetadata { } return true; } - return func_77888_a(stack, player, world, x, y, z, meta) || super.onItemUse(stack, player, world, x, y, z, meta, hitX, hitY, hitZ); + return func_77888_a(stack, player, world, x, y, z, meta) + || super.onItemUse(stack, player, world, x, y, z, meta, hitX, hitY, hitZ); } private boolean func_77888_a(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side) { diff --git a/src/main/java/binnie/extratrees/block/ModuleBlocks.java b/src/main/java/binnie/extratrees/block/ModuleBlocks.java index 181693dd..27ede2db 100644 --- a/src/main/java/binnie/extratrees/block/ModuleBlocks.java +++ b/src/main/java/binnie/extratrees/block/ModuleBlocks.java @@ -69,8 +69,7 @@ public class ModuleBlocks implements IInitializable { FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:fence"); FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:gate"); - // FMLInterModComms.sendMessage("Forestry", "add-alveary-slab", - // "ExtraTrees:slab"); + // FMLInterModComms.sendMessage("Forestry", "add-alveary-slab", "ExtraTrees:slab"); FMLInterModComms.sendMessage("Forestry", "add-fence-block", "ExtraTrees:multifence"); ModuleBlocks.hedgeRenderID = BinnieCore.proxy.getUniqueRenderID(); } diff --git a/src/main/java/binnie/extratrees/block/StairItemRenderer.java b/src/main/java/binnie/extratrees/block/StairItemRenderer.java index 885ce339..2059c0f9 100644 --- a/src/main/java/binnie/extratrees/block/StairItemRenderer.java +++ b/src/main/java/binnie/extratrees/block/StairItemRenderer.java @@ -22,6 +22,7 @@ public class StairItemRenderer implements IItemRenderer { if (i == 1) { renderBlocks.setRenderBounds(0.0, 0.0, 0.5, 1.0, 0.5, 1.0); } + GL11.glTranslatef(-0.5f, -0.5f, -0.5f); tessellator.startDrawingQuads(); tessellator.setNormal(0.0f, -1.0f, 0.0f); diff --git a/src/main/java/binnie/extratrees/block/WoodManager.java b/src/main/java/binnie/extratrees/block/WoodManager.java index 1e67602e..9c7c2f19 100644 --- a/src/main/java/binnie/extratrees/block/WoodManager.java +++ b/src/main/java/binnie/extratrees/block/WoodManager.java @@ -49,7 +49,6 @@ public class WoodManager { if (f != null && ItemStack.areItemStacksEqual(stack, f)) { return new FenceDescription(new FenceType(0), type, type); } - continue; } } return null; @@ -95,7 +94,7 @@ public class WoodManager { } public static List getAllPlankTypes() { - List list = new ArrayList(); + List list = new ArrayList<>(); Collections.addAll(list, PlankType.ExtraTreePlanks.values()); Collections.addAll(list, PlankType.ForestryPlanks.values()); for (IPlankType type : PlankType.ExtraBiomesPlank.values()) { diff --git a/src/main/java/binnie/extratrees/block/decor/BlockFence.java b/src/main/java/binnie/extratrees/block/decor/BlockFence.java index 8662117d..121a2694 100644 --- a/src/main/java/binnie/extratrees/block/decor/BlockFence.java +++ b/src/main/java/binnie/extratrees/block/decor/BlockFence.java @@ -42,7 +42,12 @@ public class BlockFence extends net.minecraft.block.BlockFence implements IBlock } public static boolean canConnect(Block block) { - return block == ((ItemBlock) Mods.forestry.item("fences")).field_150939_a || block == Blocks.fence || block == Blocks.fence_gate || block == Blocks.nether_brick_fence || block instanceof IBlockFence || block == ExtraTrees.blockGate; + return block == ((ItemBlock) Mods.forestry.item("fences")).field_150939_a + || block == Blocks.fence + || block == Blocks.fence_gate + || block == Blocks.nether_brick_fence + || block instanceof IBlockFence + || block == ExtraTrees.blockGate; } @Override @@ -176,10 +181,11 @@ public class BlockFence extends net.minecraft.block.BlockFence implements IBlock @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister register) { + // ignored } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { return BlockMetadata.getPickBlock(world, x, y, z); } } diff --git a/src/main/java/binnie/extratrees/block/decor/BlockGate.java b/src/main/java/binnie/extratrees/block/decor/BlockGate.java index 5f46e148..5f80375f 100644 --- a/src/main/java/binnie/extratrees/block/decor/BlockGate.java +++ b/src/main/java/binnie/extratrees/block/decor/BlockGate.java @@ -137,7 +137,7 @@ public class BlockGate extends BlockFenceGate implements IBlockMetadata { } @Override - public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) { return BlockMetadata.getPickBlock(world, x, y, z); } diff --git a/src/main/java/binnie/extratrees/block/decor/BlockMultiFence.java b/src/main/java/binnie/extratrees/block/decor/BlockMultiFence.java index 4e3287d3..d243d949 100644 --- a/src/main/java/binnie/extratrees/block/decor/BlockMultiFence.java +++ b/src/main/java/binnie/extratrees/block/decor/BlockMultiFence.java @@ -37,8 +37,8 @@ public class BlockMultiFence extends BlockFence implements IBlockMetadata { int meta = TileEntityMetadata.getItemDamage(itemStack); IPlankType type1 = getDescription(meta).getPlankType(); IPlankType type2 = getDescription(meta).getSecondaryPlankType(); - boolean twoTypes = type1 != type2; FenceType type3 = getDescription(meta).getFenceType(); + boolean twoTypes = type1 != type2; return I18N.localise("extratrees.block.woodslab.name" + (twoTypes ? "2" : ""), type3.getPrefix(), type1.getName(), type2.getName()); } } diff --git a/src/main/java/binnie/extratrees/block/decor/MultiFenceRecipeEmbedded.java b/src/main/java/binnie/extratrees/block/decor/MultiFenceRecipeEmbedded.java index 5a1ab64d..7a193cd1 100644 --- a/src/main/java/binnie/extratrees/block/decor/MultiFenceRecipeEmbedded.java +++ b/src/main/java/binnie/extratrees/block/decor/MultiFenceRecipeEmbedded.java @@ -18,26 +18,28 @@ public class MultiFenceRecipeEmbedded implements IRecipe { ItemStack a = inv.getStackInSlot(row * 3); ItemStack b = inv.getStackInSlot(row * 3 + 1); ItemStack c = inv.getStackInSlot(row * 3 + 2); - if (a != null && b != null) { - if (c != null) { - type = WoodManager.getFenceType(a); - FenceType type2 = WoodManager.getFenceType(c); - if (type != null && type2 != null) { - if (type.equals(type2)) { - IPlankType pType = WoodManager.get(b); - if (WoodManager.getFenceDescription(a).getPlankType() == pType) { - cached = WoodManager.getFence( - WoodManager.getFenceDescription(a).getPlankType(), - WoodManager.getFenceDescription(a).getSecondaryPlankType(), - new FenceType(type.size, type.solid, true), - 2 - ); - return true; - } - } - } - } + if (a == null || b == null || c == null) { + continue; } + + type = WoodManager.getFenceType(a); + FenceType type2 = WoodManager.getFenceType(c); + if (type == null || type2 == null || !type.equals(type2)) { + continue; + } + + IPlankType pType = WoodManager.get(b); + if (WoodManager.getFenceDescription(a).getPlankType() != pType) { + continue; + } + + cached = WoodManager.getFence( + WoodManager.getFenceDescription(a).getPlankType(), + WoodManager.getFenceDescription(a).getSecondaryPlankType(), + new FenceType(type.size, type.solid, true), + 2 + ); + return true; } return false; } diff --git a/src/main/java/binnie/extratrees/block/decor/MultiFenceRecipeSolid.java b/src/main/java/binnie/extratrees/block/decor/MultiFenceRecipeSolid.java index 33146ca6..81c4ebe8 100644 --- a/src/main/java/binnie/extratrees/block/decor/MultiFenceRecipeSolid.java +++ b/src/main/java/binnie/extratrees/block/decor/MultiFenceRecipeSolid.java @@ -17,24 +17,24 @@ public class MultiFenceRecipeSolid implements IRecipe { ItemStack a = inv.getStackInSlot(row * 3); ItemStack b = inv.getStackInSlot(row * 3 + 1); ItemStack c = inv.getStackInSlot(row * 3 + 2); - if (a != null && b != null) { - if (c != null) { - type = WoodManager.getFenceType(a); - FenceType type2 = WoodManager.getFenceType(b); - FenceType type3 = WoodManager.getFenceType(c); - if (type != null && type2 != null && type3 != null && type.equals(type2)) { - if (type.equals(type3)) { - cached = WoodManager.getFence( - WoodManager.getFenceDescription(a).getPlankType(), - WoodManager.getFenceDescription(a).getSecondaryPlankType(), - new FenceType(type.size, true, type.solid), - 2 - ); - return true; - } - } - } + if (a == null || b == null || c == null) { + continue; } + + type = WoodManager.getFenceType(a); + FenceType type2 = WoodManager.getFenceType(b); + FenceType type3 = WoodManager.getFenceType(c); + if (type == null || type2 == null || type3 == null || !type.equals(type2) || !type.equals(type3)) { + continue; + } + + cached = WoodManager.getFence( + WoodManager.getFenceDescription(a).getPlankType(), + WoodManager.getFenceDescription(a).getSecondaryPlankType(), + new FenceType(type.size, true, type.solid), + 2 + ); + return true; } return false; } diff --git a/src/main/java/binnie/extratrees/block/decor/NBTShapedRecipe.java b/src/main/java/binnie/extratrees/block/decor/NBTShapedRecipe.java index 20c87fdf..84bce7fc 100644 --- a/src/main/java/binnie/extratrees/block/decor/NBTShapedRecipe.java +++ b/src/main/java/binnie/extratrees/block/decor/NBTShapedRecipe.java @@ -130,6 +130,7 @@ public class NBTShapedRecipe implements IRecipe { @Override public ItemStack getCraftingResult(InventoryCrafting crafting) { ItemStack itemstack = getRecipeOutput().copy(); + // todo unused code? if (field_92101_f) { for (int i = 0; i < crafting.getSizeInventory(); ++i) { ItemStack itemstack2 = crafting.getStackInSlot(i); diff --git a/src/main/java/binnie/extratrees/carpentry/BlockDesign.java b/src/main/java/binnie/extratrees/carpentry/BlockDesign.java index 77d2c233..c1941244 100644 --- a/src/main/java/binnie/extratrees/carpentry/BlockDesign.java +++ b/src/main/java/binnie/extratrees/carpentry/BlockDesign.java @@ -134,7 +134,11 @@ public abstract class BlockDesign extends BlockMetadata implements IMultipassBlo public void addBlockTooltip(ItemStack stack, List tooltip) { DesignBlock block = ModuleCarpentry.getDesignBlock(getDesignSystem(), TileEntityMetadata.getItemDamage(stack)); if (block.getPrimaryMaterial() != block.getSecondaryMaterial()) { - tooltip.add(I18N.localise("extratrees.block.tooltip.twoColors", block.getPrimaryMaterial().getName(), block.getSecondaryMaterial().getName())); + tooltip.add(I18N.localise( + "extratrees.block.tooltip.twoColors", + block.getPrimaryMaterial().getName(), + block.getSecondaryMaterial().getName() + )); } else { tooltip.add(block.getPrimaryMaterial().getName()); } diff --git a/src/main/java/binnie/extratrees/carpentry/CarpentryInterface.java b/src/main/java/binnie/extratrees/carpentry/CarpentryInterface.java index 6419c344..ea833bd8 100644 --- a/src/main/java/binnie/extratrees/carpentry/CarpentryInterface.java +++ b/src/main/java/binnie/extratrees/carpentry/CarpentryInterface.java @@ -22,7 +22,8 @@ public class CarpentryInterface implements ICarpentryInterface { @Override public boolean registerCarpentryWood(int index, IDesignMaterial wood) { - return wood != null && CarpentryInterface.woodMap.put(index, wood) == null; + return wood != null + && CarpentryInterface.woodMap.put(index, wood) == null; } @Override diff --git a/src/main/java/binnie/extratrees/carpentry/DesignSystem.java b/src/main/java/binnie/extratrees/carpentry/DesignSystem.java index a2ecb976..ddc092d5 100644 --- a/src/main/java/binnie/extratrees/carpentry/DesignSystem.java +++ b/src/main/java/binnie/extratrees/carpentry/DesignSystem.java @@ -32,31 +32,25 @@ public enum DesignSystem implements IDesignSystem { @Override public IDesignMaterial getDefaultMaterial() { switch (this) { - case Glass: { + case Glass: return GlassType.get(0); - } - case Wood: { + + case Wood: return PlankType.ExtraTreePlanks.Fir; - } - default: { - return null; - } } + return null; } @Override public IDesignMaterial getDefaultMaterial2() { switch (this) { - case Glass: { + case Glass: return GlassType.get(1); - } - case Wood: { + + case Wood: return PlankType.ExtraTreePlanks.Whitebeam; - } - default: { - return null; - } } + return null; } @Override diff --git a/src/main/java/binnie/extratrees/carpentry/DesignerManager.java b/src/main/java/binnie/extratrees/carpentry/DesignerManager.java index 853f2d57..365e3e94 100644 --- a/src/main/java/binnie/extratrees/carpentry/DesignerManager.java +++ b/src/main/java/binnie/extratrees/carpentry/DesignerManager.java @@ -7,11 +7,7 @@ import java.util.Collection; import java.util.List; public class DesignerManager { - public static DesignerManager instance; - - static { - DesignerManager.instance = new DesignerManager(); - } + public static DesignerManager instance = new DesignerManager(); List systems; @@ -26,8 +22,4 @@ public class DesignerManager { public Collection getDesignSystems() { return systems; } - - public void addDesignSystem(DesignSystem system) { - systems.add(system); - } } diff --git a/src/main/java/binnie/extratrees/carpentry/GlassType.java b/src/main/java/binnie/extratrees/carpentry/GlassType.java index 4a2a6070..2383e16e 100644 --- a/src/main/java/binnie/extratrees/carpentry/GlassType.java +++ b/src/main/java/binnie/extratrees/carpentry/GlassType.java @@ -7,16 +7,16 @@ import binnie.extratrees.api.IDesignMaterial; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import java.awt.Color; import java.util.LinkedHashMap; import java.util.Map; public class GlassType implements IDesignMaterial { - protected static Map types; + protected static Map types = new LinkedHashMap<>(); static { - GlassType.types = new LinkedHashMap<>(); for (StandardColor c : StandardColor.values()) { - GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.colour)); + GlassType.types.put(c.ordinal(), new GlassType(c.ordinal(), c.name, c.color)); } for (EnumFlowerColor c2 : EnumFlowerColor.values()) { GlassType.types.put(128 + c2.ordinal(), new GlassType(128 + c2.ordinal(), c2.getName(), c2.getColor(false))); @@ -24,13 +24,13 @@ public class GlassType implements IDesignMaterial { } protected String name; - protected int colour; + protected int color; protected int id; - private GlassType(int id, String name, int colour) { + private GlassType(int id, String name, int color) { this.id = id; this.name = name; - this.colour = colour; + this.color = color; } public static int getIndex(IDesignMaterial id) { @@ -73,33 +73,33 @@ public class GlassType implements IDesignMaterial { @Override public int getColor() { - return colour; + return color; } private enum StandardColor { - White("White", 16777215), - Orange("Orange", 14188339), - Magenta("Magenta", 11685080), - LightBlue("Light Blue", 6724056), - Yellow("Yellow", 15066419), - Lime("Lime", 8375321), - Pink("Pink", 15892389), - Gray("Gray", 5000268), - LightGray("Light Gray", 10066329), - Cyan("Cyan", 5013401), - Purple("Purple", 8339378), - Blue("Blue", 3361970), - Brown("Brown", 6704179), - Green("Green", 6717235), - Red("Red", 10040115), - Black("Black", 1644825); + White("White", new Color(0xffffff)), + Orange("Orange", new Color(0xd87f33)), + Magenta("Magenta", new Color(0xb24cd8)), + LightBlue("Light Blue", new Color(0x6699d8)), + Yellow("Yellow", new Color(0xe5e533)), + Lime("Lime", new Color(0x7fcc19)), + Pink("Pink", new Color(0xf27fa5)), + Gray("Gray", new Color(0x4c4c4c)), + LightGray("Light Gray", new Color(0x999999)), + Cyan("Cyan", new Color(0x4c7f99)), + Purple("Purple", new Color(0x7f3fb2)), + Blue("Blue", new Color(0x334cb2)), + Brown("Brown", new Color(0x664c33)), + Green("Green", new Color(0x667f33)), + Red("Red", new Color(0x993333)), + Black("Black", new Color(0x191919)); protected String name; - protected int colour; + protected int color; - StandardColor(String name, int colour) { + StandardColor(String name, Color color) { this.name = name; - this.colour = colour; + this.color = color.getRGB(); } } } diff --git a/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java b/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java index c800506d..f08f5d4c 100644 --- a/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java +++ b/src/main/java/binnie/extratrees/carpentry/ModuleCarpentry.java @@ -96,10 +96,4 @@ public class ModuleCarpentry implements IInitializable { CarpentryManager.carpentryInterface.registerDesign(design.ordinal(), design); } } - - enum Axis { - Y, - X, - Z - } } diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlBreweryProgress.java b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlBreweryProgress.java index 6e3643ac..2cf31757 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlBreweryProgress.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlBreweryProgress.java @@ -21,8 +21,8 @@ import org.lwjgl.opengl.GL11; import java.util.Collections; public class ControlBreweryProgress extends ControlProgressBase { - protected static Texture Brewery = new StandardTexture(0, 69, 34, 39, ExtraTreeTexture.Gui); - protected static Texture BreweryOverlay = new StandardTexture(34, 69, 34, 39, ExtraTreeTexture.Gui); + protected static Texture brewery = new StandardTexture(0, 69, 34, 39, ExtraTreeTexture.Gui); + protected static Texture breweryOverlay = new StandardTexture(34, 69, 34, 39, ExtraTreeTexture.Gui); protected ControlBreweryProgress(IWidget parent, float x, float y) { super(parent, x, y, 34.0f, 39.0f); @@ -31,12 +31,9 @@ public class ControlBreweryProgress extends ControlProgressBase { @Override public void onRenderBackground() { - CraftGUI.Render.texture(ControlBreweryProgress.Brewery, new IPoint(0.0f, 0.0f)); + CraftGUI.Render.texture(ControlBreweryProgress.brewery, new IPoint(0.0f, 0.0f)); Brewery.ComponentBreweryLogic logic = Machine.getInterface(Brewery.ComponentBreweryLogic.class, Window.get(this).getInventory()); - if (logic.currentCrafting == null) { - return; - } - if (logic.currentCrafting.currentInput == null) { + if (logic.currentCrafting == null || logic.currentCrafting.currentInput == null) { return; } @@ -80,7 +77,6 @@ public class ControlBreweryProgress extends ControlProgressBase { int r = (hex & 0xFF0000) >> 16; int g = (hex & 0xFF00) >> 8; int b = hex & 0xFF; - IIcon icon = fluid.getFluid().getIcon(); GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlDistilleryProgress.java b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlDistilleryProgress.java index 3c63841e..0aadac5f 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlDistilleryProgress.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlDistilleryProgress.java @@ -14,42 +14,24 @@ import binnie.core.machines.Machine; import binnie.extratrees.core.ExtraTreeTexture; import binnie.extratrees.machines.Distillery; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.IIcon; import net.minecraftforge.fluids.FluidStack; import org.lwjgl.opengl.GL11; public class ControlDistilleryProgress extends ControlProgressBase { - protected static Texture DistilleryBase = new StandardTexture(43, 0, 58, 66, ExtraTreeTexture.Gui); - protected static Texture DistilleryOverlay = new StandardTexture(139, 0, 18, 66, ExtraTreeTexture.Gui); - protected static Texture LiquidFlow = new StandardTexture(101, 0, 38, 66, ExtraTreeTexture.Gui); - protected static Texture Output = new StandardTexture(68, 66, 17, 7, ExtraTreeTexture.Gui); + protected static Texture distilleryBase = new StandardTexture(43, 0, 58, 66, ExtraTreeTexture.Gui); + protected static Texture distilleryOverlay = new StandardTexture(139, 0, 18, 66, ExtraTreeTexture.Gui); + protected static Texture liquidFlow = new StandardTexture(101, 0, 38, 66, ExtraTreeTexture.Gui); + protected static Texture output = new StandardTexture(68, 66, 17, 7, ExtraTreeTexture.Gui); protected ControlDistilleryProgress(IWidget parent, float x, float y) { super(parent, x, y, 58.0f, 66.0f); - addSelfEventHandler(new EventMouse.Down.Handler() { - @Override - public void onEvent(EventMouse.Down event) { - int distillationLevel = -1; - if (new IArea(45.0f, 8.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) { - distillationLevel = 0; - } else if (new IArea(45.0f, 23.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) { - distillationLevel = 1; - } else if (new IArea(45.0f, 38.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) { - distillationLevel = 2; - } - if (distillationLevel >= 0) { - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setByte("i", (byte) distillationLevel); - Window.get(getWidget()).sendClientAction("still-level", nbt); - } - } - }); + addSelfEventHandler(new MouseDownHandler()); } @Override public void onRenderBackground() { - CraftGUI.Render.texture(ControlDistilleryProgress.DistilleryBase, new IPoint(0.0f, 0.0f)); - CraftGUI.Render.texturePercentage(ControlDistilleryProgress.LiquidFlow, new IArea(18.0f, 0.0f, 38.0f, 66.0f), Position.LEFT, progress); + CraftGUI.Render.texture(ControlDistilleryProgress.distilleryBase, new IPoint(0.0f, 0.0f)); + CraftGUI.Render.texturePercentage(ControlDistilleryProgress.liquidFlow, new IArea(18.0f, 0.0f, 38.0f, 66.0f), Position.LEFT, progress); Distillery.ComponentDistilleryLogic component = Machine.getInterface(Distillery.ComponentDistilleryLogic.class, Window.get(this).getInventory()); FluidStack stack = null; if (component != null) { @@ -66,8 +48,8 @@ public class ControlDistilleryProgress extends ControlProgressBase { @Override public void onRenderForeground() { int level = Machine.getInterface(Distillery.ComponentDistilleryLogic.class, Window.get(this).getInventory()).level; - CraftGUI.Render.texture(ControlDistilleryProgress.Output, new IPoint(47.0f, 14 + level * 15)); - CraftGUI.Render.texture(ControlDistilleryProgress.DistilleryOverlay, new IPoint(0.0f, 0.0f)); + CraftGUI.Render.texture(output, new IPoint(47.0f, 14 + level * 15)); + CraftGUI.Render.texture(distilleryOverlay, new IPoint(0.0f, 0.0f)); } public void renderFluid(FluidStack fluid, IPoint pos) { @@ -75,11 +57,30 @@ public class ControlDistilleryProgress extends ControlProgressBase { int r = (hex & 0xFF0000) >> 16; int g = (hex & 0xFF00) >> 8; int b = hex & 0xFF; - IIcon icon = fluid.getFluid().getIcon(); GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); CraftGUI.Render.iconBlock(pos, fluid.getFluid().getIcon()); GL11.glDisable(3042); } + + private class MouseDownHandler extends EventMouse.Down.Handler { + @Override + public void onEvent(EventMouse.Down event) { + int distillationLevel = -1; + if (new IArea(45.0f, 8.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) { + distillationLevel = 0; + } else if (new IArea(45.0f, 23.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) { + distillationLevel = 1; + } else if (new IArea(45.0f, 38.0f, 19.0f, 11.0f).contains(getRelativeMousePosition())) { + distillationLevel = 2; + } + + if (distillationLevel >= 0) { + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setByte("i", (byte) distillationLevel); + Window.get(getWidget()).sendClientAction("still-level", nbt); + } + } + } } diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlFruitPressProgress.java b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlFruitPressProgress.java index 5a9fc85e..0c1317f7 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlFruitPressProgress.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlFruitPressProgress.java @@ -13,55 +13,56 @@ import binnie.extratrees.core.ExtraTreeTexture; import binnie.extratrees.machines.Press; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.IIcon; import net.minecraftforge.fluids.Fluid; import org.lwjgl.opengl.GL11; public class ControlFruitPressProgress extends ControlProgressBase { - protected static Texture PressTexture = new StandardTexture(6, 0, 24, 52, ExtraTreeTexture.Gui); - protected static Texture PressSlot = new StandardTexture(9, 52, 34, 17, ExtraTreeTexture.Gui); + protected static Texture pressTexture = new StandardTexture(6, 0, 24, 52, ExtraTreeTexture.Gui); + protected static Texture pressSlot = new StandardTexture(9, 52, 34, 17, ExtraTreeTexture.Gui); protected ControlFruitPressProgress(IWidget parent, float x, float y) { super(parent, x, y, 37.0f, 69.0f); addAttribute(WidgetAttribute.MOUSE_OVER); - addSelfEventHandler(new EventMouse.Down.Handler() { - @Override - public void onEvent(EventMouse.Down event) { - if (event.getButton() == 0) { - NBTTagCompound action = new NBTTagCompound(); - Window.get(getWidget()).sendClientAction("fruitpress-click", action); - } else if (event.getButton() == 1) { - NBTTagCompound action = new NBTTagCompound(); - Window.get(getWidget()).sendClientAction("clear-fruit", action); - } - } - }); + addSelfEventHandler(new MouseDownHandler()); } @Override public void onRenderBackground() { - CraftGUI.Render.texture(ControlFruitPressProgress.PressSlot, new IPoint(3.0f, 52.0f)); - ItemStack input = Window.get(this).getContainer().getSlotFromInventory(Window.get(this).getInventory(), Press.slotCurrent).getStack(); + Window window = Window.get(this); + CraftGUI.Render.texture(ControlFruitPressProgress.pressSlot, new IPoint(3.0f, 52.0f)); + ItemStack input = window.getContainer().getSlotFromInventory(window.getInventory(), Press.slotCurrent).getStack(); if (input == null || Press.getOutput(input) == null) { return; } + Fluid fluid = Press.getOutput(input).getFluid(); int hex = fluid.getColor(Press.getOutput(input)); int r = (hex & 0xFF0000) >> 16; int g = (hex & 0xFF00) >> 8; int b = hex & 0xFF; - IIcon icon = fluid.getIcon(); GL11.glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f); GL11.glEnable(3042); GL11.glBlendFunc(770, 771); CraftGUI.Render.iconBlock(new IPoint(4.0f, 52.0f), fluid.getIcon()); GL11.glDisable(3042); - icon = input.getIconIndex(); - CraftGUI.Render.iconItem(new IPoint(4.0f, 52.0f), icon); + CraftGUI.Render.iconItem(new IPoint(4.0f, 52.0f), input.getIconIndex()); } @Override public void onRenderForeground() { - CraftGUI.Render.texture(ControlFruitPressProgress.PressTexture, new IPoint(0.0f, 16.0f * progress)); + CraftGUI.Render.texture(ControlFruitPressProgress.pressTexture, new IPoint(0.0f, 16.0f * progress)); + } + + private class MouseDownHandler extends EventMouse.Down.Handler { + @Override + public void onEvent(EventMouse.Down event) { + if (event.getButton() == 0) { + NBTTagCompound action = new NBTTagCompound(); + Window.get(getWidget()).sendClientAction("fruitpress-click", action); + } else if (event.getButton() == 1) { + NBTTagCompound action = new NBTTagCompound(); + Window.get(getWidget()).sendClientAction("clear-fruit", action); + } + } } } diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlLumbermillProgress.java b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlLumbermillProgress.java index 7a4a1810..af3f2e01 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlLumbermillProgress.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlLumbermillProgress.java @@ -78,7 +78,6 @@ public class ControlLumbermillProgress extends ControlProgressBase { } IIcon icon2 = block2.getIcon(2, result.getItemDamage()); - IPoint size = getSize(); IPoint pos = getAbsolutePosition(); CraftGUI.Render.limitArea(new IArea(pos.add(new IPoint(0.0f, 0.0f)), new IPoint(progress * 64.0f + 2.0f, 18.0f))); GL11.glEnable(3089); diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlRecipeSlot.java b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlRecipeSlot.java index 537ba99f..719deaaf 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlRecipeSlot.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlRecipeSlot.java @@ -14,18 +14,7 @@ import net.minecraft.tileentity.TileEntity; public class ControlRecipeSlot extends ControlSlotBase { public ControlRecipeSlot(IWidget parent, int x, int y) { super(parent, x, y, 50); - addSelfEventHandler(new EventMouse.Down.Handler() { - @Override - public void onEvent(EventMouse.Down event) { - TileEntity tile = (TileEntity) Window.get(getWidget()).getInventory(); - if (tile == null || !(tile instanceof TileEntityMachine)) { - return; - } - - NBTTagCompound nbt = new NBTTagCompound(); - Window.get(getWidget()).sendClientAction("recipe", nbt); - } - }); + addSelfEventHandler(new MouseDownHandler()); setRotating(); } @@ -34,4 +23,17 @@ public class ControlRecipeSlot extends ControlSlotBase { IComponentRecipe recipe = Machine.getInterface(IComponentRecipe.class, Window.get(this).getInventory()); return recipe.isRecipe() ? recipe.getProduct() : null; } + + private class MouseDownHandler extends EventMouse.Down.Handler { + @Override + public void onEvent(EventMouse.Down event) { + TileEntity tile = (TileEntity) Window.get(getWidget()).getInventory(); + if (tile == null || !(tile instanceof TileEntityMachine)) { + return; + } + + NBTTagCompound nbt = new NBTTagCompound(); + Window.get(getWidget()).sendClientAction("recipe", nbt); + } + } } diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlTileSelect.java b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlTileSelect.java index d2df303e..0f1c3bdb 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/ControlTileSelect.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/ControlTileSelect.java @@ -65,6 +65,7 @@ public class ControlTileSelect extends Control implements IControlValue @Override public void movePercentage(float percentage) { + // ignored } @Override @@ -83,7 +84,7 @@ public class ControlTileSelect extends Control implements IControlValue deleteAllChildren(); int cx; int cy = 2; - Map> designs = new HashMap>(); + Map> designs = new HashMap<>(); for (IDesignCategory category : CarpentryManager.carpentryInterface.getAllDesignCategories()) { designs.put(category, new ArrayList<>()); for (IDesign tile : category.getDesigns()) { @@ -126,20 +127,7 @@ public class ControlTileSelect extends Control implements IControlValue super(parent, x, y, 18.0f, 18.0f); setValue(value); addAttribute(WidgetAttribute.MOUSE_OVER); - addSelfEventHandler(new EventMouse.Down.Handler() { - @Override - public void onEvent(EventMouse.Down event) { - TileEntityMachine tile = (TileEntityMachine) Window.get(getWidget()).getInventory(); - if (tile == null) { - return; - } - - tile.getMachine().getComponent(Designer.ComponentWoodworkerRecipe.class); - NBTTagCompound nbt = new NBTTagCompound(); - nbt.setShort("d", (short) CarpentryManager.carpentryInterface.getDesignIndex(getValue())); - Window.get(getWidget()).sendClientAction("design", nbt); - } - }); + addSelfEventHandler(new MouseDownHandler()); } @Override @@ -176,5 +164,20 @@ public class ControlTileSelect extends Control implements IControlValue CraftGUI.Render.gradientRect(getArea().inset(1), -1433892728, -1433892728); } } + + private class MouseDownHandler extends EventMouse.Down.Handler { + @Override + public void onEvent(EventMouse.Down event) { + TileEntityMachine tile = (TileEntityMachine) Window.get(getWidget()).getInventory(); + if (tile == null) { + return; + } + + tile.getMachine().getComponent(Designer.ComponentWoodworkerRecipe.class); + NBTTagCompound nbt = new NBTTagCompound(); + nbt.setShort("d", (short) CarpentryManager.carpentryInterface.getDesignIndex(getValue())); + Window.get(getWidget()).sendClientAction("design", nbt); + } + } } } diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/PageSpeciesTreeGenome.java b/src/main/java/binnie/extratrees/craftgui/dictionary/PageSpeciesTreeGenome.java index 8a00ed6e..de332c54 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/PageSpeciesTreeGenome.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/PageSpeciesTreeGenome.java @@ -34,13 +34,6 @@ public class PageSpeciesTreeGenome extends PageSpecies { super(parent, tab); } - public static String tolerated(boolean t) { - if (t) { - return I18N.localise("binniecore.gui.tolerated"); - } - return I18N.localise("binniecore.gui.nottolerated"); - } - @Override public void onValueChanged(IAlleleSpecies species) { deleteAllChildren(); diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/WindowArboristDatabase.java b/src/main/java/binnie/extratrees/craftgui/dictionary/WindowArboristDatabase.java index c3a23424..4190003b 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/WindowArboristDatabase.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/WindowArboristDatabase.java @@ -25,10 +25,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; public class WindowArboristDatabase extends WindowAbstractDatabase { - protected ControlListBox selectionBoxFruit; - protected ControlListBox selectionBoxWood; - protected ControlListBox selectionBoxPlanks; - public WindowArboristDatabase(EntityPlayer player, Side side, boolean nei) { super(player, side, nei, Binnie.Genetics.treeBreedingSystem, 120.0f); } diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/WindowSetSquare.java b/src/main/java/binnie/extratrees/craftgui/dictionary/WindowSetSquare.java index b647acd4..2ae3b9e7 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/WindowSetSquare.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/WindowSetSquare.java @@ -29,5 +29,6 @@ public class WindowSetSquare extends Window { @Override public void initialiseClient() { + // ignored } } diff --git a/src/main/java/binnie/extratrees/craftgui/dictionary/WindowWoodworker.java b/src/main/java/binnie/extratrees/craftgui/dictionary/WindowWoodworker.java index 48f6baf2..c2e55233 100644 --- a/src/main/java/binnie/extratrees/craftgui/dictionary/WindowWoodworker.java +++ b/src/main/java/binnie/extratrees/craftgui/dictionary/WindowWoodworker.java @@ -60,7 +60,7 @@ public class WindowWoodworker extends Window { slotWood2.assign(Designer.design2Slot); ControlSlot slotBeeswax = new ControlSlot(this, 42.0f, 64.0f); slotBeeswax.assign(Designer.beeswaxSlot); - ControlRecipeSlot slotFinished = new ControlRecipeSlot(this, 112, 34); + new ControlRecipeSlot(this, 112, 34); } } diff --git a/src/main/java/binnie/extratrees/genetics/ButterflySpecies.java b/src/main/java/binnie/extratrees/genetics/ButterflySpecies.java index 4834d9d8..87bf78d5 100644 --- a/src/main/java/binnie/extratrees/genetics/ButterflySpecies.java +++ b/src/main/java/binnie/extratrees/genetics/ButterflySpecies.java @@ -166,7 +166,7 @@ public enum ButterflySpecies implements IAlleleButterflySpecies { @Override public int getIconColour(int renderPass) { - return (renderPass > 0) ? 16777215 : color; + return (renderPass > 0) ? 0xffffff : color; } @Override diff --git a/src/main/java/binnie/extratrees/genetics/ExtraTreeFruitGene.java b/src/main/java/binnie/extratrees/genetics/ExtraTreeFruitGene.java index cf63d14c..b6643648 100644 --- a/src/main/java/binnie/extratrees/genetics/ExtraTreeFruitGene.java +++ b/src/main/java/binnie/extratrees/genetics/ExtraTreeFruitGene.java @@ -18,13 +18,9 @@ import forestry.api.genetics.IAlleleSpecies; import forestry.api.genetics.IFruitFamily; import forestry.arboriculture.FruitProviderNone; import forestry.arboriculture.genetics.alleles.AlleleTreeSpecies; -import net.minecraft.block.Block; -import net.minecraft.block.BlockLog; import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.Direction; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -103,18 +99,18 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider { protected int diffB; protected FruitPod pod; protected int ripeningPeriod; - protected int colourUnripe; - protected int colour; + protected int colorUnripe; + protected int color; protected FruitSprite index; protected HashMap products; - ExtraTreeFruitGene(int time, int unripe, int colour, FruitSprite index) { + ExtraTreeFruitGene(int time, int unripe, int color, FruitSprite index) { isRipening = false; diffB = 0; pod = null; ripeningPeriod = 0; products = new HashMap<>(); - this.colour = colour; + this.color = color; this.index = index; setRipening(time, unripe); } @@ -124,7 +120,7 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider { diffB = 0; this.pod = null; ripeningPeriod = 0; - products = new HashMap(); + products = new HashMap<>(); this.pod = pod; ripeningPeriod = 2; } @@ -279,32 +275,13 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider { } } - public static int getDirectionalMetadata(World world, int x, int y, int z) { - for (int i = 0; i < 4; ++i) { - if (isValidPot(world, x, y, z, i)) { - return i; - } - } - return -1; - } - - public static boolean isValidPot(World world, int x, int y, int z, int notchDirection) { - x += Direction.offsetX[notchDirection]; - z += Direction.offsetZ[notchDirection]; - Block block = world.getBlock(x, y, z); - if (block == Blocks.log || block == Blocks.log2) { - return BlockLog.func_150165_c(world.getBlockMetadata(x, y, z)) == 3; - } - return block != null && block.isWood(world, x, y, z); - } - public void setRipening(int time, int unripe) { ripeningPeriod = time; - colourUnripe = unripe; + colorUnripe = unripe; isRipening = true; - diffR = (colour >> 16 & 0xFF) - (unripe >> 16 & 0xFF); - diffG = (colour >> 8 & 0xFF) - (unripe >> 8 & 0xFF); - diffB = (colour & 0xFF) - (unripe & 0xFF); + diffR = (color >> 16 & 0xFF) - (unripe >> 16 & 0xFF); + diffG = (color >> 8 & 0xFF) - (unripe >> 8 & 0xFF); + diffB = (color & 0xFF) - (unripe & 0xFF); } public void addProduct(ItemStack product, float chance) { @@ -353,13 +330,13 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider { @Override public int getColour(ITreeGenome genome, IBlockAccess world, int x, int y, int z, int ripeningTime) { if (!isRipening) { - return colour; + return color; } float stage = getRipeningStage(ripeningTime); - int r = (colourUnripe >> 16 & 0xFF) + (int) (diffR * stage); - int g = (colourUnripe >> 8 & 0xFF) + (int) (diffG * stage); - int b = (colourUnripe & 0xFF) + (int) (diffB * stage); + int r = (colorUnripe >> 16 & 0xFF) + (int) (diffR * stage); + int g = (colorUnripe >> 8 & 0xFF) + (int) (diffG * stage); + int b = (colorUnripe & 0xFF) + (int) (diffB * stage); return (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF); } @@ -377,7 +354,7 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider { public ItemStack[] getFruits(ITreeGenome genome, World world, int x, int y, int z, int ripeningTime) { if (pod != null) { if (ripeningTime >= 2) { - List product = new ArrayList(); + List product = new ArrayList<>(); for (Map.Entry entry : products.entrySet()) { ItemStack single = entry.getKey().copy(); single.stackSize = 1; @@ -392,7 +369,7 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider { return new ItemStack[0]; } - ArrayList product2 = new ArrayList(); + ArrayList product2 = new ArrayList<>(); float stage = getRipeningStage(ripeningTime); if (stage < 0.5f) { return new ItemStack[0]; @@ -426,10 +403,6 @@ public enum ExtraTreeFruitGene implements IAlleleFruit, IFruitProvider { && Binnie.Genetics.getTreeRoot().setFruitBlock(world, (IAlleleFruit) genome.getActiveAllele(EnumTreeChromosome.FRUITS), genome.getSappiness(), pod.getTextures(), x, y, z); } - public boolean setFruitBlock(World world, IAlleleFruit allele, float sappiness, int x, int y, int z) { - return true; - } - @Override public short getIconIndex(ITreeGenome genome, IBlockAccess world, int x, int y, int z, int ripeningTime, boolean fancy) { return index.getIndex(); diff --git a/src/main/java/binnie/extratrees/genetics/ExtraTreeMutation.java b/src/main/java/binnie/extratrees/genetics/ExtraTreeMutation.java index f91dc569..57082e55 100644 --- a/src/main/java/binnie/extratrees/genetics/ExtraTreeMutation.java +++ b/src/main/java/binnie/extratrees/genetics/ExtraTreeMutation.java @@ -154,31 +154,6 @@ public class ExtraTreeMutation implements ITreeMutation { return allele; } - public ExtraTreeMutation setIsSecret() { - isSecret = true; - return this; - } - - public ExtraTreeMutation setTemperature(float minTemperature, float maxTemperature) { - this.minTemperature = minTemperature; - this.maxTemperature = maxTemperature; - return this; - } - - public ExtraTreeMutation setRainfall(float minRainfall, float maxRainfall) { - this.minRainfall = minRainfall; - this.maxRainfall = maxRainfall; - return this; - } - - public ExtraTreeMutation setTemperatureRainfall(float minTemperature, float maxTemperature, float minRainfall, float maxRainfall) { - this.minTemperature = minTemperature; - this.maxTemperature = maxTemperature; - this.minRainfall = minRainfall; - this.maxRainfall = maxRainfall; - return this; - } - public ExtraTreeMutation setHeight(int minHeight) { height = minHeight; return this; @@ -246,7 +221,7 @@ public class ExtraTreeMutation implements ITreeMutation { @Override public Collection getSpecialConditions() { - List conditions = new ArrayList(); + List conditions = new ArrayList<>(); if (height > 0.0f) { conditions.add("Minimum height from bedrock of " + height); } diff --git a/src/main/java/binnie/genetics/genetics/AlleleHelper.java b/src/main/java/binnie/genetics/genetics/AlleleHelper.java index eb50c4ec..802fb9b0 100644 --- a/src/main/java/binnie/genetics/genetics/AlleleHelper.java +++ b/src/main/java/binnie/genetics/genetics/AlleleHelper.java @@ -111,6 +111,18 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper { return toAlleleDisplay("tolerance", tolerance.name()); } + public static String toDisplay(EnumAllele.Flowering flowering) { + return toAlleleDisplay("flowering", flowering.name()); + } + + public static String toDisplay(EnumAllele.Speed speed) { + return toAlleleDisplay("speed", speed.name()); + } + + public static String toDisplay(EnumAllele.Lifespan lifespan) { + return toAlleleDisplay("lifespan", lifespan.name()); + } + public static String getUid(EnumAllele.Fertility fertility) { return getUid("fertility", fertility.name()); } diff --git a/src/main/resources/assets/extrabees/lang/en_GB.lang b/src/main/resources/assets/extrabees/lang/en_GB.lang index 8c779f04..348338c6 100644 --- a/src/main/resources/assets/extrabees/lang/en_GB.lang +++ b/src/main/resources/assets/extrabees/lang/en_GB.lang @@ -8,3 +8,5 @@ extrabees.branch.rocky.desc=Found amongst the rocks, these bees have very high t extrabees.species.rotten.desc=These bees have an unusual attraction to dead, rotting meat and will store it in their combs. The smell also attracts other unsavoury types.|Apiarist Manual extrabees.species.red.desc=Don't let them sting you, or you may be seeing red.|Apiarist Manual extrabees.species.green.desc=Perhaps it is an attempt at camouflage, but these bees have begun producing dyes that match the colour of leaves and grass.|Apiarist Manual + +extrabees.gui.database.tab.species.genome.behavior=Behaviour: diff --git a/src/main/resources/assets/extrabees/lang/en_US.lang b/src/main/resources/assets/extrabees/lang/en_US.lang index d46d0327..275c2bc4 100644 --- a/src/main/resources/assets/extrabees/lang/en_US.lang +++ b/src/main/resources/assets/extrabees/lang/en_US.lang @@ -198,6 +198,7 @@ extrabees.machine.alveay.lighting.info=The Alveary Lighting tricks bees into thi extrabees.machine.alveay.mutator=Mutator extrabees.machine.alveay.mutator.info=The Mutator uses certain items in order to encourage bee mutation. extrabees.machine.alveay.mutator.tooltip=Mutagenic Agents +extrabees.machine.alveay.mutator.mutagens=Possible Mutagens: extrabees.machine.alveay.rainShield=Rain Shield extrabees.machine.alveay.rainShield.info=The Rain Shield prevents bees from being affected by rainfall. @@ -238,52 +239,6 @@ extrabees.genetics.quality.good=Good extrabees.genetics.quality.excellent=Excellent extrabees.genetics.quality.tooltip=%s Quality -extrabees.genetics.allele.shortest=Shortest -extrabees.genetics.allele.shorter=Shorter -extrabees.genetics.allele.short=Short -extrabees.genetics.allele.shortened=Shortened -extrabees.genetics.allele.normal=Normal -extrabees.genetics.allele.elongated=Elongated -extrabees.genetics.allele.long=Long -extrabees.genetics.allele.longer=Longer -extrabees.genetics.allele.longest=Longest - -extrabees.genetics.allele.slowest=Slowest -extrabees.genetics.allele.slower=Slower -extrabees.genetics.allele.slow=Slow -extrabees.genetics.allele.norm=Normal -extrabees.genetics.allele.fast=Fast -extrabees.genetics.allele.faster=Faster -extrabees.genetics.allele.fastest=Fastest - -extrabees.genetics.allele.low=Low -extrabees.genetics.allele.high=High -extrabees.genetics.allele.maximum=Maximum - -extrabees.genetics.allele.average=Average - -extrabees.genetics.allele.default=Default -extrabees.genetics.allele.large=Large -extrabees.genetics.allele.larger=Larger -extrabees.genetics.allele.largest=Largest - -extrabees.genetics.allele.none=None -extrabees.genetics.allele.both1=Both 1 -extrabees.genetics.allele.both2=Both 2 -extrabees.genetics.allele.both3=Both 3 -extrabees.genetics.allele.both4=Both 4 -extrabees.genetics.allele.both5=Both 5 -extrabees.genetics.allele.up1=Up 1 -extrabees.genetics.allele.up2=Up 2 -extrabees.genetics.allele.up3=Up 3 -extrabees.genetics.allele.up4=Up 4 -extrabees.genetics.allele.up5=Up 5 -extrabees.genetics.allele.down1=Down 1 -extrabees.genetics.allele.down2=Down 2 -extrabees.genetics.allele.down3=Down 3 -extrabees.genetics.allele.down4=Down 4 -extrabees.genetics.allele.down5=Down 5 - extrabees.genetics.allele.noeffect=Effect Cancellation extrabees.genetics.allele.noflower=Non-pollination extrabees.genetics.allele.lifespan=%s Lifespan @@ -526,16 +481,40 @@ extrabees.effect.bonemealfruit.name=Ripening extrabees.effect.bonemealmushroom.name=Mushroom extrabees.effect.power.name=Power +extrabees.gui.database=Database extrabees.gui.database.tab.species.overview=Overview extrabees.gui.database.tab.species.classification=Classification + extrabees.gui.database.tab.species.genome=Genome +extrabees.gui.database.tab.species.genome.speed=Speed: +extrabees.gui.database.tab.species.genome.lifespan=Lifespan: +extrabees.gui.database.tab.species.genome.fertility=Fertility: +extrabees.gui.database.tab.species.genome.flowering=Flowering: +extrabees.gui.database.tab.species.genome.territory=Territory: +extrabees.gui.database.tab.species.genome.behavior=Behavior: +extrabees.gui.database.tab.species.genome.sunlight=Sunlight: +extrabees.gui.database.tab.species.genome.rain=Rain: +extrabees.gui.database.tab.species.genome.flower=Flower: +extrabees.gui.database.tab.species.genome.effect=Effect: +extrabees.gui.database.tab.species.genome.tolerated=Tolerated +extrabees.gui.database.tab.species.genome.daytime=Daytime +extrabees.gui.database.tab.species.genome.nighttime=Nighttime +extrabees.gui.database.tab.species.genome.allDay=All Day +extrabees.gui.database.tab.species.genome.children=%d children +extrabees.gui.database.tab.species.genome.notNeeded=Not Needed +extrabees.gui.database.tab.species.genome.required=Required + extrabees.gui.database.tab.species.products=Products extrabees.gui.database.tab.species.products.everyHours=Every %s hours extrabees.gui.database.tab.species.products.everyMins=Every %s min. extrabees.gui.database.tab.species.products.everySecs=Every %s sec. + extrabees.gui.database.tab.species.climate=Climate +extrabees.gui.database.tab.species.biomes=Biomes +extrabees.gui.database.tab.species.specialties=Specialties extrabees.gui.database.tab.species.resultant=Resultant Mutations extrabees.gui.database.tab.species.further=Further Mutations + extrabees.gui.database.tab.branches.overview=Overview extrabees.gui.database.tab.branches.species=Species extrabees.gui.database.tab.breeder=Breeder diff --git a/src/main/resources/assets/extrabees/lang/ru_RU.lang b/src/main/resources/assets/extrabees/lang/ru_RU.lang index 5bc0e942..40015954 100644 --- a/src/main/resources/assets/extrabees/lang/ru_RU.lang +++ b/src/main/resources/assets/extrabees/lang/ru_RU.lang @@ -198,6 +198,7 @@ extrabees.machine.alveay.lighting.info=Осветитель улья освещ extrabees.machine.alveay.mutator=Мутатор улья extrabees.machine.alveay.mutator.info=Мутатор использует определенные предметы для увеличения шанса мутации пчелы. Коэффициент ускорения для катализаторов: Песок душ - 1,5; Жемчуг Эндера - 2; Око Эндера - 4; Урановая руда - 10; Звезда нижнего мира - 50. Несколько мутаторов складывают коэффициенты. При кратности более 10 возможна деградация пчелы. extrabees.machine.alveay.mutator.tooltip=Мутагены +extrabees.machine.alveay.mutator.mutagens=Возможные мутагены: extrabees.machine.alveay.rainShield=Навес улья extrabees.machine.alveay.rainShield.info=Навес защищает пчёл от дождя. @@ -236,55 +237,8 @@ extrabees.genetics.quality.poor=плохо extrabees.genetics.quality.average=средне extrabees.genetics.quality.good=хорошо extrabees.genetics.quality.excellent=отлично - extrabees.genetics.quality.tooltip=%s Качество -extrabees.genetics.allele.shortest=наикратчайше -extrabees.genetics.allele.shorter=сверх коротко -extrabees.genetics.allele.short=очень коротко -extrabees.genetics.allele.shortened=коротко -extrabees.genetics.allele.normal=нормально -extrabees.genetics.allele.elongated=чуть дольше -extrabees.genetics.allele.long=дольше -extrabees.genetics.allele.longer=очень дольше -extrabees.genetics.allele.longest=дольше всего - -extrabees.genetics.allele.slowest=наимедлительнейше -extrabees.genetics.allele.slower=очень медленно -extrabees.genetics.allele.slow=медленно -extrabees.genetics.allele.norm=нормально -extrabees.genetics.allele.fast=быстро -extrabees.genetics.allele.faster=очень быстро -extrabees.genetics.allele.fastest=наибыстрейше - -extrabees.genetics.allele.low=низко -extrabees.genetics.allele.high=высоко -extrabees.genetics.allele.maximum=максимум - -extrabees.genetics.allele.average=нормальное - -extrabees.genetics.allele.default=по-умолчанию -extrabees.genetics.allele.large=большой -extrabees.genetics.allele.larger=очень большой -extrabees.genetics.allele.largest=огромный - -extrabees.genetics.allele.none=отсутствует -extrabees.genetics.allele.both1=обе 1 -extrabees.genetics.allele.both2=обе 2 -extrabees.genetics.allele.both3=обе 3 -extrabees.genetics.allele.both4=обе 4 -extrabees.genetics.allele.both5=обе 5 -extrabees.genetics.allele.up1=вверх 1 -extrabees.genetics.allele.up2=вверх 2 -extrabees.genetics.allele.up3=вверх 3 -extrabees.genetics.allele.up4=вверх 4 -extrabees.genetics.allele.up5=вверх 5 -extrabees.genetics.allele.down1=вниз 1 -extrabees.genetics.allele.down2=вниз 2 -extrabees.genetics.allele.down3=вниз 3 -extrabees.genetics.allele.down4=вниз 4 -extrabees.genetics.allele.down5=вниз 5 - extrabees.genetics.allele.noeffect=отмена эффекта extrabees.genetics.allele.noflower=неопыляющие extrabees.genetics.allele.lifespan=%s срока жизни @@ -702,16 +656,40 @@ extrabees.effect.bonemealfruit.name=Созревание extrabees.effect.bonemealmushroom.name=Большие грибы extrabees.effect.power.name=Сила +extrabees.gui.database=База данных extrabees.gui.database.tab.species.overview=Обзор extrabees.gui.database.tab.species.classification=Классификация + extrabees.gui.database.tab.species.genome=Генотип +extrabees.gui.database.tab.species.genome.speed=Скорость: +extrabees.gui.database.tab.species.genome.lifespan=Жизнь: +extrabees.gui.database.tab.species.genome.fertility=Потомство: +extrabees.gui.database.tab.species.genome.flowering=Опыление: +extrabees.gui.database.tab.species.genome.territory=Территория: +extrabees.gui.database.tab.species.genome.behavior=Поведение: +extrabees.gui.database.tab.species.genome.sunlight=Дневной свет: +extrabees.gui.database.tab.species.genome.rain=Дождь: +extrabees.gui.database.tab.species.genome.flower=Цветы: +extrabees.gui.database.tab.species.genome.effect=Эффект: +extrabees.gui.database.tab.species.genome.tolerated=Терпимо +extrabees.gui.database.tab.species.genome.daytime=Дневное +extrabees.gui.database.tab.species.genome.nighttime=Ночное +extrabees.gui.database.tab.species.genome.allDay=Все время +extrabees.gui.database.tab.species.genome.children=%d +extrabees.gui.database.tab.species.genome.notNeeded=Не требуется +extrabees.gui.database.tab.species.genome.required=Обязательно + extrabees.gui.database.tab.species.products=Продукция extrabees.gui.database.tab.species.products.everyHours=Каждые %s ч. extrabees.gui.database.tab.species.products.everyMins=Каждые %s м. extrabees.gui.database.tab.species.products.everySecs=Каждые %s с. + extrabees.gui.database.tab.species.climate=Климат +extrabees.gui.database.tab.species.biomes=Биомы +extrabees.gui.database.tab.species.specialties=Специальность extrabees.gui.database.tab.species.resultant=Произведённые мутации extrabees.gui.database.tab.species.further=Дальнейшие возможные мутации + extrabees.gui.database.tab.branches.overview=Обзор extrabees.gui.database.tab.branches.species=Виды -extrabees.gui.database.tab.breeder=Селекция \ No newline at end of file +extrabees.gui.database.tab.breeder=Селекция diff --git a/src/main/resources/assets/extrabees/lang/zh_CN.lang b/src/main/resources/assets/extrabees/lang/zh_CN.lang index 3b3e179a..4e325dcb 100644 --- a/src/main/resources/assets/extrabees/lang/zh_CN.lang +++ b/src/main/resources/assets/extrabees/lang/zh_CN.lang @@ -220,55 +220,8 @@ extrabees.genetics.quality.poor=差 extrabees.genetics.quality.average=中 extrabees.genetics.quality.good=好 extrabees.genetics.quality.excellent=极好 - extrabees.genetics.quality.tooltip=品质 %s -extrabees.genetics.allele.shortest=最短 -extrabees.genetics.allele.shorter=较短 -extrabees.genetics.allele.short=短 -extrabees.genetics.allele.shortened=略短 -extrabees.genetics.allele.normal=中等 -extrabees.genetics.allele.elongated=略长 -extrabees.genetics.allele.long=长 -extrabees.genetics.allele.longer=更长 -extrabees.genetics.allele.longest=最长 - -extrabees.genetics.allele.slowest=最慢 -extrabees.genetics.allele.slower=更慢 -extrabees.genetics.allele.slow=慢 -extrabees.genetics.allele.norm=中等 -extrabees.genetics.allele.fast=快 -extrabees.genetics.allele.faster=更快 -extrabees.genetics.allele.fastest=最快 - -extrabees.genetics.allele.low=低 -extrabees.genetics.allele.high=高 -extrabees.genetics.allele.maximum=最大 - -extrabees.genetics.allele.average=平均 - -extrabees.genetics.allele.default=普通 -extrabees.genetics.allele.large=大 -extrabees.genetics.allele.larger=更大 -extrabees.genetics.allele.largest=最大 - -extrabees.genetics.allele.none=无 -extrabees.genetics.allele.both1=全1 -extrabees.genetics.allele.both2=全2 -extrabees.genetics.allele.both3=全3 -extrabees.genetics.allele.both4=全4 -extrabees.genetics.allele.both5=全5 -extrabees.genetics.allele.up1=加1 -extrabees.genetics.allele.up2=加2 -extrabees.genetics.allele.up3=加3 -extrabees.genetics.allele.up4=加4 -extrabees.genetics.allele.up5=加5 -extrabees.genetics.allele.down1=降1 -extrabees.genetics.allele.down2=降2 -extrabees.genetics.allele.down3=降3 -extrabees.genetics.allele.down4=降4 -extrabees.genetics.allele.down5=降5 - extrabees.genetics.allele.noeffect=无特效 extrabees.genetics.allele.noflower=无特定花粉 extrabees.genetics.allele.lifespan=%s 寿命周期