[1.7.10] Added some localization (#106)

* Some refactoring

* Some refactoring
Added some localization

* Added some localization
Fix wrong branch localization in page branch overview
Simplify some localization

* Simplify some localization

* Removed unused localize method

* Simplify some localization

* Removed proxy.localise method

* Simplify localization

* Added some localization

* Added some localization

* Added some localization

* Some refactoring
This commit is contained in:
Alexander Kornilov authored and mezz committed 2017-06-07 19:47:12 -07:00
1 parent 1ffaad9fcd
commit bd0dbc3e14
54 files changed
+394 -520

No files matched your search

@@ -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"));
}
}
@@ -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);
@@ -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);
@@ -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;
@@ -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);
@@ -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();
}
@@ -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);
}
@@ -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());
}
@@ -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");
}
}
@@ -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<ControlProductsBox.Product> {
public class ControlProductsBox extends ControlListBox<Product> {
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<ControlProductsBox.Produc
.getProductionModifier(genome, 1.0f);
List<Product> strings = new ArrayList<>();
if (type == Type.Products) {
for (Map.Entry<ItemStack, Float> entry : species.getProductChances().entrySet()) {
strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue()));
}
Set<Map.Entry<ItemStack, Float>> chances;
if (type == ProductType.PRODUCTS) {
chances = species.getProductChances().entrySet();
} else {
for (Map.Entry<ItemStack, Float> entry : species.getSpecialtyChances().entrySet()) {
strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue()));
}
chances = species.getSpecialtyChances().entrySet();
}
for (Map.Entry<ItemStack, Float> 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;
}
}
}
@@ -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<ControlProductsBox.Product> {
public class ControlProductsItem extends ControlOption<Product> {
protected ControlItemDisplay item;
public ControlProductsItem(ControlList<ControlProductsBox.Product> controlList, ControlProductsBox.Product value, int y) {
public ControlProductsItem(ControlList<Product> 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, "");
@@ -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
@@ -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;
}
}
@@ -0,0 +1,6 @@
package binnie.extrabees.gui.database.product;
public enum ProductType {
PRODUCTS,
SPECIALTIES
}
@@ -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
@@ -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
@@ -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();
}
@@ -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);
}
@@ -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) {
@@ -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;
}
@@ -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) {
@@ -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();
}
@@ -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);
@@ -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<IPlankType> getAllPlankTypes() {
List<IPlankType> list = new ArrayList<IPlankType>();
List<IPlankType> list = new ArrayList<>();
Collections.addAll(list, PlankType.ExtraTreePlanks.values());
Collections.addAll(list, PlankType.ForestryPlanks.values());
for (IPlankType type : PlankType.ExtraBiomesPlank.values()) {
@@ -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);
}
}
@@ -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);
}
@@ -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());
}
}
@@ -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;
}
@@ -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;
}
@@ -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);
@@ -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());
}
@@ -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
@@ -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
@@ -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<IDesignSystem> systems;
@@ -26,8 +22,4 @@ public class DesignerManager {
public Collection<IDesignSystem> getDesignSystems() {
return systems;
}
public void addDesignSystem(DesignSystem system) {
systems.add(system);
}
}
@@ -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<Integer, GlassType> types;
protected static Map<Integer, GlassType> 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();
}
}
}
@@ -96,10 +96,4 @@ public class ModuleCarpentry implements IInitializable {
CarpentryManager.carpentryInterface.registerDesign(design.ordinal(), design);
}
}
enum Axis {
Y,
X,
Z
}
}
@@ -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);
@@ -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);
}
}
}
}
@@ -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);
}
}
}
}
@@ -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);
@@ -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);
}
}
}
@@ -65,6 +65,7 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
@Override
public void movePercentage(float percentage) {
// ignored
}
@Override
@@ -83,7 +84,7 @@ public class ControlTileSelect extends Control implements IControlValue<IDesign>
deleteAllChildren();
int cx;
int cy = 2;
Map<IDesignCategory, List<IDesign>> designs = new HashMap<IDesignCategory, List<IDesign>>();
Map<IDesignCategory, List<IDesign>> 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<IDesign>
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<IDesign>
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);
}
}
}
}
@@ -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();
@@ -25,10 +25,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class WindowArboristDatabase extends WindowAbstractDatabase {
protected ControlListBox<ItemStack> selectionBoxFruit;
protected ControlListBox<ItemStack> selectionBoxWood;
protected ControlListBox<ItemStack> selectionBoxPlanks;
public WindowArboristDatabase(EntityPlayer player, Side side, boolean nei) {
super(player, side, nei, Binnie.Genetics.treeBreedingSystem, 120.0f);
}
@@ -29,5 +29,6 @@ public class WindowSetSquare extends Window {
@Override
public void initialiseClient() {
// ignored
}
}
@@ -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);
}
}
@@ -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
@@ -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<ItemStack, Float> 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<ItemStack, Float>();
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<ItemStack> product = new ArrayList<ItemStack>();
List<ItemStack> product = new ArrayList<>();
for (Map.Entry<ItemStack, Float> 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<ItemStack> product2 = new ArrayList<ItemStack>();
ArrayList<ItemStack> 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();
@@ -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<String> getSpecialConditions() {
List<String> conditions = new ArrayList<String>();
List<String> conditions = new ArrayList<>();
if (height > 0.0f) {
conditions.add("Minimum height from bedrock of " + height);
}
@@ -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());
}