Localization and refactoring (#77)

* Some refactoring for bee production

* Code cleanup

* Code cleanup

* Added some localization

* Fix wrong dropped class

* Added some localization

* Added some localization

* Added some localization

* Fix wrong import
This commit is contained in:
Alexander Kornilov authored and mezz committed 2017-05-23 23:58:13 -07:00
1 parent 68bbe7710c
commit 1ea7b62e5f
157 files changed
+3240 -5045

No files matched your search

@@ -71,11 +71,6 @@ public enum EnumHiveFrame implements IHiveFrame, IBeeModifier {
);
}
// TODO unused method?
public int getIconIndex() {
return 55 + ordinal();
}
public void setMaxDamage(int damage) {
maxDamage = damage;
}
@@ -1,37 +0,0 @@
package binnie.extrabees.genetics.items;
import binnie.extrabees.ExtraBees;
import binnie.extrabees.core.ExtraBeeGUID;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
// TODO unused class?
public class ItemPunnettSquare extends Item {
public ItemPunnettSquare() {
setCreativeTab(CreativeTabs.tabTools);
setMaxStackSize(1);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister register) {
itemIcon = ExtraBees.proxy.getIcon(register, "");
}
@Override
public String getItemStackDisplayName(ItemStack itemstack) {
return "Punnett Square";
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
ExtraBees.proxy.openGui(ExtraBeeGUID.PunnettSquare, player, (int) player.posX, (int) player.posY, (int) player.posZ);
return stack;
}
}
@@ -1,4 +1,4 @@
package binnie.extrabees.gui.punnett;
package binnie.extrabees.gui;
public enum ExtraBeeGUITexture {
Chromosome,
@@ -1,48 +0,0 @@
package binnie.extrabees.gui;
import binnie.core.AbstractMod;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlPlayerInventory;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.machines.Machine;
import binnie.core.machines.TileEntityMachine;
import binnie.extrabees.ExtraBees;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
// TODO unused class?
public class WindowAlvearyIndustrialFrame extends Window {
protected Machine machine;
protected ControlPlayerInventory playerInventory;
public WindowAlvearyIndustrialFrame(EntityPlayer player, IInventory inventory, Side side) {
super(176.0f, 144.0f, player, inventory, side);
machine = ((TileEntityMachine) inventory).getMachine();
}
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
if (player == null || inventory == null) {
return null;
}
return new WindowAlvearyIndustrialFrame(player, inventory, side);
}
@Override
public void initialiseClient() {
setTitle("Industrial Frame Housing");
playerInventory = new ControlPlayerInventory(this);
ControlSlot slot = new ControlSlot(this, 79.0f, 30.0f);
slot.assign(0);
}
@Override
public AbstractMod getMod() {
return ExtraBees.instance;
}
@Override
public String getName() {
return "AlvearyIndustrialFrame";
}
}
@@ -48,31 +48,4 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase {
public String getName() {
return "Database";
}
// TODO unused class?
enum SpeciesTab {
Overview(0xff),
Genome(0xffff00),
Productivity(0xffff),
Climate(0xff0000),
ResultantMutations(0xff00ff),
FurtherMutations(0xff00);
public int colour;
SpeciesTab(int colour) {
this.colour = colour;
}
}
enum BranchesTab {
Overview(255),
Species(16711680);
public int colour;
BranchesTab(int colour) {
this.colour = colour;
}
}
}
@@ -1,45 +0,0 @@
package binnie.extrabees.gui.punnett;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.ITooltip;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.Tooltip;
import binnie.core.craftgui.WidgetAttribute;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.controls.core.IControlValue;
import forestry.api.genetics.IChromosomeType;
// TODO unused class?
public class ControlChromosome extends Control implements IControlValue<IChromosomeType>, ITooltip {
protected IChromosomeType value;
protected ControlChromosome(IWidget parent, float x, float y, IChromosomeType type) {
super(parent, x, y, 16.0f, 16.0f);
setValue(type);
addAttribute(WidgetAttribute.MouseOver);
}
@Override
public IChromosomeType getValue() {
return value;
}
@Override
public void setValue(IChromosomeType value) {
this.value = value;
}
@Override
public void onRenderBackground() {
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome, getArea());
CraftGUI.Render.colour(0xff0000);
CraftGUI.Render.texture(ExtraBeeGUITexture.Chromosome2, getArea());
}
@Override
public void getTooltip(Tooltip tooltip) {
if (value != null) {
tooltip.add(value.getName());
}
}
}
@@ -1,76 +0,0 @@
package binnie.extrabees.gui.punnett;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.IWidget;
import binnie.core.craftgui.controls.ControlText;
import binnie.core.craftgui.controls.core.Control;
import binnie.core.craftgui.geometry.IArea;
import binnie.core.craftgui.geometry.TextJustification;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IChromosomeType;
import forestry.api.genetics.IIndividual;
import forestry.api.genetics.ISpeciesRoot;
import java.util.LinkedList;
import java.util.List;
public class ControlPunnett extends Control {
protected static int boxWidth = 80;
protected static int boxHeight = 28;
protected ControlPunnett(IWidget parent, float x, float y) {
super(parent, x, y, ControlPunnett.boxWidth * 3, ControlPunnett.boxWidth * 3);
}
@Override
public void onRenderBackground() {
CraftGUI.Render.solid(new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth * 3, 1.0f), 11184810);
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth / 2.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth * 2.5f, 1.0f), 11184810);
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth, 0.0f, 1.0f, ControlPunnett.boxHeight * 3), 11184810);
CraftGUI.Render.solid(new IArea(ControlPunnett.boxWidth * 2, ControlPunnett.boxHeight / 2.0f, 1.0f, ControlPunnett.boxHeight * 2.5f), 11184810);
}
// TODO unused method?
public void setup(IChromosomeType chromosome, IIndividual ind1, IIndividual ind2, ISpeciesRoot root) {
deleteAllChildren();
if (chromosome == null || ind1 == null || ind2 == null || root == null) {
return;
}
IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome);
IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome);
IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome);
IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome);
int x = 1;
int y;
for (IAllele allele1 : new IAllele[]{primary1, secondary1}) {
y = 1;
for (IAllele allele2 : new IAllele[]{primary2, secondary2}) {
List<IAllele> alleles = new LinkedList<IAllele>();
if (allele1.isDominant() && !allele2.isDominant()) {
alleles.add(allele1);
} else if (allele2.isDominant() && !allele1.isDominant()) {
alleles.add(allele2);
} else {
alleles.add(allele1);
if (allele1 != allele2) {
alleles.add(allele2);
}
}
String text = "";
for (IAllele allele3 : alleles) {
text = text + allele3.getName() + ": " + 25.0f / alleles.size() + "%\n";
}
new ControlText(this, new IArea(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text, TextJustification.TopCenter).setColor(11184810);
y++;
}
x++;
}
new ControlText(this, new IArea(ControlPunnett.boxWidth, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TopCenter).setColor(11184810);
new ControlText(this, new IArea(ControlPunnett.boxWidth * 2, 0.0f, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TopCenter).setColor(11184810);
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColor(11184810);
new ControlText(this, new IArea(0.0f, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TopCenter).setColor(11184810);
}
}
@@ -1,58 +0,0 @@
package binnie.extrabees.gui.punnett;
import binnie.core.AbstractMod;
import binnie.core.craftgui.CraftGUI;
import binnie.core.craftgui.minecraft.Window;
import binnie.core.craftgui.minecraft.control.ControlSlot;
import binnie.core.craftgui.resource.StyleSheet;
import binnie.core.craftgui.resource.minecraft.CraftGUITexture;
import binnie.core.craftgui.resource.minecraft.PaddedTexture;
import binnie.core.craftgui.resource.minecraft.StandardTexture;
import binnie.extrabees.ExtraBees;
import binnie.extrabees.core.ExtraBeeTexture;
import cpw.mods.fml.relauncher.Side;
import forestry.api.genetics.ISpeciesRoot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
// TODO unused class?
public class WindowPunnettSquare extends Window {
ControlSlot bee1;
ControlSlot bee2;
ControlPunnett punnett;
ISpeciesRoot root;
public WindowPunnettSquare(EntityPlayer player, IInventory inventory, Side side) {
super(245.0f, 205.0f, player, inventory, side);
root = null;
}
public static Window create(EntityPlayer player, IInventory inventory, Side side) {
return new WindowPunnettSquare(player, inventory, side);
}
@Override
public AbstractMod getMod() {
return ExtraBees.instance;
}
@Override
public String getName() {
return "Punnett";
}
@Override
public void initialiseClient() {
setTitle("Punnett Square");
CraftGUI.Render.stylesheet(new StyleSheetPunnett());
}
static class StyleSheetPunnett extends StyleSheet {
public StyleSheetPunnett() {
textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, ExtraBeeTexture.GUIPunnett, 32, 32, 32, 32));
textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, ExtraBeeTexture.GUIPunnett));
textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, ExtraBeeTexture.GUIPunnett));
}
}
}
@@ -10,18 +10,20 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.FluidStack;
import java.awt.Color;
public enum ExtraBeeLiquid implements ILiquidType {
ACID("acid", 0xafeb19),
POISON("poison", 0xeb14eb),
GLACIAL("liquidnitrogen", 0x96c8c8);
ACID("acid", new Color(0xafeb19)),
POISON("poison", new Color(0xeb14eb)),
GLACIAL("liquidnitrogen", new Color(0x96c8c8));
protected String ident;
protected IIcon icon;
protected int colour;
protected int color;
ExtraBeeLiquid(String ident, int colour) {
ExtraBeeLiquid(String ident, Color color) {
this.ident = ident;
this.colour = colour;
this.color = color.getRGB();
}
@Override
@@ -75,6 +77,6 @@ public enum ExtraBeeLiquid implements ILiquidType {
@Override
public int getContainerColor() {
return colour;
return color;
}
}
@@ -4,116 +4,112 @@ import binnie.core.item.IItemEnum;
import binnie.extrabees.ExtraBees;
import forestry.api.recipes.RecipeManagers;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.awt.Color;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
public enum EnumHoneyComb implements IItemEnum {
BARREN(7564356, 12762791),
ROTTEN(4084257, 11652233),
BONE(12895407, 14606017),
OIL(394760, 2894646),
COAL(10392696, 3682590),
FUEL(10252096, 16761856),
WATER(2568911, 7973065),
MILK(14145991, 16777215),
FRUIT(8202548, 14372706),
SEED(3428147, 7457902),
ALCOHOL(4293921, 14604622),
STONE(9211025, 13027020),
REDSTONE(16422550, 15077392),
RESIN(16762703, 13208064),
IC2ENERGY(15332623, 2143177),
IRON(3552564, 11038808),
GOLD(3552564, 15125515),
COPPER(3552564, 13722376),
TIN(3552564, 12431805),
SILVER(3552564, 14408667),
BRONZE,
URANIUM(2031360, 4303667),
CLAY(7034426, 11583702),
OLD(4535060, 11769444),
FUNGAL(7234891, 2856003),
CREOSOTE(10256652, 12429911),
LATEX(5854529, 11051653),
ACIDIC(3441987, 1374014),
VENOMOUS(8198269, 16724991),
SLIME(3884860, 8442245),
BLAZE(16738816, 16763904),
COFFEE(5519389, 11763531),
GLACIAL(5146503, 13366002),
MINT,
CITRUS,
PEAT,
SHADOW(0, 3545141),
LEAD(3552564, 10125468),
BRASS,
ELECTRUM,
ZINC(3552564, 15592447),
TITANIUM(3552564, 11578083),
TUNGSTEN(3552564, 1249812),
STEEL,
IRIDIUM,
PLATINUM(3552564, 10125468),
LAPIS(3552564, 4009179),
SODALITE,
PYRITE,
BAUXITE,
CINNABAR,
SPHALERITE,
EMERALD(3552564, 1900291),
RUBY(3552564, 14024704),
SAPPHIRE(3552564, 673791),
OLIVINE,
DIAMOND(3552564, 8371706),
RED(13388876, 16711680),
YELLOW(15066419, 16768256),
BLUE(10072818, 8959),
GREEN(6717235, 39168),
BLACK(1644825, 5723991),
WHITE(14079702, 16777215),
BROWN(8349260, 6042895),
ORANGE(15905331, 16751872),
CYAN(5020082, 65509),
PURPLE(11691749, 11403519),
GRAY(5000268, 12237498),
LIGHTBLUE(10072818, 40447),
PINK(15905484, 16744671),
LIMEGREEN(8375321, 65288),
MAGENTA(15040472, 16711884),
LIGHTGRAY(10066329, 13224393),
NICKEL(3552564, 16768764),
INVAR,
GLOWSTONE(10919006, 14730249),
SALTPETER(10919006, 14730249),
PULP,
MULCH,
COMPOST(4338440, 7036475),
SAWDUST(12561009, 15913854),
CERTUS(13029631, 3755363),
ENDERPEARL(3446662, 206368),
YELLORIUM(2564173, 14019840),
CYANITE(2564173, 34541),
BLUTONIUM(2564173, 1769702);
BARREN(new Color(0x736c44), new Color(0xc2bea7)),
ROTTEN(new Color(0x3e5221), new Color(0xb1cc89)),
BONE(new Color(0xc4c4af), new Color(0xdedec1)),
OIL(new Color(0x060608), new Color(0x2c2b36)),
COAL(new Color(0x9e9478), new Color(0x38311e)),
FUEL(new Color(0x9c6f40), new Color(0xffc400)),
WATER(new Color(0x2732cf), new Color(0x79a8c9)),
MILK(new Color(0xd7d9c7), new Color(0xffffff)),
FRUIT(new Color(0x7d2934), new Color(0xdb4f62)),
SEED(new Color(0x344f33), new Color(0x71cc6e)),
ALCOHOL(new Color(0x418521), new Color(0xded94e)),
STONE(new Color(0x8c8c91), new Color(0xc6c6cc)),
REDSTONE(new Color(0xfa9696), new Color(0xe61010)),
RESIN(new Color(0xffc74f), new Color(0xc98a00)),
IC2ENERGY(new Color(0xe9f50f), new Color(0x20b3c9)),
IRON(new Color(0x363534), new Color(0xa87058)),
GOLD(new Color(0x363534), new Color(0xe6cc0b)),
COPPER(new Color(0x363534), new Color(0xd16308)),
TIN(new Color(0x363534), new Color(0xbdb1bd)),
SILVER(new Color(0x363534), new Color(0xdbdbdb)),
// BRONZE,
URANIUM(new Color(0x1eff00), new Color(0x41ab33)),
CLAY(new Color(0x6b563a), new Color(0xb0c0d6)),
OLD(new Color(0x453314), new Color(0xb39664)),
FUNGAL(new Color(0x6e654b), new Color(0x2b9443)),
CREOSOTE(new Color(0x9c810c), new Color(0xbdaa57)),
LATEX(new Color(0x595541), new Color(0xa8a285)),
ACIDIC(new Color(0x348543), new Color(0x14f73e)),
VENOMOUS(new Color(0x7d187d), new Color(0xff33ff)),
SLIME(new Color(0x3b473c), new Color(0x80d185)),
BLAZE(new Color(0xff6a00), new Color(0xffcc00)),
COFFEE(new Color(0x54381d), new Color(0xb37f4b)),
GLACIAL(new Color(0x4e8787), new Color(0xcbf2f2)),
// MINT,
// CITRUS,
// PEAT,
SHADOW(new Color(0x000000), new Color(0x361835)),
LEAD(new Color(0x363534), new Color(0x9a809c)),
// BRASS,
// ELECTRUM,
ZINC(new Color(0x363534), new Color(0xedebff)),
TITANIUM(new Color(0x363534), new Color(0xb0aae3)),
TUNGSTEN(new Color(0x363534), new Color(0x131214)),
// STEEL,
// IRIDIUM,
PLATINUM(new Color(0x363534), new Color(0x9a809c)),
LAPIS(new Color(0x363534), new Color(0x3d2cdb)),
// SODALITE,
// PYRITE,
// BAUXITE,
// CINNABAR,
// SPHALERITE,
EMERALD(new Color(0x363534), new Color(0x1cff03)),
RUBY(new Color(0x363534), new Color(0xd60000)),
SAPPHIRE(new Color(0x363534), new Color(0xa47ff)),
// OLIVINE,
DIAMOND(new Color(0x363534), new Color(0x7fbdfa)),
RED(new Color(0xcc4c4c), new Color(0xff0000)),
YELLOW(new Color(0xe5e533), new Color(0xffdd00)),
BLUE(new Color(0x99b2f2), new Color(0x0022ff)),
GREEN(new Color(0x667f33), new Color(0x009900)),
BLACK(new Color(0x191919), new Color(0x575757)),
WHITE(new Color(0xd6d6d6), new Color(0xffffff)),
BROWN(new Color(0x7f664c), new Color(0x5c350f)),
ORANGE(new Color(0xf2b233), new Color(0xff9d00)),
CYAN(new Color(0x4c99b2), new Color(0x00ffe5)),
PURPLE(new Color(0xb266e5), new Color(0xae00ff)),
GRAY(new Color(0x4c4c4c), new Color(0xbababa)),
LIGHTBLUE(new Color(0x99b2f2), new Color(0x009dff)),
PINK(new Color(0xf2b2cc), new Color(0xff80df)),
LIMEGREEN(new Color(0x7fcc19), new Color(0x00ff08)),
MAGENTA(new Color(0xe57fd8), new Color(0xff00cc)),
LIGHTGRAY(new Color(0x999999), new Color(0xc9c9c9)),
NICKEL(new Color(0x363534), new Color(0xffdefc)),
// INVAR,
GLOWSTONE(new Color(0xa69c5e), new Color(0xe0c409)),
SALTPETER(new Color(0xa69c5e), new Color(0xe0c409)),
//PULP,
//MULCH,
COMPOST(new Color(0x423308), new Color(0x6b5e3b)),
SAWDUST(new Color(0xbfaa71), new Color(0xf2d37e)),
CERTUS(new Color(0xc6d0ff), new Color(0x394d63)),
ENDERPEARL(new Color(0x349786), new Color(0x32620)),
YELLORIUM(new Color(0x27204d), new Color(14019840)),
CYANITE(new Color(0x27204d), new Color(0x86ed)),
BLUTONIUM(new Color(0x27204d), new Color(0x1b00e6));
public Map<ItemStack, Float> products;
public boolean deprecated;
public final int primaryColor;
public final int secondaryColor;
public final String name;
protected int[] color;
protected boolean active;
EnumHoneyComb() {
this(0xffffff, 0xffffff);
active = false;
deprecated = true;
}
EnumHoneyComb(int color, int color2) {
this.color = new int[]{color, color2};
EnumHoneyComb(Color primaryColor, Color secondaryColor) {
this.primaryColor = primaryColor.getRGB();
this.secondaryColor = secondaryColor.getRGB();
name = toString().toLowerCase(Locale.ENGLISH);
products = new LinkedHashMap<>();
active = true;
deprecated = false;
}
public static EnumHoneyComb get(ItemStack itemStack) {
@@ -139,8 +135,8 @@ public enum EnumHoneyComb implements IItemEnum {
}
@Override
public String getName(ItemStack itemStack) {
return ExtraBees.proxy.localise("item.comb." + name().toLowerCase());
public String getName(ItemStack stack) {
return ExtraBees.proxy.localise("item.comb." + name);
}
public boolean addProduct(ItemStack item, Float chance) {
@@ -155,18 +151,9 @@ public enum EnumHoneyComb implements IItemEnum {
active = addProduct(item, chance);
}
// TODO unused method?
public void tryAddProduct(String oreDict, Float chance) {
if (!OreDictionary.getOres(oreDict).isEmpty()) {
tryAddProduct(OreDictionary.getOres(oreDict).get(0), chance);
} else {
active = false;
}
}
public void tryAddProduct(IItemEnum type, Float chance) {
tryAddProduct(type.get(1), chance);
active = (active && type.isActive());
active = active && type.isActive();
}
public void copyProducts(EnumHoneyComb comb) {
@@ -8,52 +8,48 @@ import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.awt.Color;
public enum EnumHoneyDrop implements IItemEnum {
ENERGY(0x9c4972, 0xe37171, ""),
ACID(0x4bb541, 0x49de3c, "acid"),
POISON(0xd106b9, 0xff03e2, "poison"),
APPLE(0xc75252, 0xc92a2a, "juice"),
CITRUS,
ICE(0xaee8e2, 0x96fff5, "liquidnitrogen"),
MILK(0xe0e0e0, 0xffffff, "milk"),
SEED(0x7cc272, 0xc2bea7, "seedoil"),
ALCOHOL(0xdbe84d, 0xa5e84d, "short.mead"),
FRUIT,
VEGETABLE,
PUMPKIN,
MELON,
RED(0xcc4c4c, 0xff0000, "for.honey"),
YELLOW(0xe5e533, 0xffdd00, "for.honey"),
BLUE(0x99b2f2, 0x0022ff, "for.honey"),
GREEN(0x667f33, 0x009900, "for.honey"),
BLACK(0x191919, 0x575757, "for.honey"),
WHITE(0xd6d6d6, 0xffffff, "for.honey"),
BROWN(0x7f664c, 0x5c350f, "for.honey"),
ORANGE(0xf2b233, 0xff9d00, "for.honey"),
CYAN(0x4c99b2, 0x00ffe5, "for.honey"),
PURPLE(0xb266e5, 0xae00ff, "for.honey"),
GRAY(0x4c4c4c, 0xbababa, "for.honey"),
LIGHTBLUE(0x99b2f2, 0x009dff, "for.honey"),
PINK(0xf2b2cc, 0xff80df, "for.honey"),
LIMEGREEN(0x7fcc19, 0x00ff08, "for.honey"),
MAGENTA(0xe57fd8, 0xff00cc, "for.honey"),
LIGHTGRAY(0x999999, 0xc9c9c9, "for.honey");
ENERGY(new Color(0x9c4972), new Color(0xe37171), ""),
ACID(new Color(0x4bb541), new Color(0x49de3c), "acid"),
POISON(new Color(0xd106b9), new Color(0xff03e2), "poison"),
APPLE(new Color(0xc75252), new Color(0xc92a2a), "juice"),
// CITRUS,
ICE(new Color(0xaee8e2), new Color(0x96fff5), "liquidnitrogen"),
MILK(new Color(0xe0e0e0), new Color(0xffffff), "milk"),
SEED(new Color(0x7cc272), new Color(0xc2bea7), "seedoil"),
ALCOHOL(new Color(0xdbe84d), new Color(0xa5e84d), "short.mead"),
// FRUIT,
// VEGETABLE,
// PUMPKIN,
// MELON,
RED(new Color(0xcc4c4c), new Color(0xff0000), "for.honey"),
YELLOW(new Color(0xe5e533), new Color(0xffdd00), "for.honey"),
BLUE(new Color(0x99b2f2), new Color(0x0022ff), "for.honey"),
GREEN(new Color(0x667f33), new Color(0x009900), "for.honey"),
BLACK(new Color(0x191919), new Color(0x575757), "for.honey"),
WHITE(new Color(0xd6d6d6), new Color(0xffffff), "for.honey"),
BROWN(new Color(0x7f664c), new Color(0x5c350f), "for.honey"),
ORANGE(new Color(0xf2b233), new Color(0xff9d00), "for.honey"),
CYAN(new Color(0x4c99b2), new Color(0x00ffe5), "for.honey"),
PURPLE(new Color(0xb266e5), new Color(0xae00ff), "for.honey"),
GRAY(new Color(0x4c4c4c), new Color(0xbababa), "for.honey"),
LIGHTBLUE(new Color(0x99b2f2), new Color(0x009dff), "for.honey"),
PINK(new Color(0xf2b2cc), new Color(0xff80df), "for.honey"),
LIMEGREEN(new Color(0x7fcc19), new Color(0x00ff08), "for.honey"),
MAGENTA(new Color(0xe57fd8), new Color(0xff00cc), "for.honey"),
LIGHTGRAY(new Color(0x999999), new Color(0xc9c9c9), "for.honey");
public final int primaryColor;
public final int secondaryColor;
public boolean deprecated;
protected int[] color;
protected String liquidName;
protected ItemStack remenant;
EnumHoneyDrop() {
this(0xffffff, 0xffffff, "");
}
EnumHoneyDrop(int color, int color2, String liquid) {
liquidName = "";
remenant = null;
deprecated = false;
this.color = new int[]{color, color2};
EnumHoneyDrop(Color primaryColor, Color secondaryColor, String liquid) {
this.primaryColor = primaryColor.getRGB();
this.secondaryColor = secondaryColor.getRGB();
liquidName = liquid;
}
@@ -67,7 +63,6 @@ public enum EnumHoneyDrop implements IItemEnum {
public void addRemenant(ItemStack stack) {
remenant = stack;
deprecated = true;
}
public void addRecipe() {
@@ -79,7 +74,8 @@ public enum EnumHoneyDrop implements IItemEnum {
@Override
public boolean isActive() {
return !deprecated && (liquidName == null || FluidRegistry.isFluidRegistered(liquidName));
return liquidName == null
|| FluidRegistry.isFluidRegistered(liquidName);
}
@Override
@@ -7,32 +7,28 @@ import forestry.api.recipes.RecipeManagers;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import java.awt.Color;
public enum EnumPropolis implements IItemEnum {
WATER(0x24b3c9, 0xc2bea7, "Water"),
OIL(0x172f33, 0xc2bea7, "oil"),
FUEL(0xa38d12, 0xc2bea7, "fuel"),
MILK,
FRUIT,
SEED,
ALCOHOL,
CREOSOTE(0x877501, 0xbda613, "creosote"),
GLACIAL,
PEAT;
WATER(new Color(0x24b3c9), new Color(0xc2bea7), "Water"),
OIL(new Color(0x172f33), new Color(0xc2bea7), "oil"),
FUEL(new Color(0xa38d12), new Color(0xc2bea7), "fuel"),
// MILK,
// FRUIT,
// SEED,
// ALCOHOL,
CREOSOTE(new Color(0x877501), new Color(0xbda613), "creosote");
// GLACIAL,
// PEAT
int[] colour;
String liquidName;
boolean active;
public final int secondaryColor;
public final int primaryColor;
public final String liquidName;
EnumPropolis() {
this(0xffffff, 0xffffff, "");
active = false;
}
EnumPropolis(int colour, int colour2, String liquid) {
this.colour = new int[0];
active = true;
this.colour = new int[]{colour, colour2};
liquidName = liquid;
EnumPropolis(Color primaryColor, Color secondaryColor, String liquidName) {
this.primaryColor = primaryColor.getRGB();
this.secondaryColor = secondaryColor.getRGB();
this.liquidName = liquidName;
}
public static EnumPropolis get(ItemStack itemStack) {
@@ -52,7 +48,7 @@ public enum EnumPropolis implements IItemEnum {
@Override
public boolean isActive() {
return active && Binnie.Liquid.getLiquidStack(liquidName, 100) != null;
return Binnie.Liquid.getLiquidStack(liquidName, 100) != null;
}
@Override
@@ -291,14 +291,15 @@ public class ItemHoneyComb extends ItemProduct {
}
@Override
public int getColorFromItemStack(ItemStack itemStack, int j) {
if (EnumHoneyComb.get(itemStack) == null) {
public int getColorFromItemStack(ItemStack stack, int indexColor) {
EnumHoneyComb comb = EnumHoneyComb.get(stack);
if (comb == null) {
return 0xffffff;
}
if (j == 0) {
return EnumHoneyComb.get(itemStack).color[0];
if (indexColor == 0) {
return comb.primaryColor;
}
return EnumHoneyComb.get(itemStack).color[1];
return comb.secondaryColor;
}
@Override
@@ -27,9 +27,9 @@ public class ItemHoneyDrop extends ItemProduct {
@Override
public int getColorFromItemStack(ItemStack itemStack, int j) {
if (j == 0) {
return EnumHoneyDrop.get(itemStack).color[0];
return EnumHoneyDrop.get(itemStack).primaryColor;
}
return EnumHoneyDrop.get(itemStack).color[1];
return EnumHoneyDrop.get(itemStack).secondaryColor;
}
@Override
@@ -11,10 +11,10 @@ public class ItemProduct extends Item {
protected IItemEnum[] types;
public ItemProduct(IItemEnum[] types) {
this.types = types;
setMaxStackSize(64);
setMaxDamage(0);
setHasSubtypes(true);
this.types = types;
}
public IItemEnum get(ItemStack stack) {
@@ -26,15 +26,15 @@ public class ItemProduct extends Item {
}
@Override
public String getItemStackDisplayName(ItemStack itemstack) {
return get(itemstack).getName(itemstack);
public String getItemStackDisplayName(ItemStack stack) {
return get(stack).getName(stack);
}
@Override
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List itemList) {
public void getSubItems(Item item, CreativeTabs tab, List list) {
for (IItemEnum type : types) {
if (type.isActive()) {
itemList.add(new ItemStack(this, 1, type.ordinal()));
list.add(new ItemStack(this, 1, type.ordinal()));
}
}
}
@@ -17,9 +17,9 @@ public class ItemPropolis extends ItemProduct {
@Override
public int getColorFromItemStack(ItemStack itemStack, int j) {
if (j == 0) {
return EnumPropolis.get(itemStack).colour[0];
return EnumPropolis.get(itemStack).primaryColor;
}
return EnumPropolis.get(itemStack).colour[1];
return EnumPropolis.get(itemStack).secondaryColor;
}
@Override
@@ -63,7 +63,7 @@ public class BlockExtraBeeHive extends Block {
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ArrayList<ItemStack> ret = new ArrayList<>();
List<IHiveDrop> dropList = EnumHiveType.values()[metadata].drops;
Collections.shuffle(dropList);
int tries = 0;