From 83789ae8f726631aa435dcb6d445cbcc2b0c4e65 Mon Sep 17 00:00:00 2001 From: CovertJaguar Date: Mon, 18 Aug 2014 05:20:29 -0700 Subject: [PATCH] Fix item and block localization. This is a world breaking change! --- api | 2 +- lang | 2 +- .../apiculture/CommandBeekeepingMode.java | 4 +- .../apiculture/VillageHandlerApiculture.java | 3 +- .../apiculture/gadgets/BlockCandle.java | 3 +- .../apiculture/gadgets/BlockStump.java | 5 +- .../gadgets/StructureLogicAlveary.java | 10 +- .../apiculture/gadgets/TileAlveary.java | 8 +- .../forestry/apiculture/gui/GuiBeealyzer.java | 2 +- .../apiculture/items/ItemArmorApiarist.java | 7 +- .../forestry/apiculture/items/ItemBeeGE.java | 2 +- .../apiculture/items/ItemCandleBlock.java | 2 +- .../apiculture/items/ItemHoneycomb.java | 86 ++-- .../worldgen/ComponentVillageBeeHouse.java | 49 +-- .../apiculture/worldgen/WorldGenHive.java | 11 +- .../arboriculture/CommandTreekeepingMode.java | 4 +- .../VillageHandlerArboriculture.java | 6 +- .../arboriculture/genetics/TreeHelper.java | 25 +- .../arboriculture/items/ItemStairs.java | 17 +- .../arboriculture/items/ItemWoodBlock.java | 13 +- .../proxy/ClientProxyArboriculture.java | 2 +- .../java/forestry/core/CommandForestry.java | 6 +- .../forestry/core/CreativeTabForestry.java | 20 +- src/main/java/forestry/core/GameMode.java | 22 +- .../java/forestry/core/WorldGenerator.java | 2 +- .../core/circuits/ItemCircuitBoard.java | 59 +-- .../forestry/core/config/ForestryBlock.java | 124 ++++-- .../forestry/core/config/ForestryItem.java | 7 +- .../java/forestry/core/gadgets/BlockSoil.java | 2 +- .../forestry/core/gadgets/TileMachine.java | 6 +- .../core/genetics/ItemResearchNote.java | 2 +- .../core/items/ItemArmorNaturalist.java | 7 +- .../java/forestry/core/items/ItemCrated.java | 16 +- .../forestry/core/items/ItemForestry.java | 9 +- .../core/items/ItemForestryBlock.java | 8 - .../forestry/core/items/ItemForestryFood.java | 19 +- .../core/items/ItemForestryMultiPass.java | 48 +++ .../core/items/ItemForestryPickaxe.java | 6 +- .../core/items/ItemForestryShovel.java | 4 +- .../java/forestry/core/items/ItemFruit.java | 14 +- .../core/items/ItemLiquidContainer.java | 12 +- .../java/forestry/core/items/ItemMisc.java | 14 +- .../java/forestry/core/items/ItemOverlay.java | 14 +- .../java/forestry/core/items/ItemPipette.java | 8 +- .../java/forestry/core/proxy/ProxyCommon.java | 9 +- .../java/forestry/core/utils/StringUtil.java | 32 +- .../forestry/core/worldgen/BlockType.java | 6 + .../core/worldgen/WorldGenMinableMeta.java | 5 + .../factory/recipes/CraftGuideBottler.java | 2 +- .../factory/recipes/CraftGuideCarpenter.java | 2 +- .../factory/recipes/CraftGuideCentrifuge.java | 7 +- .../factory/recipes/CraftGuideFabricator.java | 2 +- .../factory/recipes/CraftGuideFermenter.java | 2 +- .../factory/recipes/CraftGuideSqueezer.java | 2 +- .../factory/recipes/CraftGuideStill.java | 2 +- .../forestry/farming/EventHandlerFarming.java | 4 +- .../forestry/farming/items/ItemFarmBlock.java | 11 +- .../java/forestry/farming/logic/CropPeat.java | 2 +- .../farming/logic/FarmLogicArboreal.java | 11 +- .../forestry/farming/logic/FarmLogicPeat.java | 15 +- .../forestry/farming/logic/FarmableGE.java | 2 +- .../farming/logic/FarmableVanillaShroom.java | 2 +- .../farming/proxy/ClientProxyFarming.java | 3 +- .../farming/render/FarmRenderingHandler.java | 2 +- .../forestry/food/items/ItemBeverage.java | 9 +- src/main/java/forestry/mail/CommandMail.java | 4 +- .../java/forestry/mail/items/ItemStamps.java | 4 +- .../forestry/plugins/PluginApiculture.java | 388 +++++++++-------- .../forestry/plugins/PluginArboriculture.java | 394 +++++++----------- .../java/forestry/plugins/PluginCore.java | 53 +-- .../java/forestry/plugins/PluginEnergy.java | 36 +- .../java/forestry/plugins/PluginFactory.java | 237 ++++++----- .../java/forestry/plugins/PluginFarming.java | 68 +-- .../plugins/PluginLepidopterology.java | 32 +- .../java/forestry/plugins/PluginMail.java | 52 +-- .../java/forestry/plugins/PluginStorage.java | 128 +++--- .../forestry/storage/BackpackDefinition.java | 18 +- .../forestry/storage/items/ItemBackpack.java | 1 - 78 files changed, 1119 insertions(+), 1120 deletions(-) create mode 100644 src/main/java/forestry/core/items/ItemForestryMultiPass.java diff --git a/api b/api index 6513f5dcb..fc81bb2e8 160000 --- a/api +++ b/api @@ -1 +1 @@ -Subproject commit 6513f5dcbcdc27f9cf0ce838e486280a8ff78d4e +Subproject commit fc81bb2e83f02c799f780ebdb1db73a315364b08 diff --git a/lang b/lang index 0f422edb0..1d0c7ada9 160000 --- a/lang +++ b/lang @@ -1 +1 @@ -Subproject commit 0f422edb0a0c76bf56daf88cabe61754586ccfa1 +Subproject commit 1d0c7ada9c1d102e6ba92ece9f5dc2cdfdbf82be diff --git a/src/main/java/forestry/apiculture/CommandBeekeepingMode.java b/src/main/java/forestry/apiculture/CommandBeekeepingMode.java index ccdd8b904..694140b22 100755 --- a/src/main/java/forestry/apiculture/CommandBeekeepingMode.java +++ b/src/main/java/forestry/apiculture/CommandBeekeepingMode.java @@ -78,7 +78,7 @@ public class CommandBeekeepingMode extends CommandMC { public void processCommand(ICommandSender sender, String[] arguments) { if (arguments.length <= 0) - throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help",this.getCommandUsage(sender))); + throw new WrongUsageException(StringUtil.localize("chat.help",this.getCommandUsage(sender))); if (arguments[0].matches("list")) listModes(sender, arguments); @@ -104,7 +104,7 @@ public class CommandBeekeepingMode extends CommandMC { saveStatistics(sender, arguments); } else if (arguments[0].matches("help")) { - sendChatMessage(sender, StringUtil.localizeAndFormat("chat.bees.command.help.0", this.getCommandName())); + sendChatMessage(sender, StringUtil.localize("chat.bees.command.help.0", this.getCommandName())); sendChatMessage(sender, StringUtil.localize("chat.bees.command.help.1")); sendChatMessage(sender, StringUtil.localize("chat.bees.command.help.2")); sendChatMessage(sender, StringUtil.localize("chat.bees.command.help.3")); diff --git a/src/main/java/forestry/apiculture/VillageHandlerApiculture.java b/src/main/java/forestry/apiculture/VillageHandlerApiculture.java index 929a3650d..584dd81da 100755 --- a/src/main/java/forestry/apiculture/VillageHandlerApiculture.java +++ b/src/main/java/forestry/apiculture/VillageHandlerApiculture.java @@ -49,8 +49,7 @@ public class VillageHandlerApiculture implements IVillageCreationHandler, IVilla public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { recipeList.add(new MerchantRecipe(ForestryItem.beePrincessGE.getItemStack(1, Defaults.WILDCARD), new ItemStack(Items.emerald, 1))); recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), ItemHoneycomb.getRandomComb(1, random, false))); - recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, Defaults.WILDCARD), new ItemStack(ForestryBlock.apiculture, 1, - Defaults.DEFINITION_APIARY_META))); + recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, Defaults.WILDCARD), ForestryBlock.apiculture.getItemStack(1, Defaults.DEFINITION_APIARY_META))); recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), ForestryItem.frameProven.getItemStack(6))); recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), ForestryItem.beePrincessGE.getItemStack(1, Defaults.WILDCARD), PluginApiculture.beeInterface.getMemberStack( diff --git a/src/main/java/forestry/apiculture/gadgets/BlockCandle.java b/src/main/java/forestry/apiculture/gadgets/BlockCandle.java index 2c3f09973..5111fee49 100755 --- a/src/main/java/forestry/apiculture/gadgets/BlockCandle.java +++ b/src/main/java/forestry/apiculture/gadgets/BlockCandle.java @@ -41,6 +41,7 @@ import forestry.core.ForestryClient; import forestry.core.config.Defaults; import forestry.core.render.TextureManager; import forestry.core.utils.StackUtils; +import forestry.core.utils.StringUtil; public class BlockCandle extends BlockTorch { @@ -84,7 +85,7 @@ public class BlockCandle extends BlockTorch { @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) { - String fileBase = this.getUnlocalizedName().replace("tile.", ""); + String fileBase = StringUtil.cleanBlockName(this); this.blockIcon = TextureManager.getInstance().registerTex(register, "stump"); this.litStump = TextureManager.getInstance().registerTex(register, fileBase + "StumpLit"); this.litTip = TextureManager.getInstance().registerTex(register, fileBase + "TipLit"); diff --git a/src/main/java/forestry/apiculture/gadgets/BlockStump.java b/src/main/java/forestry/apiculture/gadgets/BlockStump.java index 2776e0987..53eca9bf4 100755 --- a/src/main/java/forestry/apiculture/gadgets/BlockStump.java +++ b/src/main/java/forestry/apiculture/gadgets/BlockStump.java @@ -31,6 +31,7 @@ import forestry.core.config.Defaults; import forestry.core.config.ForestryBlock; import forestry.core.render.TextureManager; import forestry.core.utils.StackUtils; +import forestry.core.utils.StringUtil; public class BlockStump extends BlockTorch { @@ -44,7 +45,7 @@ public class BlockStump extends BlockTorch { @SideOnly(Side.CLIENT) @Override public void registerBlockIcons(IIconRegister register) { - this.blockIcon = TextureManager.getInstance().registerTex(register, this.getUnlocalizedName().replace("tile.", "")); + this.blockIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanBlockName(this)); } @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -61,7 +62,7 @@ public class BlockStump extends BlockTorch { (held.getItem() == Items.flint_and_steel || held.getItem() == Items.flint || StackUtils.equals(Blocks.torch, held))) { - world.setBlock(x, y, z, ForestryBlock.candle, world.getBlockMetadata(x, y, z) | 0x08, Defaults.FLAG_BLOCK_SYNCH); + world.setBlock(x, y, z, ForestryBlock.candle.block(), world.getBlockMetadata(x, y, z) | 0x08, Defaults.FLAG_BLOCK_SYNCH); TileCandle tc = new TileCandle(); tc.setColour(0); // default to white world.setTileEntity(x, y, z, tc); diff --git a/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java b/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java index 5d3931ff2..db5306048 100755 --- a/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java +++ b/src/main/java/forestry/apiculture/gadgets/StructureLogicAlveary.java @@ -33,15 +33,15 @@ public class StructureLogicAlveary extends StructureLogic { "FAAAF", "FABAF", "FCCCF", "FFFFF", "FFFFF", "FAAAF", "FAAAF", "FBMBF", "FCCCF", "FFFFF", "FFFFF", "FAAAF", "FAAAF", "FABAF", "FCCCF", "FFFFF", "FFFFF", "FFFFF", "FFFFF", "FFFFF", "FFFFF", "FFFFF").setOffsets(-2, -3, -2); - public static HashSet slabBlocks = new HashSet(); + public static final HashSet slabBlocks = new HashSet(); static { slabBlocks.add(Blocks.stone_slab); slabBlocks.add(Blocks.wooden_slab); - slabBlocks.add(ForestryBlock.slabs1); - slabBlocks.add(ForestryBlock.slabs2); - slabBlocks.add(ForestryBlock.slabs3); + slabBlocks.add(ForestryBlock.slabs1.block()); + slabBlocks.add(ForestryBlock.slabs2.block()); + slabBlocks.add(ForestryBlock.slabs3.block()); if (ForestryBlock.slabs4 != null) - slabBlocks.add(ForestryBlock.slabs4); + slabBlocks.add(ForestryBlock.slabs4.block()); } public StructureLogicAlveary(ITileStructure structure) { diff --git a/src/main/java/forestry/apiculture/gadgets/TileAlveary.java b/src/main/java/forestry/apiculture/gadgets/TileAlveary.java index 463dcf5b0..e60511584 100755 --- a/src/main/java/forestry/apiculture/gadgets/TileAlveary.java +++ b/src/main/java/forestry/apiculture/gadgets/TileAlveary.java @@ -47,10 +47,9 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon /* UPDATING */ @Override public void initialize() { - Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - if (block != ForestryBlock.alveary) { + if (!ForestryBlock.alveary.isBlockEqual(worldObj, xCoord, yCoord, zCoord)) { Proxies.log.info("Updating alveary block at %s/%s/%s.", xCoord, yCoord, zCoord); - worldObj.setBlock(xCoord, yCoord, zCoord, ForestryBlock.alveary, componentBlockMeta, Defaults.FLAG_BLOCK_SYNCH); + worldObj.setBlock(xCoord, yCoord, zCoord, ForestryBlock.alveary.block(), componentBlockMeta, Defaults.FLAG_BLOCK_SYNCH); validate(); worldObj.setTileEntity(xCoord, yCoord, zCoord, this); } @@ -114,7 +113,8 @@ public abstract class TileAlveary extends TileForestry implements IAlvearyCompon structureLogic.writeToNBT(nbttagcompound); } - protected void createInventory() {} + protected void createInventory() { + } @Override public void fromPacketPayload(PacketPayload payload) { diff --git a/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java b/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java index 18cf8f038..4aeddec6b 100755 --- a/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java +++ b/src/main/java/forestry/apiculture/gui/GuiBeealyzer.java @@ -271,7 +271,7 @@ public class GuiBeealyzer extends GuiAlyzer { if (bee.getGeneration() >= 0) { newLine(); - displayText = StringUtil.localizeAndFormat("gui.beealyzer.generations", bee.getGeneration()); + displayText = StringUtil.localize("gui.beealyzer.generations", bee.getGeneration()); // offset = (int)(((158 - fontRendererObj.getStringWidth(origin)) / 2)*(1/factor)); drawCenteredLine(displayText, 8, 158, fontColor.get("gui.beealyzer.binomial")); } diff --git a/src/main/java/forestry/apiculture/items/ItemArmorApiarist.java b/src/main/java/forestry/apiculture/items/ItemArmorApiarist.java index 54a1bf967..5a5efabe4 100755 --- a/src/main/java/forestry/apiculture/items/ItemArmorApiarist.java +++ b/src/main/java/forestry/apiculture/items/ItemArmorApiarist.java @@ -44,15 +44,10 @@ public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArm return Defaults.ID + ":" + Defaults.TEXTURE_APIARIST_ARMOR_PRIMARY; } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - return StringUtil.localize(getUnlocalizedName(itemstack)); - } - @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister register) { - itemIcon = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "")); + itemIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this)); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/forestry/apiculture/items/ItemBeeGE.java b/src/main/java/forestry/apiculture/items/ItemBeeGE.java index 75dde6f67..e0ca3e332 100755 --- a/src/main/java/forestry/apiculture/items/ItemBeeGE.java +++ b/src/main/java/forestry/apiculture/items/ItemBeeGE.java @@ -70,7 +70,7 @@ public class ItemBeeGE extends ItemGE { public String getItemStackDisplayName(ItemStack itemstack) { if (itemstack.getTagCompound() == null) - return StringUtil.localize(type.getName()); + return super.getItemStackDisplayName(itemstack); IBee individual = new Bee(itemstack.getTagCompound()); if(StatCollector.canTranslate("bees.custom." + type.getName() + "." + individual.getDisplayName())){ diff --git a/src/main/java/forestry/apiculture/items/ItemCandleBlock.java b/src/main/java/forestry/apiculture/items/ItemCandleBlock.java index a27d72f3c..951beb0c4 100755 --- a/src/main/java/forestry/apiculture/items/ItemCandleBlock.java +++ b/src/main/java/forestry/apiculture/items/ItemCandleBlock.java @@ -42,7 +42,7 @@ public class ItemCandleBlock extends ItemForestryBlock { @Override public String getUnlocalizedName(ItemStack itemStack) { - String value = "tile.candle"; + String value = getBlock().getUnlocalizedName(); if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(BlockCandle.colourTagName)) { value = value + ".dyed"; } diff --git a/src/main/java/forestry/apiculture/items/ItemHoneycomb.java b/src/main/java/forestry/apiculture/items/ItemHoneycomb.java index 7c037cc9e..0f98654db 100755 --- a/src/main/java/forestry/apiculture/items/ItemHoneycomb.java +++ b/src/main/java/forestry/apiculture/items/ItemHoneycomb.java @@ -14,23 +14,16 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import forestry.api.core.Tabs; import forestry.core.config.Config; import forestry.core.config.ForestryItem; -import forestry.core.items.ItemForestry; -import forestry.core.render.TextureManager; -import forestry.core.utils.StringUtil; +import forestry.core.items.ItemForestryMultiPass; -public class ItemHoneycomb extends ItemForestry { +public class ItemHoneycomb extends ItemForestryMultiPass { private static class CombInfo { @@ -50,23 +43,23 @@ public class ItemHoneycomb extends ItemForestry { return this; } } - public CombInfo[] combs = new CombInfo[] { new CombInfo("honey", 0xe8d56a, 0xffa12b), // 0 - new CombInfo("cocoa", 0x674016, 0xffb62b).setIsSecret(), // 1 - new CombInfo("simmering", 0x981919, 0xffb62b), // 2 - new CombInfo("stringy", 0xc8be67, 0xbda93e), // 3 - new CombInfo("frozen", 0xf9ffff, 0xa0ffff), // 4 - new CombInfo("dripping", 0xdc7613, 0xffff00), // 5 - new CombInfo("silky", 0x508907, 0xddff00), // 6 - new CombInfo("parched", 0xdcbe13, 0xffff00), // 7 - new CombInfo("mysterious", 0x161616, 0xe099ff).setIsSecret(), // 8 - new CombInfo("irradiated", 0xeafff3, 0xeeff00).setIsSecret(), // 9 - new CombInfo("powdery", 0xe4e4e4, 0xffffff).setIsSecret(), // 10 - new CombInfo("reddened", 0x4b0000, 0x6200e7).setIsSecret(), // 11 - new CombInfo("darkened", 0x353535, 0x33ebcb).setIsSecret(), // 12 - new CombInfo("omega", 0x191919, 0x6dcff6).setIsSecret(), // 13 - new CombInfo("wheaten", 0xfeff8f, 0xffffff).setIsSecret(), // 14 - new CombInfo("mossy", 0x2a3313, 0x7e9939), // 15 - new CombInfo("mellow", 0x886000, 0xfff960) // 16 + public CombInfo[] combs = new CombInfo[]{new CombInfo("honey", 0xe8d56a, 0xffa12b), // 0 + new CombInfo("cocoa", 0x674016, 0xffb62b).setIsSecret(), // 1 + new CombInfo("simmering", 0x981919, 0xffb62b), // 2 + new CombInfo("stringy", 0xc8be67, 0xbda93e), // 3 + new CombInfo("frozen", 0xf9ffff, 0xa0ffff), // 4 + new CombInfo("dripping", 0xdc7613, 0xffff00), // 5 + new CombInfo("silky", 0x508907, 0xddff00), // 6 + new CombInfo("parched", 0xdcbe13, 0xffff00), // 7 + new CombInfo("mysterious", 0x161616, 0xe099ff).setIsSecret(), // 8 + new CombInfo("irradiated", 0xeafff3, 0xeeff00).setIsSecret(), // 9 + new CombInfo("powdery", 0xe4e4e4, 0xffffff).setIsSecret(), // 10 + new CombInfo("reddened", 0x4b0000, 0x6200e7).setIsSecret(), // 11 + new CombInfo("darkened", 0x353535, 0x33ebcb).setIsSecret(), // 12 + new CombInfo("omega", 0x191919, 0x6dcff6).setIsSecret(), // 13 + new CombInfo("wheaten", 0xfeff8f, 0xffffff).setIsSecret(), // 14 + new CombInfo("mossy", 0x2a3313, 0x7e9939), // 15 + new CombInfo("mellow", 0x886000, 0xfff960) // 16 // new CombInfo("", 0xd7bee5, 0xfd58ab), // kindof pinkish }; @@ -88,37 +81,8 @@ public class ItemHoneycomb extends ItemForestry { } @Override - public String getItemStackDisplayName(ItemStack itemstack) { - if (itemstack.getItemDamage() < 0 || itemstack.getItemDamage() >= combs.length) - return null; - - return StringUtil.localize("item.comb." + combs[itemstack.getItemDamage()].name); - } - - /* ICONS */ - @SideOnly(Side.CLIENT) - private IIcon[] icons; - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister register) { - icons = new IIcon[2]; - icons[0] = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "") + ".0"); - icons[1] = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "") + ".1"); - } - - @SideOnly(Side.CLIENT) - @Override - public IIcon getIconFromDamageForRenderPass(int i, int j) { - if (j > 0) - return icons[0]; - else - return icons[1]; - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName(stack) + "." + combs[stack.getItemDamage()].name; } @Override @@ -129,13 +93,12 @@ public class ItemHoneycomb extends ItemForestry { return combs[itemstack.getItemDamage()].secondaryColor; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { - for (int i = 0; i < combs.length; i++) { + for (int i = 0; i < combs.length; i++) if (!combs[i].isSecret || Config.isDebug) itemList.add(new ItemStack(this, 1, i)); - } } public int getCombTypeCount() { @@ -144,10 +107,9 @@ public class ItemHoneycomb extends ItemForestry { public int getRandomCombType(Random random, boolean includeSecret) { List validCombs = new ArrayList(getCombTypeCount()); - for (int i = 0; i < combs.length; i++) { + for (int i = 0; i < combs.length; i++) if (!combs[i].isSecret || includeSecret) validCombs.add(i); - } if (validCombs.isEmpty()) return 0; diff --git a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java index b94701ec0..6278b8c04 100755 --- a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java +++ b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java @@ -45,15 +45,15 @@ import forestry.plugins.PluginApiculture; public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { - protected ItemStack[] buildingBlocks = new ItemStack[] { new ItemStack(ForestryBlock.planks1, 1, 15), new ItemStack(Blocks.log, 1, 0), }; + protected ItemStack[] buildingBlocks = new ItemStack[]{ForestryBlock.planks1.getItemStack(1, 15), new ItemStack(Blocks.log, 1, 0),}; protected int averageGroundLevel = -1; protected boolean isInDesert = false; protected boolean hasChest = false; public ComponentVillageBeeHouse() { // Populate buildingblocks with some defaults so it doesn't explode. - buildingBlocks[0] = new ItemStack(ForestryBlock.planks1); - buildingBlocks[1] = new ItemStack(ForestryBlock.log1); + buildingBlocks[0] = ForestryBlock.planks1.getItemStack(); + buildingBlocks[1] = ForestryBlock.log1.getItemStack(); } public ComponentVillageBeeHouse(StructureVillagePieces.Start startPiece, int componentType, Random random, StructureBoundingBox boundingBox, int coordBaseMode) { @@ -61,21 +61,21 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { isInDesert = startPiece.inDesert; - buildingBlocks[0] = new ItemStack(ForestryBlock.planks1, 1, random.nextInt(16)); + buildingBlocks[0] = ForestryBlock.planks1.getItemStack(1, random.nextInt(16)); Block woodBlock; switch (random.nextInt(4)) { case 1: - woodBlock = ForestryBlock.log2; + woodBlock = ForestryBlock.log2.block(); break; case 2: - woodBlock = ForestryBlock.log3; + woodBlock = ForestryBlock.log3.block(); break; case 3: - woodBlock = ForestryBlock.log4; + woodBlock = ForestryBlock.log4.block(); break; default: - woodBlock = ForestryBlock.log1; + woodBlock = ForestryBlock.log1.block(); break; } @@ -83,17 +83,16 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { } /*@Override - protected void func_143012_a(NBTTagCompound par1nbtTagCompound) { - super.func_143012_a(par1nbtTagCompound); - par1nbtTagCompound.setBoolean("Chest", this.hasChest); - } - - @Override - protected void func_143011_b(NBTTagCompound par1nbtTagCompound) { - super.func_143011_b(par1nbtTagCompound); - this.hasChest = par1nbtTagCompound.getBoolean("Chest"); - }*/ + protected void func_143012_a(NBTTagCompound par1nbtTagCompound) { + super.func_143012_a(par1nbtTagCompound); + par1nbtTagCompound.setBoolean("Chest", this.hasChest); + } + @Override + protected void func_143011_b(NBTTagCompound par1nbtTagCompound) { + super.func_143011_b(par1nbtTagCompound); + this.hasChest = par1nbtTagCompound.getBoolean("Chest"); + }*/ @SuppressWarnings("rawtypes") public static ComponentVillageBeeHouse buildComponent(StructureVillagePieces.Start startPiece, List par1List, Random random, int par3, int par4, int par5, int par6, int par7) { @@ -171,12 +170,10 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { this.placeBlockAtCurrentPosition(world, Blocks.glass_pane, 0, 6, 2, 5, structBoundingBox); // Table/Bench - if (random.nextInt(10) < 1) { - this.placeBlockAtCurrentPosition(world, new ItemStack(ForestryBlock.core, 1, Defaults.DEFINITION_ESCRITOIRE_META), 1, 1, 3, structBoundingBox); - } - else { + if (random.nextInt(10) < 1) + this.placeBlockAtCurrentPosition(world, ForestryBlock.core.getItemStack(1, Defaults.DEFINITION_ESCRITOIRE_META), 1, 1, 3, structBoundingBox); + else this.placeBlockAtCurrentPosition(world, buildingBlocks[0], 1, 1, 3, structBoundingBox); - } this.placeBlockAtCurrentPosition(world, Blocks.air, 0, 2, 1, 0, structBoundingBox); this.placeBlockAtCurrentPosition(world, Blocks.air, 0, 2, 2, 0, structBoundingBox); @@ -268,12 +265,12 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { int yCoord = this.getYWithOffset(y); int zCoord = this.getZWithOffset(x, z); - if (box.isVecInside(xCoord, yCoord, zCoord) && world.getBlock(xCoord, yCoord, zCoord) != ForestryBlock.apiculture + if (box.isVecInside(xCoord, yCoord, zCoord) && !ForestryBlock.apiculture.isBlockEqual(world, xCoord, yCoord, zCoord) && world.blockExists(xCoord, yCoord - 1, zCoord)) { - world.setBlock(xCoord, yCoord, zCoord, ForestryBlock.apiculture, Defaults.DEFINITION_APIARY_META, + world.setBlock(xCoord, yCoord, zCoord, ForestryBlock.apiculture.block(), Defaults.DEFINITION_APIARY_META, Defaults.FLAG_BLOCK_SYNCH); - ForestryBlock.apiculture.onBlockAdded(world, xCoord, yCoord, zCoord); + ForestryBlock.apiculture.block().onBlockAdded(world, xCoord, yCoord, zCoord); TileEntity tile = world.getTileEntity(xCoord, yCoord, zCoord); if (tile instanceof TileBeehouse) { diff --git a/src/main/java/forestry/apiculture/worldgen/WorldGenHive.java b/src/main/java/forestry/apiculture/worldgen/WorldGenHive.java index ab5454045..6dcb98503 100755 --- a/src/main/java/forestry/apiculture/worldgen/WorldGenHive.java +++ b/src/main/java/forestry/apiculture/worldgen/WorldGenHive.java @@ -64,28 +64,27 @@ public abstract class WorldGenHive extends WorldGenerator { Block block = world.getBlock(x, y, z); if (block == null) return false; - for (Block testBlock : blocks) { + for (Block testBlock : blocks) if (block.isReplaceableOreGen(world, x, y, z, testBlock)) return true; - } return false; } protected void setHive(World world, int x, int y, int z, int meta) { - boolean placed = world.setBlock(x, y, z, ForestryBlock.beehives, meta, Defaults.FLAG_BLOCK_SYNCH); + boolean placed = world.setBlock(x, y, z, ForestryBlock.beehives.block(), meta, Defaults.FLAG_BLOCK_SYNCH); if (!placed) return; - if (world.getBlock(x, y, z) != ForestryBlock.beehives) + if (!ForestryBlock.beehives.isBlockEqual(world, x, y, z)) return; - ForestryBlock.beehives.onBlockAdded(world, x, y, z); + ForestryBlock.beehives.block().onBlockAdded(world, x, y, z); world.markBlockForUpdate(x, y, z); postGen(world, x, y, z, meta); } protected void postGen(World world, int x, int y, int z, int meta) { - ForestryBlock.beehives.onBlockPlaced(world, x, y, z, 0, 0.0f, 0.0f, 0.0f, meta); + ForestryBlock.beehives.block().onBlockPlaced(world, x, y, z, 0, 0.0f, 0.0f, 0.0f, meta); } } diff --git a/src/main/java/forestry/arboriculture/CommandTreekeepingMode.java b/src/main/java/forestry/arboriculture/CommandTreekeepingMode.java index 8b7b64dc6..39fdf95b6 100755 --- a/src/main/java/forestry/arboriculture/CommandTreekeepingMode.java +++ b/src/main/java/forestry/arboriculture/CommandTreekeepingMode.java @@ -78,7 +78,7 @@ public class CommandTreekeepingMode extends CommandMC { public void processCommand(ICommandSender sender, String[] arguments) { if (arguments.length <= 0) - throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help",this.getCommandUsage(sender))); + throw new WrongUsageException(StringUtil.localize("chat.help",this.getCommandUsage(sender))); if (arguments[0].matches("list")) listModes(sender, arguments); @@ -104,7 +104,7 @@ public class CommandTreekeepingMode extends CommandMC { saveStatistics(sender, arguments); } else if (arguments[0].matches("help")) { - sendChatMessage(sender, StringUtil.localizeAndFormat("chat.trees.command.help.0", this.getCommandName())); + sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.0", this.getCommandName())); sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.1")); sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.2")); sendChatMessage(sender, StringUtil.localize("chat.trees.command.help.3")); diff --git a/src/main/java/forestry/arboriculture/VillageHandlerArboriculture.java b/src/main/java/forestry/arboriculture/VillageHandlerArboriculture.java index c4bbeae5b..d661c3a04 100755 --- a/src/main/java/forestry/arboriculture/VillageHandlerArboriculture.java +++ b/src/main/java/forestry/arboriculture/VillageHandlerArboriculture.java @@ -42,13 +42,13 @@ public class VillageHandlerArboriculture implements IVillageTradeHandler { Block plankBlock; int meta; if(!sells.hasPlank) { - plankBlock = ForestryBlock.planks1; + plankBlock = ForestryBlock.planks1.block(); meta = 0; } else if(sells.ordinal() > 15) { - plankBlock = ForestryBlock.planks2; + plankBlock = ForestryBlock.planks2.block(); meta = sells.ordinal() - 16; } else { - plankBlock = ForestryBlock.planks1; + plankBlock = ForestryBlock.planks1.block(); meta = sells.ordinal(); } diff --git a/src/main/java/forestry/arboriculture/genetics/TreeHelper.java b/src/main/java/forestry/arboriculture/genetics/TreeHelper.java index 1e27633ed..108801145 100755 --- a/src/main/java/forestry/arboriculture/genetics/TreeHelper.java +++ b/src/main/java/forestry/arboriculture/genetics/TreeHelper.java @@ -79,7 +79,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { public int getSpeciesCount() { if (treeSpeciesCount < 0) { treeSpeciesCount = 0; - Iterator > it = AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet().iterator(); + Iterator> it = AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet().iterator(); while (it.hasNext()) { Entry entry = it.next(); if (entry.getValue() instanceof IAlleleTreeSpecies) @@ -109,12 +109,12 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { /* TREE SPECIFIC */ @Override public EnumGermlingType getType(ItemStack stack) { - if(stack == null) + if (stack == null) return EnumGermlingType.NONE; - if(ForestryItem.sapling.isItemEqual(stack)) + if (ForestryItem.sapling.isItemEqual(stack)) return EnumGermlingType.SAPLING; - else if(ForestryItem.pollenFertile.isItemEqual(stack)) + else if (ForestryItem.pollenFertile.isItemEqual(stack)) return EnumGermlingType.POLLEN; return EnumGermlingType.NONE; @@ -161,7 +161,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { germlingItem = ForestryItem.pollenFertile.item(); break; default: - return null; + throw new RuntimeException("Cannot instantiate a tree of type " + type); } NBTTagCompound nbttagcompound = new NBTTagCompound(); @@ -177,11 +177,11 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { @Override public boolean plantSapling(World world, ITree tree, GameProfile owner, int x, int y, int z) { - boolean placed = world.setBlock(x, y, z, ForestryBlock.saplingGE, 0, Defaults.FLAG_BLOCK_SYNCH); + boolean placed = world.setBlock(x, y, z, ForestryBlock.saplingGE.block(), 0, Defaults.FLAG_BLOCK_SYNCH); if (!placed) return false; - if (world.getBlock(x, y, z) != ForestryBlock.saplingGE) + if (!ForestryBlock.saplingGE.isBlockEqual(world, x, y, z)) return false; TileEntity tile = world.getTileEntity(x, y, z); @@ -201,11 +201,11 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { @Override public boolean setLeaves(World world, IIndividual tree, GameProfile owner, int x, int y, int z) { - boolean placed = world.setBlock(x, y, z, ForestryBlock.leaves, 0, Defaults.FLAG_BLOCK_SYNCH); + boolean placed = ForestryBlock.leaves.setBlock(world, x, y, z, 0, Defaults.FLAG_BLOCK_SYNCH); if (!placed) return false; - if (world.getBlock(x, y, z) != ForestryBlock.leaves) + if (!ForestryBlock.leaves.isBlockEqual(world, x, y, z)) return false; TileEntity tile = world.getTileEntity(x, y, z); @@ -228,11 +228,11 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { int direction = BlockUtil.getDirectionalMetadata(world, x, y, z); if (direction < 0) return false; - boolean placed = world.setBlock(x, y, z, ForestryBlock.pods, direction, Defaults.FLAG_BLOCK_SYNCH); + boolean placed = ForestryBlock.pods.setBlock(world, x, y, z, direction, Defaults.FLAG_BLOCK_SYNCH); if (!placed) return false; - if (world.getBlock(x, y, z) != ForestryBlock.pods) + if (!ForestryBlock.pods.isBlockEqual(world, x, y, z)) return false; TileFruitPod pod = BlockFruitPod.getPodTile(world, x, y, z); @@ -366,7 +366,7 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { if (AlleleManager.alleleRegistry.isBlacklisted(mutation.getAllele1().getUID())) return; - treeMutations.add((ITreeMutation)mutation); + treeMutations.add((ITreeMutation) mutation); } /* ILEAFTICKHANDLER */ @@ -392,5 +392,4 @@ public class TreeHelper extends SpeciesRoot implements ITreeRoot { return EnumTreeChromosome.SPECIES; } - } diff --git a/src/main/java/forestry/arboriculture/items/ItemStairs.java b/src/main/java/forestry/arboriculture/items/ItemStairs.java index 4a0de393c..4c13b1a72 100755 --- a/src/main/java/forestry/arboriculture/items/ItemStairs.java +++ b/src/main/java/forestry/arboriculture/items/ItemStairs.java @@ -21,7 +21,6 @@ import forestry.arboriculture.gadgets.TileStairs; import forestry.core.config.Defaults; import forestry.core.config.ForestryBlock; import forestry.core.items.ItemForestryBlock; -import forestry.core.utils.StringUtil; public class ItemStairs extends ItemForestryBlock { @@ -40,13 +39,13 @@ public class ItemStairs extends ItemForestryBlock { private boolean placeStairs(World world, EntityPlayer player, ItemStack stack, WoodType type, int x, int y, int z, int metadata) { - boolean placed = world.setBlock(x, y, z, ForestryBlock.stairs, metadata, Defaults.FLAG_BLOCK_SYNCH); + boolean placed = ForestryBlock.stairs.setBlock(world, x, y, z, metadata, Defaults.FLAG_BLOCK_SYNCH); if (!placed) return false; Block block = world.getBlock(x, y, z); - if (block != ForestryBlock.stairs) + if (!ForestryBlock.stairs.isBlockEqual(block)) return false; block.onBlockPlacedBy(world, x, y, z, player, stack); @@ -62,14 +61,10 @@ public class ItemStairs extends ItemForestryBlock { return true; } - private String getWoodNameIS(WoodType type) { - return StringUtil.localize("wood." + type.ordinal()); - } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - - WoodType type = WoodType.getFromCompound(itemstack.getTagCompound()); - return StringUtil.localize(getUnlocalizedName() + "." + type.ordinal()); + public String getUnlocalizedName(ItemStack stack) { + WoodType type = WoodType.getFromCompound(stack.getTagCompound()); + return super.getUnlocalizedName(stack) + "." + type.ordinal(); //To change body of generated methods, choose Tools | Templates. } + } diff --git a/src/main/java/forestry/arboriculture/items/ItemWoodBlock.java b/src/main/java/forestry/arboriculture/items/ItemWoodBlock.java index 6d6fa122f..d7b4edb70 100755 --- a/src/main/java/forestry/arboriculture/items/ItemWoodBlock.java +++ b/src/main/java/forestry/arboriculture/items/ItemWoodBlock.java @@ -16,7 +16,6 @@ import net.minecraft.item.ItemStack; import forestry.arboriculture.IWoodTyped; import forestry.arboriculture.WoodType; import forestry.core.items.ItemForestryBlock; -import forestry.core.utils.StringUtil; public class ItemWoodBlock extends ItemForestryBlock { @@ -28,20 +27,16 @@ public class ItemWoodBlock extends ItemForestryBlock { return damage & 3; } - private String getWoodNameIS(WoodType type) { - return StringUtil.localize("wood." + type.ordinal()); - } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { + public String getUnlocalizedName(ItemStack itemstack) { if (this.getBlock() instanceof IWoodTyped) { IWoodTyped block = (IWoodTyped) getBlock(); int meta = itemstack.getItemDamage(); WoodType woodType = block.getWoodType(meta); - return StringUtil.localize("tile." + block.getBlockKind() + "." + woodType.ordinal()); - } else - return StringUtil.localize(getUnlocalizedName(itemstack)); + return "tile.for." + block.getBlockKind() + "." + woodType.ordinal(); + } + return super.getUnlocalizedName(itemstack); } } diff --git a/src/main/java/forestry/arboriculture/proxy/ClientProxyArboriculture.java b/src/main/java/forestry/arboriculture/proxy/ClientProxyArboriculture.java index 1816182bb..32a7954b9 100755 --- a/src/main/java/forestry/arboriculture/proxy/ClientProxyArboriculture.java +++ b/src/main/java/forestry/arboriculture/proxy/ClientProxyArboriculture.java @@ -38,7 +38,7 @@ public class ClientProxyArboriculture extends ProxyArboriculture { RenderingRegistry.registerBlockHandler(new FenceRenderingHandler()); RenderingRegistry.registerBlockHandler(new FruitPodRenderingHandler()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ForestryBlock.stairs), new StairItemRenderer()); + MinecraftForgeClient.registerItemRenderer(ForestryBlock.stairs.item(), new StairItemRenderer()); } @Override diff --git a/src/main/java/forestry/core/CommandForestry.java b/src/main/java/forestry/core/CommandForestry.java index a66ad7dca..cbbab3207 100755 --- a/src/main/java/forestry/core/CommandForestry.java +++ b/src/main/java/forestry/core/CommandForestry.java @@ -53,7 +53,7 @@ public class CommandForestry extends CommandMC { public void processCommand(ICommandSender sender, String[] arguments) { if (arguments.length <= 0) - throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help",this.getCommandUsage(sender))); + throw new WrongUsageException(StringUtil.localize("chat.help",this.getCommandUsage(sender))); if (arguments[0].matches("version")) { commandVersion(sender, arguments); @@ -62,7 +62,7 @@ public class CommandForestry extends CommandMC { commandPlugins(sender, arguments); return; } else if (arguments[0].matches("help")) { - sendChatMessage(sender, StringUtil.localizeAndFormat("chat.command.help.0", this.getCommandName())); + sendChatMessage(sender, StringUtil.localize("chat.command.help.0", this.getCommandName())); sendChatMessage(sender, StringUtil.localize("chat.command.help.1")); sendChatMessage(sender, StringUtil.localize("chat.command.help.2")); sendChatMessage(sender, StringUtil.localize("chat.command.help.3")); @@ -123,7 +123,7 @@ public class CommandForestry extends CommandMC { } if (found == null) - throw new CommandException(StringUtil.localizeAndFormat("chat.plugins.error",arguments[2])); + throw new CommandException(StringUtil.localize("chat.plugins.error",arguments[2])); String entry = "\u00A7c"; if (found.isAvailable()) diff --git a/src/main/java/forestry/core/CreativeTabForestry.java b/src/main/java/forestry/core/CreativeTabForestry.java index f06bb508b..da1cdf867 100755 --- a/src/main/java/forestry/core/CreativeTabForestry.java +++ b/src/main/java/forestry/core/CreativeTabForestry.java @@ -15,9 +15,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.registry.GameData; +import cpw.mods.fml.common.registry.GameRegistry; import forestry.api.core.Tabs; -import forestry.core.utils.StringUtil; +import forestry.core.config.ForestryItem; public class CreativeTabForestry extends CreativeTabs { @@ -37,17 +38,24 @@ public class CreativeTabForestry extends CreativeTabs { @Override public ItemStack getIconItemStack() { + Item iconItem; switch (icon) { case 1: - return new ItemStack(GameData.getItemRegistry().getRaw("Forestry:beeDroneGE")); + iconItem = GameRegistry.findItem("Forestry", "for.beeDroneGE"); + break; case 2: - return new ItemStack(GameData.getItemRegistry().getRaw("Forestry:sapling")); + iconItem = GameRegistry.findItem("Forestry", "for.sapling"); + break; case 3: - return new ItemStack(GameData.getItemRegistry().getRaw("Forestry:butterflyGE")); - case 0: + iconItem = GameRegistry.findItem("Forestry", "for.butterflyGE"); + break; default: - return new ItemStack(GameData.getItemRegistry().getRaw("Forestry:fertilizerCompound")); + iconItem = GameRegistry.findItem("Forestry", "for.fertilizerCompound"); + break; } + if (iconItem == null) + iconItem = ForestryItem.wrench.item(); + return new ItemStack(iconItem); } @Override diff --git a/src/main/java/forestry/core/GameMode.java b/src/main/java/forestry/core/GameMode.java index 27f3bb9ae..eb421fa6b 100755 --- a/src/main/java/forestry/core/GameMode.java +++ b/src/main/java/forestry/core/GameMode.java @@ -52,11 +52,11 @@ public class GameMode implements IGameMode { private final ItemStack recipeCompostOutputWheat = ForestryItem.fertilizerBio.getItemStack(4); private final ItemStack recipeCompostOutputAsh = ForestryItem.fertilizerBio.getItemStack(1); - private final ItemStack recipeHumusOutputFertilizer = new ItemStack(ForestryBlock.soil, 8, 0); - private final ItemStack recipeHumusOutputCompost = new ItemStack(ForestryBlock.soil, 8, 0); + private final ItemStack recipeHumusOutputFertilizer = ForestryBlock.soil.getItemStack(8); + private final ItemStack recipeHumusOutputCompost = ForestryBlock.soil.getItemStack(8); - private final ItemStack recipeBogEarthOutputBucket = new ItemStack(ForestryBlock.soil, 6, 1); - private final ItemStack recipeBogEarthOutputCans = new ItemStack(ForestryBlock.soil, 8, 1); + private final ItemStack recipeBogEarthOutputBucket = ForestryBlock.soil.getItemStack(6, 1); + private final ItemStack recipeBogEarthOutputCans = ForestryBlock.soil.getItemStack(8, 1); private final ItemStack recipeCanOutput = ForestryItem.canEmpty.getItemStack(12); private final ItemStack recipeCapsuleOutput = ForestryItem.waxCapsule.getItemStack(4); @@ -96,7 +96,7 @@ public class GameMode implements IGameMode { initSetting("recipe.output.fertilizer.apatite", recipeFertilizerOutputApatite, "amount of fertilizer yielded by the recipe using apatite."); initSetting("recipe.output.fertilizer.ash", recipeFertilizerOutputAsh, "amount of fertilizer yielded by the recipe using ash."); initSetting("recipe.output.compost.wheat", recipeCompostOutputWheat, "amount of compost yielded by the recipe using wheat."); - initSetting("recipe.output.compost.ash", recipeCompostOutputAsh, "amount of compost yielded by the recipe using ash."); + initSetting("recipe.output.compost.ash", recipeCompostOutputAsh, "amount of compost yielded by the recipe using ash."); initSetting("recipe.output.humus.fertilizer", recipeHumusOutputFertilizer, "amount of humus yielded by the recipe using fertilizer."); initSetting("recipe.output.humus.compost", recipeHumusOutputCompost, "amount of humus yielded by the recipe using compost."); initSetting("recipe.output.bogearth.bucket", recipeBogEarthOutputBucket, "amount of bog earth yielded by the recipe using buckets."); @@ -137,7 +137,7 @@ public class GameMode implements IGameMode { private void initSetting(String ident, int def, int max, String comment) { Property property = Config.config.get(ident, category, def); - if(max < 0) { + if (max < 0) { property.Comment = comment; integerSettings.put(ident, Integer.parseInt(property.Value)); } else { @@ -150,7 +150,7 @@ public class GameMode implements IGameMode { private void initSetting(String ident, float def, float max, String comment) { Property property = Config.config.get(ident, category, def); - if(max < 0) { + if (max < 0) { property.Comment = comment; floatSettings.put(ident, Float.parseFloat(property.Value)); } else { @@ -169,7 +169,7 @@ public class GameMode implements IGameMode { @Override public int getIntegerSetting(String ident) { - if(integerSettings.containsKey(ident)) + if (integerSettings.containsKey(ident)) return integerSettings.get(ident); Proxies.log.warning("No such setting: " + ident); return -1; @@ -177,7 +177,7 @@ public class GameMode implements IGameMode { @Override public float getFloatSetting(String ident) { - if(floatSettings.containsKey(ident)) + if (floatSettings.containsKey(ident)) return floatSettings.get(ident); Proxies.log.warning("No such setting: " + ident); return 1; @@ -185,7 +185,7 @@ public class GameMode implements IGameMode { @Override public boolean getBooleanSetting(String ident) { - if(booleanSettings.containsKey(ident)) + if (booleanSettings.containsKey(ident)) return booleanSettings.get(ident); Proxies.log.warning("No such setting: " + ident); return false; @@ -193,7 +193,7 @@ public class GameMode implements IGameMode { @Override public ItemStack getStackSetting(String ident) { - if(stackSettings.containsKey(ident)) + if (stackSettings.containsKey(ident)) return stackSettings.get(ident); Proxies.log.warning("No such setting: " + ident); return new ItemStack(Items.apple, 1); diff --git a/src/main/java/forestry/core/WorldGenerator.java b/src/main/java/forestry/core/WorldGenerator.java index ca2714f7e..7a15cf3e3 100755 --- a/src/main/java/forestry/core/WorldGenerator.java +++ b/src/main/java/forestry/core/WorldGenerator.java @@ -35,7 +35,7 @@ public class WorldGenerator implements IWorldGenerator { public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { if (apatiteGenerator == null) { - apatiteGenerator = new WorldGenMinableMeta(ForestryBlock.resources, 0, 36); + apatiteGenerator = new WorldGenMinableMeta(ForestryBlock.resources.block(), 0, 36); copperGenerator = new WorldGenMinableMeta(ForestryBlock.resources, 1, 6); tinGenerator = new WorldGenMinableMeta(ForestryBlock.resources, 2, 6); } diff --git a/src/main/java/forestry/core/circuits/ItemCircuitBoard.java b/src/main/java/forestry/core/circuits/ItemCircuitBoard.java index 255190914..ed487c475 100755 --- a/src/main/java/forestry/core/circuits/ItemCircuitBoard.java +++ b/src/main/java/forestry/core/circuits/ItemCircuitBoard.java @@ -13,40 +13,33 @@ package forestry.core.circuits; import java.util.List; import java.util.Locale; -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.nbt.NBTTagCompound; -import net.minecraft.util.IIcon; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import forestry.api.circuits.ChipsetManager; import forestry.api.circuits.ICircuit; import forestry.api.circuits.ICircuitBoard; import forestry.api.circuits.ICircuitLayout; import forestry.core.config.ForestryItem; -import forestry.core.items.ItemForestry; -import forestry.core.render.TextureManager; -import forestry.core.utils.StringUtil; +import forestry.core.items.ItemForestryMultiPass; -public class ItemCircuitBoard extends ItemForestry { +public class ItemCircuitBoard extends ItemForestryMultiPass { public ItemCircuitBoard() { super(); setHasSubtypes(true); } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { - itemList.add(createCircuitboard(EnumCircuitBoardType.BASIC, null, new ICircuit[] {})); - itemList.add(createCircuitboard(EnumCircuitBoardType.ENHANCED, null, new ICircuit[] {})); - itemList.add(createCircuitboard(EnumCircuitBoardType.REFINED, null, new ICircuit[] {})); - itemList.add(createCircuitboard(EnumCircuitBoardType.INTRICATE, null, new ICircuit[] {})); + itemList.add(createCircuitboard(EnumCircuitBoardType.BASIC, null, new ICircuit[]{})); + itemList.add(createCircuitboard(EnumCircuitBoardType.ENHANCED, null, new ICircuit[]{})); + itemList.add(createCircuitboard(EnumCircuitBoardType.REFINED, null, new ICircuit[]{})); + itemList.add(createCircuitboard(EnumCircuitBoardType.INTRICATE, null, new ICircuit[]{})); } /** @@ -57,48 +50,22 @@ public class ItemCircuitBoard extends ItemForestry { return true; } - /* ICONS */ - @SideOnly(Side.CLIENT) - private IIcon[] icons; - - @SideOnly(Side.CLIENT) @Override - public void registerIcons(IIconRegister register) { - icons = new IIcon[2]; - icons[0] = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "") + ".0"); - icons[1] = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "") + ".1"); - } - - @SideOnly(Side.CLIENT) - @Override - public IIcon getIconFromDamageForRenderPass(int i, int j) { - if (j > 0) - return icons[0]; - else - return icons[1]; - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } - - @Override - public int getColorFromItemStack(ItemStack itemstack, int j) { + public int getColorFromItemStack(ItemStack itemstack, int pass) { EnumCircuitBoardType type = EnumCircuitBoardType.values()[itemstack.getItemDamage()]; - if (j == 0) + if (pass == 0) return type.primaryColor; else return type.secondaryColor; } @Override - public String getItemStackDisplayName(ItemStack itemstack) { - EnumCircuitBoardType type = EnumCircuitBoardType.values()[itemstack.getItemDamage()]; - return StringUtil.localize("item.circuitboard." + type.toString().toLowerCase(Locale.ENGLISH)); + public String getUnlocalizedName(ItemStack stack) { + EnumCircuitBoardType type = EnumCircuitBoardType.values()[stack.getItemDamage()]; + return "item.circuitboard." + type.toString().toLowerCase(Locale.ENGLISH); } - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings({"unchecked", "rawtypes"}) @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) { ICircuitBoard circuitboard = ChipsetManager.circuitRegistry.getCircuitboard(itemstack); diff --git a/src/main/java/forestry/core/config/ForestryBlock.java b/src/main/java/forestry/core/config/ForestryBlock.java index cfa8a79af..95448b27f 100755 --- a/src/main/java/forestry/core/config/ForestryBlock.java +++ b/src/main/java/forestry/core/config/ForestryBlock.java @@ -10,9 +10,13 @@ ******************************************************************************/ package forestry.core.config; +import forestry.core.proxy.Proxies; import net.minecraft.block.Block; - -import forestry.core.gadgets.BlockBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.oredict.OreDictionary; /** * Allows direct access to Forestry's blocks. Will be populated during BaseMod.load(). @@ -24,61 +28,101 @@ import forestry.core.gadgets.BlockBase; * @author SirSengir * */ -public class ForestryBlock { +public enum ForestryBlock { /** * 0 - Humus 1 - Bog Earth */ - public static Block soil; + soil, /** * 0 - Apatite Ore 1 - Copper Ore 2 - Tin Ore */ - public static Block resources; + resources, /** * 0 - Legacy 1 - Forest Hive 2 - Meadows Hive */ - public static Block beehives; + beehives, + mushroom, + candle, + stump, + glass, + planks1, + planks2, + slabs1, + slabs2, + slabs3, + slabs4, + log1, + log2, + log3, + log4, + log5, + log6, + log7, + log8, + fences1, + fences2, + stairs, + saplingGE, + leaves, + pods, + arboriculture, + alveary, + farm, + core, + apiculture, + mail, + engine, + factoryTESR, + factoryPlain, + lepidopterology; + private Block block; - public static Block mushroom; - public static Block candle; - public static Block stump; - public static Block glass; + public void registerBlock(Block block, Class itemClass, String name) { + this.block = block; + block.setBlockName("for." + name); + Proxies.common.registerBlock(block, itemClass); + } - public static Block planks1; - public static Block planks2; - public static Block slabs1; - public static Block slabs2; - public static Block slabs3; - public static Block slabs4; - public static Block log1; - public static Block log2; - public static Block log3; - public static Block log4; - public static Block log5; - public static Block log6; - public static Block log7; - public static Block log8; + public boolean isItemEqual(ItemStack stack) { + return stack != null && isBlockEqual(Block.getBlockFromItem(stack.getItem())); + } - public static Block fences1; - public static Block fences2; - public static Block stairs; + public boolean isBlockEqual(Block i) { + return i != null && Block.isEqualTo(block, i); + } - public static Block saplingGE; - public static Block leaves; - public static Block pods; + public boolean isBlockEqual(World world, int x, int y, int z) { + return isBlockEqual(world.getBlock(x, y, z)); + } + + public Item item(){ + return Item.getItemFromBlock(block); + } - public static BlockBase arboriculture; + public Block block() { + return block; + } - public static Block alveary; - public static Block farm; + public ItemStack getWildcard() { + return getItemStack(1, OreDictionary.WILDCARD_VALUE); + } - public static BlockBase core; - public static BlockBase apiculture; - public static BlockBase mail; + public ItemStack getItemStack() { + return getItemStack(1, 0); + } - public static BlockBase engine; - public static BlockBase factoryTESR; - public static BlockBase factoryPlain; + public ItemStack getItemStack(int qty) { + return getItemStack(qty, 0); + } - public static BlockBase lepidopterology; + public ItemStack getItemStack(int qty, int meta) { + if (block == null) + return null; + return new ItemStack(block, qty, meta); + } + + public boolean setBlock(World world, int x, int y, int z, int meta, int flag) { + return world.setBlock(x, y, z, block, meta, flag); + } } diff --git a/src/main/java/forestry/core/config/ForestryItem.java b/src/main/java/forestry/core/config/ForestryItem.java index 8c454f460..91fd29ad5 100755 --- a/src/main/java/forestry/core/config/ForestryItem.java +++ b/src/main/java/forestry/core/config/ForestryItem.java @@ -14,6 +14,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import forestry.core.proxy.Proxies; +import net.minecraftforge.oredict.OreDictionary; /** * Allows direct access to Forestry's items. Will be populated during @@ -248,7 +249,7 @@ public enum ForestryItem { public void registerItem(Item item, String name) { this.item = item; - item.setUnlocalizedName(name); + item.setUnlocalizedName("for." + name); Proxies.common.registerItem(item); } @@ -264,6 +265,10 @@ public enum ForestryItem { return item; } + public ItemStack getWildcard() { + return getItemStack(1, OreDictionary.WILDCARD_VALUE); + } + public ItemStack getItemStack() { return getItemStack(1, 0); } diff --git a/src/main/java/forestry/core/gadgets/BlockSoil.java b/src/main/java/forestry/core/gadgets/BlockSoil.java index 737529cf8..3eecb210f 100755 --- a/src/main/java/forestry/core/gadgets/BlockSoil.java +++ b/src/main/java/forestry/core/gadgets/BlockSoil.java @@ -124,7 +124,7 @@ public class BlockSoil extends Block { for (int i = -1; i < 2; i++) for (int j = -1; j < 2; j++) { Block block = world.getBlock(x + i, y + 1, z + j); - if (block == Blocks.log || block == Blocks.sapling || block == ForestryBlock.saplingGE) + if (block == Blocks.log || block == Blocks.sapling || block == ForestryBlock.saplingGE.block()) // We are not returning true if we are the base of a // sapling. if (i == 0 && j == 0) diff --git a/src/main/java/forestry/core/gadgets/TileMachine.java b/src/main/java/forestry/core/gadgets/TileMachine.java index 4b1a59ef9..3b0fb6e24 100755 --- a/src/main/java/forestry/core/gadgets/TileMachine.java +++ b/src/main/java/forestry/core/gadgets/TileMachine.java @@ -154,7 +154,7 @@ public class TileMachine extends TileForestry implements ISpecialInventory, ICli machineMap.put(Defaults.ID_PACKAGE_MACHINE_STILL, PluginFactory.definitionStill); machineMap.put(Defaults.ID_PACKAGE_MACHINE_APIARY, PluginApiculture.definitionApiary); machineMap.put(4, PluginEnergy.definitionGenerator); - definitionMap.put(ForestryBlock.factoryTESR, machineMap); + definitionMap.put(ForestryBlock.factoryTESR.block(), machineMap); HashMap millMap = new HashMap(); millMap.put(Defaults.ID_PACKAGE_MILL_MAILBOX, PluginMail.definitionMailbox); @@ -163,13 +163,13 @@ public class TileMachine extends TileForestry implements ISpecialInventory, ICli millMap.put(Defaults.ID_PACKAGE_MILL_APIARIST_CHEST, PluginApiculture.definitionChest); millMap.put(Defaults.ID_PACKAGE_MILL_ANALYZER, PluginCore.definitionAnalyzer); millMap.put(Defaults.ID_PACKAGE_MILL_RAINMAKER, PluginFactory.definitionRainmaker); - definitionMap.put(ForestryBlock.factoryPlain, millMap); + definitionMap.put(ForestryBlock.factoryPlain.block(), millMap); HashMap engineMap = new HashMap(); engineMap.put(0, PluginEnergy.definitionEngineBronze); engineMap.put(1, PluginEnergy.definitionEngineCopper); engineMap.put(2, PluginEnergy.definitionEngineTin); - definitionMap.put(ForestryBlock.engine, engineMap); + definitionMap.put(ForestryBlock.engine.block(), engineMap); } diff --git a/src/main/java/forestry/core/genetics/ItemResearchNote.java b/src/main/java/forestry/core/genetics/ItemResearchNote.java index 331c38f23..be78da7a1 100755 --- a/src/main/java/forestry/core/genetics/ItemResearchNote.java +++ b/src/main/java/forestry/core/genetics/ItemResearchNote.java @@ -233,7 +233,7 @@ public class ItemResearchNote extends ItemForestry { @Override public String getItemStackDisplayName(ItemStack itemstack) { ResearchNote note = new ResearchNote(itemstack.getTagCompound()); - return StringUtil.localizeAndFormat("item.research.note", note.researcher); + return StringUtil.localize(getUnlocalizedName(itemstack) + ".name", note.researcher); } @SuppressWarnings("rawtypes") diff --git a/src/main/java/forestry/core/items/ItemArmorNaturalist.java b/src/main/java/forestry/core/items/ItemArmorNaturalist.java index c143ca502..0c0d1cf51 100755 --- a/src/main/java/forestry/core/items/ItemArmorNaturalist.java +++ b/src/main/java/forestry/core/items/ItemArmorNaturalist.java @@ -38,15 +38,10 @@ public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist { return Defaults.ID + ":" + Defaults.TEXTURE_NATURALIST_ARMOR_PRIMARY; } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - return StringUtil.localize(getUnlocalizedName(itemstack)); - } - @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister register) { - itemIcon = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "")); + itemIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this)); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/forestry/core/items/ItemCrated.java b/src/main/java/forestry/core/items/ItemCrated.java index d3ca31ffa..d244a7935 100755 --- a/src/main/java/forestry/core/items/ItemCrated.java +++ b/src/main/java/forestry/core/items/ItemCrated.java @@ -81,18 +81,18 @@ public class ItemCrated extends Item implements IGenericCrate { return itemstack; } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - if (contained != null) - return StringUtil.localize("item.crated.adj") + " " + Proxies.common.getDisplayName(contained); - else - return StringUtil.localize("item.crated.unknown"); - } +// @Override +// public String getItemStackDisplayName(ItemStack itemstack) { +// if (contained != null) +// return StringUtil.localize("item.crated.adj") + " " + Proxies.common.getDisplayName(contained); +// else +// return StringUtil.localize("item.crated.unknown"); +// } @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister register) { - itemIcon = TextureManager.getInstance().registerTex(register, "crates/" + getUnlocalizedName().replace("item.crated", "").toLowerCase(Locale.ENGLISH)); + itemIcon = TextureManager.getInstance().registerTex(register, "crates/" + getUnlocalizedName().replace("item.for.crated", "").toLowerCase(Locale.ENGLISH)); } } diff --git a/src/main/java/forestry/core/items/ItemForestry.java b/src/main/java/forestry/core/items/ItemForestry.java index e2920a2a8..86720698b 100755 --- a/src/main/java/forestry/core/items/ItemForestry.java +++ b/src/main/java/forestry/core/items/ItemForestry.java @@ -30,8 +30,6 @@ public class ItemForestry extends Item { private boolean isBonemeal = false; public ItemForestry() { - super(); - maxStackSize = 64; setCreativeTab(CreativeTabForestry.tabForestry); } @@ -53,14 +51,9 @@ public class ItemForestry extends Item { return super.onItemUse(itemstack, player, world, x, y, z, par7, par8, par9, par10); } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - return StringUtil.localize(getUnlocalizedName(itemstack)); - } - @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister register) { - itemIcon = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "")); + itemIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this)); } } diff --git a/src/main/java/forestry/core/items/ItemForestryBlock.java b/src/main/java/forestry/core/items/ItemForestryBlock.java index 361658459..1a003bf76 100755 --- a/src/main/java/forestry/core/items/ItemForestryBlock.java +++ b/src/main/java/forestry/core/items/ItemForestryBlock.java @@ -14,11 +14,8 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import forestry.core.utils.StringUtil; - public class ItemForestryBlock extends ItemBlock { - public ItemForestryBlock(Block block) { super(block); setMaxDamage(0); @@ -34,11 +31,6 @@ public class ItemForestryBlock extends ItemBlock { return field_150939_a; } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - return StringUtil.localize(getUnlocalizedName(itemstack)); - } - @Override public String getUnlocalizedName(ItemStack itemstack) { return getBlock().getUnlocalizedName() + "." + itemstack.getItemDamage(); diff --git a/src/main/java/forestry/core/items/ItemForestryFood.java b/src/main/java/forestry/core/items/ItemForestryFood.java index 0f6cc47f2..d55d353ab 100755 --- a/src/main/java/forestry/core/items/ItemForestryFood.java +++ b/src/main/java/forestry/core/items/ItemForestryFood.java @@ -10,22 +10,16 @@ ******************************************************************************/ package forestry.core.items; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import forestry.core.CreativeTabForestry; -import forestry.core.render.TextureManager; -import forestry.core.utils.StringUtil; -public class ItemForestryFood extends Item { +public class ItemForestryFood extends ItemForestry { private boolean isAlwaysEdible = false; private boolean isDrink = false; @@ -98,15 +92,4 @@ public class ItemForestryFood extends Item { return this; } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - return StringUtil.localize(getUnlocalizedName(itemstack)); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IIconRegister register) { - itemIcon = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "")); - } - } diff --git a/src/main/java/forestry/core/items/ItemForestryMultiPass.java b/src/main/java/forestry/core/items/ItemForestryMultiPass.java new file mode 100644 index 000000000..5b8d28cae --- /dev/null +++ b/src/main/java/forestry/core/items/ItemForestryMultiPass.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 SirSengir. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the GNU Lesser Public License v3 + * which accompanies this distribution, and is available at + * http://www.gnu.org/licenses/lgpl-3.0.txt + * + * Various Contributors including, but not limited to: + * SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges + ******************************************************************************/ +package forestry.core.items; + +import net.minecraft.client.renderer.texture.IIconRegister; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import forestry.core.render.TextureManager; +import forestry.core.utils.StringUtil; +import net.minecraft.util.IIcon; + +public class ItemForestryMultiPass extends ItemForestry { + + /* ICONS */ + @SideOnly(Side.CLIENT) + private IIcon[] icons; + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister register) { + icons = new IIcon[2]; + icons[0] = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this) + ".0"); + icons[1] = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this) + ".1"); + } + + @SideOnly(Side.CLIENT) + @Override + public IIcon getIconFromDamageForRenderPass(int i, int pass) { + if (pass > 0) + return icons[0]; + else + return icons[1]; + } + @Override + public boolean requiresMultipleRenderPasses() { + return true; + } +} diff --git a/src/main/java/forestry/core/items/ItemForestryPickaxe.java b/src/main/java/forestry/core/items/ItemForestryPickaxe.java index 093733698..992bb7ca9 100755 --- a/src/main/java/forestry/core/items/ItemForestryPickaxe.java +++ b/src/main/java/forestry/core/items/ItemForestryPickaxe.java @@ -18,13 +18,13 @@ import forestry.core.config.ForestryBlock; public class ItemForestryPickaxe extends ItemForestryTool { - private static Block blocksEffectiveAgainst[]; + private static final Block blocksEffectiveAgainst[]; static { blocksEffectiveAgainst = (new Block[] { Blocks.cobblestone, Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, Blocks.iron_block, Blocks.coal_ore, Blocks.gold_block, Blocks.brick_block, Blocks.nether_brick, Blocks.netherrack, Blocks.gold_ore, Blocks.diamond_ore, Blocks.diamond_block, - Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, ForestryBlock.resources, ForestryBlock.beehives, ForestryBlock.engine, - ForestryBlock.factoryTESR, ForestryBlock.factoryPlain }); + Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, ForestryBlock.resources.block(), ForestryBlock.beehives.block(), ForestryBlock.engine.block(), + ForestryBlock.factoryTESR.block(), ForestryBlock.factoryPlain.block() }); } public ItemForestryPickaxe(ItemStack remnants) { diff --git a/src/main/java/forestry/core/items/ItemForestryShovel.java b/src/main/java/forestry/core/items/ItemForestryShovel.java index f5a3205cc..e0076734f 100755 --- a/src/main/java/forestry/core/items/ItemForestryShovel.java +++ b/src/main/java/forestry/core/items/ItemForestryShovel.java @@ -18,11 +18,11 @@ import forestry.core.config.ForestryBlock; public class ItemForestryShovel extends ItemForestryTool { - private static Block blocksEffectiveAgainst[]; + private static final Block blocksEffectiveAgainst[]; static { blocksEffectiveAgainst = (new Block[] { Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, - Blocks.farmland, ForestryBlock.soil }); + Blocks.farmland, ForestryBlock.soil.block() }); } public ItemForestryShovel( ItemStack remnants) { diff --git a/src/main/java/forestry/core/items/ItemFruit.java b/src/main/java/forestry/core/items/ItemFruit.java index f8c2682c8..6948c9c1f 100755 --- a/src/main/java/forestry/core/items/ItemFruit.java +++ b/src/main/java/forestry/core/items/ItemFruit.java @@ -25,12 +25,12 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraftforge.oredict.OreDictionary; import forestry.core.render.TextureManager; -import forestry.core.utils.StringUtil; public class ItemFruit extends ItemForestryFood { public static enum EnumFruit { CHERRY("cropCherry"), WALNUT("cropWalnut"), CHESTNUT("cropChestnut"), LEMON("cropLemon"), PLUM("cropPlum"), DATES("cropDate"), PAPAYA("cropPapaya");//, COCONUT("cropCoconut"); + public static final EnumFruit[] VALUES = values(); final String oreDict; @@ -41,9 +41,9 @@ public class ItemFruit extends ItemForestryFood { private static IIcon[] icons; public static void registerIcons(IIconRegister register) { - icons = new IIcon[values().length]; - for (int i = 0; i < values().length; i++) - icons[i] = TextureManager.getInstance().registerTex(register, "fruits/" + values()[i].toString().toLowerCase(Locale.ENGLISH)); + icons = new IIcon[VALUES.length]; + for (int i = 0; i < VALUES.length; i++) + icons[i] = TextureManager.getInstance().registerTex(register, "fruits/" + VALUES[i].toString().toLowerCase(Locale.ENGLISH)); } public IIcon getIcon() { @@ -93,11 +93,11 @@ public class ItemFruit extends ItemForestryFood { } @Override - public String getItemStackDisplayName(ItemStack itemstack) { - if (itemstack.getItemDamage() < 0 || itemstack.getItemDamage() >= EnumFruit.values().length) + public String getUnlocalizedName(ItemStack stack) { + if (stack.getItemDamage() < 0 || stack.getItemDamage() >= EnumFruit.VALUES.length) return null; - return StringUtil.localize("item.fruit." + EnumFruit.values()[itemstack.getItemDamage()].toString().toLowerCase(Locale.ENGLISH)); + return super.getUnlocalizedName(stack) + "." + EnumFruit.VALUES[stack.getItemDamage()].name().toLowerCase(Locale.ENGLISH); } } diff --git a/src/main/java/forestry/core/items/ItemLiquidContainer.java b/src/main/java/forestry/core/items/ItemLiquidContainer.java index f1becf440..13daafd56 100755 --- a/src/main/java/forestry/core/items/ItemLiquidContainer.java +++ b/src/main/java/forestry/core/items/ItemLiquidContainer.java @@ -39,6 +39,7 @@ import forestry.core.utils.StringUtil; public class ItemLiquidContainer extends Item { public static enum EnumContainerType { + GLASS, JAR, CAN, CAPSULE, REFRACTORY } @@ -133,11 +134,11 @@ public class ItemLiquidContainer extends Item { Block targetedBlock = world.getBlock(i, j, k); //int targetedMeta = world.getBlockMetadata(i, j, k); - if(!(targetedBlock instanceof IFluidBlock)) + if (!(targetedBlock instanceof IFluidBlock)) return itemstack; IFluidBlock fluidBlock = (IFluidBlock) targetedBlock; FluidStack drainable = fluidBlock.drain(world, i, j, k, false); - if(drainable == null || drainable.amount <= 0) + if (drainable == null || drainable.amount <= 0) return itemstack; // Check whether there is valid container for the liquid. @@ -190,17 +191,11 @@ public class ItemLiquidContainer extends Item { * public ItemLiquidContainer setPotionEffect(int i, int j, int k, float f) { potionId = i; potionDuration = j; potionAmplifier = k; potionEffectProbability * = f; return this; } */ - public ItemLiquidContainer setAlwaysEdible() { isAlwaysEdible = true; return this; } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - return StringUtil.localize(getUnlocalizedName(itemstack)); - } - /* ICONS */ @SideOnly(Side.CLIENT) private IIcon[] icons; @@ -235,5 +230,4 @@ public class ItemLiquidContainer extends Item { else return 0xffffff; } - } diff --git a/src/main/java/forestry/core/items/ItemMisc.java b/src/main/java/forestry/core/items/ItemMisc.java index 4d6f7f3b7..15d3b546b 100755 --- a/src/main/java/forestry/core/items/ItemMisc.java +++ b/src/main/java/forestry/core/items/ItemMisc.java @@ -22,11 +22,11 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import forestry.core.render.TextureManager; -import forestry.core.utils.StringUtil; +import java.util.Locale; public class ItemMisc extends ItemForestry { - String[] definition = new String[] { "pulsatingDust", "pulsatingMesh", "silkWisp", "wovenSilk", "dissipationCharge", "iceShard", "scentedPaneling" }; + String[] definition = new String[]{"pulsatingDust", "pulsatingMesh", "silkWisp", "wovenSilk", "dissipationCharge", "iceShard", "scentedPaneling"}; public ItemMisc() { super(); @@ -45,11 +45,11 @@ public class ItemMisc extends ItemForestry { } @Override - public String getItemStackDisplayName(ItemStack itemstack) { - if (itemstack.getItemDamage() >= definition.length || itemstack.getItemDamage() < 0) - return StringUtil.localize("item.unknown"); + public String getUnlocalizedName(ItemStack stack) { + if (stack.getItemDamage() >= definition.length || stack.getItemDamage() < 0) + return "item.forestry.unknown"; else - return StringUtil.localize("item." + definition[itemstack.getItemDamage()]); + return super.getUnlocalizedName(stack) + "." + definition[stack.getItemDamage()].toLowerCase(Locale.ENGLISH); } /* ICONS */ @@ -74,7 +74,7 @@ public class ItemMisc extends ItemForestry { return icons[damage]; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { for (int i = 0; i < 7; i++) diff --git a/src/main/java/forestry/core/items/ItemOverlay.java b/src/main/java/forestry/core/items/ItemOverlay.java index 657de210d..b5d233f7c 100755 --- a/src/main/java/forestry/core/items/ItemOverlay.java +++ b/src/main/java/forestry/core/items/ItemOverlay.java @@ -71,7 +71,7 @@ public class ItemOverlay extends ItemForestry { return false; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { for (int i = 0; i < overlays.length; i++) @@ -88,9 +88,9 @@ public class ItemOverlay extends ItemForestry { @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister register) { - primaryIcon = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "") + ".0"); - if(overlays[0].secondaryColor != 0) - secondaryIcon = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "") + ".1"); + primaryIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this) + ".0"); + if (overlays[0].secondaryColor != 0) + secondaryIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this) + ".1"); } @Override @@ -113,11 +113,11 @@ public class ItemOverlay extends ItemForestry { } @Override - public String getItemStackDisplayName(ItemStack itemstack) { - if (itemstack.getItemDamage() < 0 || itemstack.getItemDamage() >= overlays.length) + public String getUnlocalizedName(ItemStack stack) { + if (stack.getItemDamage() < 0 || stack.getItemDamage() >= overlays.length) return null; - return StringUtil.localize(getUnlocalizedName() + "." + overlays[itemstack.getItemDamage()].name); + return super.getUnlocalizedName(stack) + "." + overlays[stack.getItemDamage()].name; } @Override diff --git a/src/main/java/forestry/core/items/ItemPipette.java b/src/main/java/forestry/core/items/ItemPipette.java index 32e0edfd0..473b0bacc 100755 --- a/src/main/java/forestry/core/items/ItemPipette.java +++ b/src/main/java/forestry/core/items/ItemPipette.java @@ -28,6 +28,7 @@ import forestry.api.core.IToolPipette; import forestry.core.config.Config; import forestry.core.config.Defaults; import forestry.core.render.TextureManager; +import forestry.core.utils.StringUtil; public class ItemPipette extends ItemForestry implements IToolPipette { @@ -134,7 +135,7 @@ public class ItemPipette extends ItemForestry implements IToolPipette { return filled; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) { PipetteContents contained = new PipetteContents(itemstack.getTagCompound()); @@ -150,14 +151,13 @@ public class ItemPipette extends ItemForestry implements IToolPipette { @SideOnly(Side.CLIENT) @Override public void registerIcons(IIconRegister register) { - primaryIcon = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "") + ".0"); - secondaryIcon = TextureManager.getInstance().registerTex(register, getUnlocalizedName().replace("item.", "") + ".1"); + primaryIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this) + ".0"); + secondaryIcon = TextureManager.getInstance().registerTex(register, StringUtil.cleanItemName(this) + ".1"); } @SideOnly(Side.CLIENT) @Override public IIcon getIconFromDamage(int damage) { - if (damage <= 0) return primaryIcon; else diff --git a/src/main/java/forestry/core/proxy/ProxyCommon.java b/src/main/java/forestry/core/proxy/ProxyCommon.java index d7273c208..524b5af2e 100755 --- a/src/main/java/forestry/core/proxy/ProxyCommon.java +++ b/src/main/java/forestry/core/proxy/ProxyCommon.java @@ -38,6 +38,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; import forestry.Forestry; import forestry.core.TickHandlerCoreServer; import forestry.core.config.Defaults; +import forestry.core.config.ForestryBlock; import forestry.core.config.ForestryItem; import forestry.core.network.PacketCoordinates; import forestry.core.network.PacketFXSignal; @@ -97,11 +98,11 @@ public class ProxyCommon { } private void cleanRecipe(Object... obj) { - for (int i = 0; i < obj.length; i++) { - if (obj[i] instanceof ForestryItem) { + for (int i = 0; i < obj.length; i++) + if (obj[i] instanceof ForestryItem) obj[i] = ((ForestryItem) obj[i]).item(); - } - } + else if (obj[i] instanceof ForestryBlock) + obj[i] = ((ForestryBlock) obj[i]).block(); } public void addSmelting(ItemStack res, ItemStack prod) { diff --git a/src/main/java/forestry/core/utils/StringUtil.java b/src/main/java/forestry/core/utils/StringUtil.java index 35d79fb48..f015e51bc 100755 --- a/src/main/java/forestry/core/utils/StringUtil.java +++ b/src/main/java/forestry/core/utils/StringUtil.java @@ -10,16 +10,42 @@ ******************************************************************************/ package forestry.core.utils; +import java.util.IllegalFormatException; +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; public class StringUtil { public static String localize(String key) { - return StatCollector.translateToLocal(key); + return StatCollector.translateToLocal(key).replace("\\n", "\n").replace("@", "%").replace("\\%", "@"); } - public static String localizeAndFormat(String key, Object... args) { - return StatCollector.translateToLocalFormatted(key, args); + public static String localize(String key, Object... args) { + String text = StringUtil.localize(key); + + try { + return String.format(text, args); + } catch (IllegalFormatException ex) { + return "Format error: " + text; + } + } + + public static String cleanTags(String tag) { + return tag.replaceAll("[Ff]orestry\\p{Punct}", "").replaceAll("\\.[Ff]or\\p{Punct}", ".").replaceFirst("^tile\\.", "").replaceFirst("^item\\.", ""); + } + + public static String cleanItemName(ItemStack stack) { + return cleanTags(stack.getUnlocalizedName()); + } + + public static String cleanItemName(Item item) { + return cleanTags(item.getUnlocalizedName()); + } + + public static String cleanBlockName(Block block) { + return cleanTags(block.getUnlocalizedName()); } public static String capitalize(String s) { diff --git a/src/main/java/forestry/core/worldgen/BlockType.java b/src/main/java/forestry/core/worldgen/BlockType.java index 2bcd3097a..3b08bfe27 100755 --- a/src/main/java/forestry/core/worldgen/BlockType.java +++ b/src/main/java/forestry/core/worldgen/BlockType.java @@ -15,6 +15,7 @@ import net.minecraft.world.World; import forestry.api.world.ITreeGenData; import forestry.core.config.Defaults; +import forestry.core.config.ForestryBlock; public class BlockType { @@ -26,6 +27,11 @@ public class BlockType { this.meta = meta; } + public BlockType(ForestryBlock block, int meta) { + this.block = block.block(); + this.meta = meta; + } + public void setBlock(World world, ITreeGenData tree, int x, int y, int z) { world.setBlock(x, y, z, block, meta, Defaults.FLAG_BLOCK_SYNCH); if (world.getTileEntity(x, y, z) != null) diff --git a/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java b/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java index f4fa7792f..810e499f4 100755 --- a/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java +++ b/src/main/java/forestry/core/worldgen/WorldGenMinableMeta.java @@ -19,6 +19,7 @@ import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; import forestry.core.config.Defaults; +import forestry.core.config.ForestryBlock; public class WorldGenMinableMeta extends WorldGenerator { @@ -32,6 +33,10 @@ public class WorldGenMinableMeta extends WorldGenerator { this.numberOfBlocks = numberOfBlocks; } + public WorldGenMinableMeta(ForestryBlock block, int meta, int numberOfBlocks) { + this(block.block(), meta, numberOfBlocks); + } + @Override public boolean generate(World world, Random random, int i, int j, int k) { diff --git a/src/main/java/forestry/factory/recipes/CraftGuideBottler.java b/src/main/java/forestry/factory/recipes/CraftGuideBottler.java index 9679a4126..1ebd2b4ad 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideBottler.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideBottler.java @@ -41,7 +41,7 @@ public class CraftGuideBottler implements RecipeProvider { if (ForestryBlock.factoryTESR == null) return; - ItemStack machine = new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_BOTTLER_META); + ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_BOTTLER_META); RecipeTemplate template = generator.createRecipeTemplate(slots, machine); for (MachineBottler.Recipe recipe : MachineBottler.RecipeManager.recipes) { diff --git a/src/main/java/forestry/factory/recipes/CraftGuideCarpenter.java b/src/main/java/forestry/factory/recipes/CraftGuideCarpenter.java index 8632f52d9..6998c69f1 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideCarpenter.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideCarpenter.java @@ -44,7 +44,7 @@ public class CraftGuideCarpenter implements RecipeProvider { if (ForestryBlock.factoryTESR == null) return; - ItemStack machine = new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_CARPENTER_META); + ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_CARPENTER_META); RecipeTemplate template = generator.createRecipeTemplate(slots, machine); for (MachineCarpenter.Recipe recipe : MachineCarpenter.RecipeManager.recipes) { diff --git a/src/main/java/forestry/factory/recipes/CraftGuideCentrifuge.java b/src/main/java/forestry/factory/recipes/CraftGuideCentrifuge.java index 04b85cca2..ed87d1f34 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideCentrifuge.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideCentrifuge.java @@ -44,7 +44,7 @@ public class CraftGuideCentrifuge implements RecipeProvider { if (ForestryBlock.factoryTESR == null) return; - ItemStack machine = new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_CENTRIFUGE_META); + ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_CENTRIFUGE_META); RecipeTemplate template = generator.createRecipeTemplate(slots, machine); for (MachineCentrifuge.Recipe recipe : MachineCentrifuge.RecipeManager.recipes) { @@ -52,9 +52,8 @@ public class CraftGuideCentrifuge implements RecipeProvider { @SuppressWarnings("unchecked") Entry[] entries = recipe.products.entrySet().toArray(new Entry[0]); - for (int i = 0; i < Math.min(entries.length, 9); i++) { - array[i] = entries[i].getValue() > 0 ? new Object[] { entries[i].getKey(), entries[i].getValue() } : null; - } + for (int i = 0; i < Math.min(entries.length, 9); i++) + array[i] = entries[i].getValue() > 0 ? new Object[]{entries[i].getKey(), entries[i].getValue()} : null; array[9] = recipe.resource; array[10] = machine; diff --git a/src/main/java/forestry/factory/recipes/CraftGuideFabricator.java b/src/main/java/forestry/factory/recipes/CraftGuideFabricator.java index 63fe8b2b1..26775f821 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideFabricator.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideFabricator.java @@ -44,7 +44,7 @@ public class CraftGuideFabricator implements RecipeProvider { if (ForestryBlock.factoryTESR == null) return; - ItemStack machine = new ItemStack(ForestryBlock.factoryPlain, 1, Defaults.DEFINITION_FABRICATOR_META); + ItemStack machine = ForestryBlock.factoryPlain.getItemStack(1, Defaults.DEFINITION_FABRICATOR_META); RecipeTemplate template = generator.createRecipeTemplate(slots, machine); for (MachineFabricator.Recipe recipe : MachineFabricator.RecipeManager.recipes) { diff --git a/src/main/java/forestry/factory/recipes/CraftGuideFermenter.java b/src/main/java/forestry/factory/recipes/CraftGuideFermenter.java index e46736696..7aad47571 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideFermenter.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideFermenter.java @@ -48,7 +48,7 @@ public class CraftGuideFermenter implements RecipeProvider { if (ForestryBlock.factoryTESR == null) return; - ItemStack machine = new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_FERMENTER_META); + ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_FERMENTER_META); RecipeTemplate template = generator.createRecipeTemplate(slots, machine); List fuels = new ArrayList(FuelManager.fermenterFuel.keySet()); diff --git a/src/main/java/forestry/factory/recipes/CraftGuideSqueezer.java b/src/main/java/forestry/factory/recipes/CraftGuideSqueezer.java index 23f02ede0..adc057552 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideSqueezer.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideSqueezer.java @@ -44,7 +44,7 @@ public class CraftGuideSqueezer implements RecipeProvider { if (ForestryBlock.factoryTESR == null) return; - ItemStack machine = new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_SQUEEZER_META); + ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_SQUEEZER_META); RecipeTemplate template = generator.createRecipeTemplate(slots, machine); for (MachineSqueezer.Recipe recipe : MachineSqueezer.RecipeManager.recipes) { diff --git a/src/main/java/forestry/factory/recipes/CraftGuideStill.java b/src/main/java/forestry/factory/recipes/CraftGuideStill.java index 7d452c966..1587e2847 100755 --- a/src/main/java/forestry/factory/recipes/CraftGuideStill.java +++ b/src/main/java/forestry/factory/recipes/CraftGuideStill.java @@ -40,7 +40,7 @@ public class CraftGuideStill implements RecipeProvider { if (ForestryBlock.factoryTESR == null) return; - ItemStack machine = new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_STILL_META); + ItemStack machine = ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_STILL_META); RecipeTemplate template = generator.createRecipeTemplate(slots, machine); for (MachineStill.Recipe recipe : MachineStill.RecipeManager.recipes) { diff --git a/src/main/java/forestry/farming/EventHandlerFarming.java b/src/main/java/forestry/farming/EventHandlerFarming.java index 9d23e2165..b0049dba9 100755 --- a/src/main/java/forestry/farming/EventHandlerFarming.java +++ b/src/main/java/forestry/farming/EventHandlerFarming.java @@ -30,10 +30,10 @@ public class EventHandlerFarming { return; Block block = event.world.getBlock(event.x, event.y, event.z); - if (block != ForestryBlock.mushroom) + if (!ForestryBlock.mushroom.isBlockEqual(block)) return; - ((BlockMushroom) ForestryBlock.mushroom).func_149878_d(event.world, event.x, event.y, event.z, event.world.rand); + ((BlockMushroom) ForestryBlock.mushroom.block()).func_149878_d(event.world, event.x, event.y, event.z, event.world.rand); event.setResult(Result.ALLOW); } } diff --git a/src/main/java/forestry/farming/items/ItemFarmBlock.java b/src/main/java/forestry/farming/items/ItemFarmBlock.java index 5e4a23f51..875840447 100755 --- a/src/main/java/forestry/farming/items/ItemFarmBlock.java +++ b/src/main/java/forestry/farming/items/ItemFarmBlock.java @@ -18,10 +18,10 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import forestry.core.gadgets.IStructureBlockItem; -import forestry.core.utils.StringUtil; import forestry.farming.gadgets.TileFarm.EnumFarmBlock; public class ItemFarmBlock extends ItemBlock implements IStructureBlockItem { + public ItemFarmBlock(Block block) { super(block); setHasSubtypes(true); @@ -32,7 +32,7 @@ public class ItemFarmBlock extends ItemBlock implements IStructureBlockItem { return i; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List info, boolean par4) { if (!itemstack.hasTagCompound()) @@ -41,13 +41,8 @@ public class ItemFarmBlock extends ItemBlock implements IStructureBlockItem { info.add(EnumFarmBlock.getFromCompound(itemstack.getTagCompound()).getName()); } - @Override - public String getItemStackDisplayName(ItemStack itemstack) { - return StringUtil.localize(getUnlocalizedName(itemstack)); - } - @Override public String getUnlocalizedName(ItemStack itemstack) { - return "tile.ffarm." + itemstack.getItemDamage(); + return super.getUnlocalizedName(itemstack) + "." + itemstack.getItemDamage(); } } diff --git a/src/main/java/forestry/farming/logic/CropPeat.java b/src/main/java/forestry/farming/logic/CropPeat.java index 33c0d94ff..45443f9fe 100755 --- a/src/main/java/forestry/farming/logic/CropPeat.java +++ b/src/main/java/forestry/farming/logic/CropPeat.java @@ -30,7 +30,7 @@ public class CropPeat extends Crop { @Override protected boolean isCrop(Vect pos) { - return getBlock(pos) == ForestryBlock.soil && (getBlockMeta(pos) & 0x03) == 1; + return ForestryBlock.soil.isBlockEqual(getBlock(pos)) && (getBlockMeta(pos) & 0x03) == 1; } @Override diff --git a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java index 00fef6715..610b508b7 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicArboreal.java +++ b/src/main/java/forestry/farming/logic/FarmLogicArboreal.java @@ -46,9 +46,9 @@ public class FarmLogicArboreal extends FarmLogicHomogenous { } public FarmLogicArboreal(IFarmHousing housing) { - super(housing, new ItemStack[] { new ItemStack(Blocks.dirt) }, new ItemStack[] { new ItemStack(ForestryBlock.soil, 1, 0), - new ItemStack(ForestryBlock.soil, 1, Defaults.WILDCARD) }, new ItemStack[] { new ItemStack(Blocks.sand) }, Farmables.farmables.get( - "farmArboreal").toArray(new IFarmable[0])); + super(housing, new ItemStack[]{new ItemStack(Blocks.dirt)}, + new ItemStack[]{ForestryBlock.soil.getItemStack(), ForestryBlock.soil.getItemStack(1, Defaults.WILDCARD)}, + new ItemStack[]{new ItemStack(Blocks.sand)}, Farmables.farmables.get("farmArboreal").toArray(new IFarmable[0])); } @Override @@ -222,10 +222,9 @@ public class FarmLogicArboreal extends FarmLogicHomogenous { //ForgeDirection reverse = direction.getOpposite(); Vect soilBelow = new Vect(position.x, position.y - 1, position.z); //Vect soilPrevious = new Vect(position.x * reverse.offsetX, position.y - 1, position.z * reverse.offsetZ); - for (ItemStack grnd : ground) { - if(StackUtils.isIdenticalItem(grnd, getAsItemStack(soilBelow))) + for (ItemStack grnd : ground) + if (StackUtils.isIdenticalItem(grnd, getAsItemStack(soilBelow))) return plantSapling(position); - } //if (!ground[0].itemID == getAsItemStack(soilPrevious).itemID && ground[0].itemID == getAsItemStack(soilBelow).itemID) //if (ground[0].isItemEqual(getAsItemStack(soilBelow))) diff --git a/src/main/java/forestry/farming/logic/FarmLogicPeat.java b/src/main/java/forestry/farming/logic/FarmLogicPeat.java index f7de4a0ca..977f069ab 100755 --- a/src/main/java/forestry/farming/logic/FarmLogicPeat.java +++ b/src/main/java/forestry/farming/logic/FarmLogicPeat.java @@ -32,8 +32,9 @@ import forestry.core.utils.Vect; public class FarmLogicPeat extends FarmLogicWatered { public FarmLogicPeat(IFarmHousing housing) { - super(housing, new ItemStack[] { new ItemStack(ForestryBlock.soil, 1, 1) }, - new ItemStack[] { new ItemStack(ForestryBlock.soil, 1, 1) }, new ItemStack[] { new ItemStack(Blocks.dirt), new ItemStack(Blocks.grass) }); + super(housing, new ItemStack[]{ForestryBlock.soil.getItemStack(1, 1)}, + new ItemStack[]{ForestryBlock.soil.getItemStack(1, 1)}, + new ItemStack[]{new ItemStack(Blocks.dirt), new ItemStack(Blocks.grass)}); } @Override @@ -64,16 +65,16 @@ public class FarmLogicPeat extends FarmLogicWatered { Vect position = translateWithOffset(x, y, z, direction, i); ItemStack occupant = getAsItemStack(position); - if (StackUtils.getBlock(occupant) != ForestryBlock.soil) + if (!ForestryBlock.soil.isBlockEqual(StackUtils.getBlock(occupant))) continue; int type = occupant.getItemDamage() & 0x03; int maturity = occupant.getItemDamage() >> 2; - if (type != 1) - continue; + if (type != 1) + continue; - if (maturity >= 3) - crops.push(new CropPeat(world, position)); + if (maturity >= 3) + crops.push(new CropPeat(world, position)); } return crops; diff --git a/src/main/java/forestry/farming/logic/FarmableGE.java b/src/main/java/forestry/farming/logic/FarmableGE.java index 774558ac8..f7c1f5ea9 100755 --- a/src/main/java/forestry/farming/logic/FarmableGE.java +++ b/src/main/java/forestry/farming/logic/FarmableGE.java @@ -30,7 +30,7 @@ public class FarmableGE implements IFarmable { if (world.isAirBlock(x, y, z)) return false; - return world.getBlock(x, y, z) == ForestryBlock.saplingGE; + return ForestryBlock.saplingGE.isBlockEqual(world, x, y, z); } @Override diff --git a/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java b/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java index 44613d79e..c92603f47 100755 --- a/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java +++ b/src/main/java/forestry/farming/logic/FarmableVanillaShroom.java @@ -45,7 +45,7 @@ public class FarmableVanillaShroom extends FarmableGenericSapling { meta = 1; Proxies.common.addBlockPlaceEffects(world, x, y, z, Blocks.brown_mushroom, 0); - return world.setBlock(x, y, z, ForestryBlock.mushroom, meta, Defaults.FLAG_BLOCK_SYNCH); + return ForestryBlock.mushroom.setBlock(world, x, y, z, meta, Defaults.FLAG_BLOCK_SYNCH); } } diff --git a/src/main/java/forestry/farming/proxy/ClientProxyFarming.java b/src/main/java/forestry/farming/proxy/ClientProxyFarming.java index d104e3ee3..a7da85f32 100755 --- a/src/main/java/forestry/farming/proxy/ClientProxyFarming.java +++ b/src/main/java/forestry/farming/proxy/ClientProxyFarming.java @@ -10,7 +10,6 @@ ******************************************************************************/ package forestry.farming.proxy; -import net.minecraft.item.Item; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -28,6 +27,6 @@ public class ClientProxyFarming extends ProxyFarming { PluginFarming.modelIdFarmBlock = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(new FarmRenderingHandler()); - MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ForestryBlock.farm), new FarmItemRenderer()); + MinecraftForgeClient.registerItemRenderer(ForestryBlock.farm.item(), new FarmItemRenderer()); } } diff --git a/src/main/java/forestry/farming/render/FarmRenderingHandler.java b/src/main/java/forestry/farming/render/FarmRenderingHandler.java index 5f25e7277..4d703ae35 100755 --- a/src/main/java/forestry/farming/render/FarmRenderingHandler.java +++ b/src/main/java/forestry/farming/render/FarmRenderingHandler.java @@ -31,7 +31,7 @@ public class FarmRenderingHandler extends OverlayRenderingHandler { // Render the plain block. renderer.renderStandardBlock(block, x, y, z); - renderFarmOverlay(world, (BlockFarm) ForestryBlock.farm, x, y, z, renderer, 0xffffff); + renderFarmOverlay(world, (BlockFarm) ForestryBlock.farm.block(), x, y, z, renderer, 0xffffff); return true; } diff --git a/src/main/java/forestry/food/items/ItemBeverage.java b/src/main/java/forestry/food/items/ItemBeverage.java index c42194de5..5f1476887 100755 --- a/src/main/java/forestry/food/items/ItemBeverage.java +++ b/src/main/java/forestry/food/items/ItemBeverage.java @@ -32,7 +32,6 @@ import forestry.core.CreativeTabForestry; import forestry.core.config.Config; import forestry.core.proxy.Proxies; import forestry.core.render.TextureManager; -import forestry.core.utils.StringUtil; public class ItemBeverage extends Item { @@ -169,7 +168,7 @@ public class ItemBeverage extends Item { return itemstack; } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { for (int i = 0; i < beverages.length; i++) @@ -177,7 +176,7 @@ public class ItemBeverage extends Item { itemList.add(new ItemStack(this, 1, i)); } - @SuppressWarnings({ "rawtypes", "unchecked" }) + @SuppressWarnings({"rawtypes", "unchecked"}) @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) { int meta = itemstack.getItemDamage(); @@ -190,8 +189,8 @@ public class ItemBeverage extends Item { } @Override - public String getItemStackDisplayName(ItemStack itemstack) { - return StringUtil.localize("item.beverage." + beverages[itemstack.getItemDamage()].name); + public String getUnlocalizedName(ItemStack stack) { + return super.getUnlocalizedName(stack) + "." + beverages[stack.getItemDamage()].name; } /* ICONS */ diff --git a/src/main/java/forestry/mail/CommandMail.java b/src/main/java/forestry/mail/CommandMail.java index 704face9b..28eb79bdd 100755 --- a/src/main/java/forestry/mail/CommandMail.java +++ b/src/main/java/forestry/mail/CommandMail.java @@ -56,7 +56,7 @@ public class CommandMail extends CommandMC { @Override public void processCommand(ICommandSender sender, String[] arguments) { if (arguments.length <= 0) - throw new WrongUsageException(StringUtil.localizeAndFormat("chat.help",this.getCommandUsage(sender))); + throw new WrongUsageException(StringUtil.localize("chat.help",this.getCommandUsage(sender))); if (arguments[0].matches("trades")) { commandTrades(sender, arguments); @@ -65,7 +65,7 @@ public class CommandMail extends CommandMC { commandVirtualize(sender, arguments); return; } else if (arguments[0].matches("help")) { - sendChatMessage(sender, StringUtil.localizeAndFormat("chat.mail.command.help.0", this.getCommandName())); + sendChatMessage(sender, StringUtil.localize("chat.mail.command.help.0", this.getCommandName())); sendChatMessage(sender, StringUtil.localize("chat.mail.command.help.1")); sendChatMessage(sender, StringUtil.localize("chat.mail.command.help.2")); sendChatMessage(sender, StringUtil.localize("chat.mail.command.help.3")); diff --git a/src/main/java/forestry/mail/items/ItemStamps.java b/src/main/java/forestry/mail/items/ItemStamps.java index 80cf68f41..6590981e7 100755 --- a/src/main/java/forestry/mail/items/ItemStamps.java +++ b/src/main/java/forestry/mail/items/ItemStamps.java @@ -60,11 +60,11 @@ public class ItemStamps extends ItemOverlay implements IStamps { } @Override - public String getItemStackDisplayName(ItemStack itemstack) { + public String getUnlocalizedName(ItemStack itemstack) { if (itemstack.getItemDamage() < 0 || itemstack.getItemDamage() >= stampInfo.length) return null; - return StringUtil.localize(getUnlocalizedName()) + " " + stampInfo[itemstack.getItemDamage()].name; + return super.getUnlocalizedName(itemstack) + "." + stampInfo[itemstack.getItemDamage()].name; } diff --git a/src/main/java/forestry/plugins/PluginApiculture.java b/src/main/java/forestry/plugins/PluginApiculture.java index a19bec5d2..1f7312fa3 100755 --- a/src/main/java/forestry/plugins/PluginApiculture.java +++ b/src/main/java/forestry/plugins/PluginApiculture.java @@ -194,51 +194,61 @@ public class PluginApiculture extends NativePlugin { createHiveDropArrays(); - ForestryBlock.apiculture = new BlockBase(Material.iron); - ForestryBlock.apiculture.setBlockName("for.apiculture").setCreativeTab(Tabs.tabApiculture); - Proxies.common.registerBlock(ForestryBlock.apiculture, ItemForestryBlock.class); + ForestryBlock.apiculture.registerBlock(new BlockBase(Material.iron), ItemForestryBlock.class, "apiculture"); + ForestryBlock.apiculture.block().setCreativeTab(Tabs.tabApiculture); - definitionApiary = ForestryBlock.apiculture.addDefinition(new MachineDefinition(Defaults.DEFINITION_APIARY_META, "forestry.Apiary", TileApiary.class, - ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.apiculture, 1, Defaults.DEFINITION_APIARY_META), new Object[] { "XXX", "#C#", "###", 'X', "slabWood", '#', - "plankWood", 'C', ForestryItem.impregnatedCasing })) - .setFaces(0, 1, 2, 2, 4, 4, 0, 7)); + definitionApiary = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_APIARY_META, "forestry.Apiary", TileApiary.class, + ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apiculture.getItemStack(1, Defaults.DEFINITION_APIARY_META), + "XXX", + "#C#", + "###", + 'X', "slabWood", + '#', "plankWood", + 'C', ForestryItem.impregnatedCasing)) + .setFaces(0, 1, 2, 2, 4, 4, 0, 7)); - definitionChest = ForestryBlock.apiculture.addDefinition(new MachineDefinition(Defaults.DEFINITION_APIARISTCHEST_META, "forestry.ApiaristChest", TileApiaristChest.class, - ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.apiculture, 1, Defaults.DEFINITION_APIARISTCHEST_META), new Object[] { " # ", "XYX", "XXX", '#', Blocks.glass, 'X', - "beeComb", 'Y', Blocks.chest })).setFaces(0, 1, 2, - 3, 4, 4)); + definitionChest = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_APIARISTCHEST_META, "forestry.ApiaristChest", TileApiaristChest.class, + ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apiculture.getItemStack(1, Defaults.DEFINITION_APIARISTCHEST_META), + " # ", + "XYX", + "XXX", + '#', Blocks.glass, + 'X', "beeComb", + 'Y', Blocks.chest)) + .setFaces(0, 1, 2, 3, 4, 4)); - definitionBeehouse = ForestryBlock.apiculture.addDefinition(new MachineDefinition(Defaults.DEFINITION_BEEHOUSE_META, "forestry.Beehouse", TileBeehouse.class, - ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.apiculture, 1, Defaults.DEFINITION_BEEHOUSE_META), new Object[] { "XXX", "#C#", "###", 'X', "slabWood", '#', - "plankWood", 'C', "beeComb" })) - .setFaces(0, 1, 2, 2, 4, 4, 0, 7)); + definitionBeehouse = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_BEEHOUSE_META, "forestry.Beehouse", TileBeehouse.class, + ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apiculture.getItemStack(1, Defaults.DEFINITION_BEEHOUSE_META), + "XXX", + "#C#", + "###", + 'X', "slabWood", + '#', "plankWood", + 'C', "beeComb")) + .setFaces(0, 1, 2, 2, 4, 4, 0, 7)); - ForestryBlock.beehives = (new BlockBeehives()).setBlockName("beehives"); - Proxies.common.registerBlock(ForestryBlock.beehives, ItemForestryBlock.class); - ForestryBlock.beehives.setHarvestLevel("pickaxe", 1, 0); - ForestryBlock.beehives.setHarvestLevel("scoop", 0, 1); - ForestryBlock.beehives.setHarvestLevel("scoop", 0, 2); - ForestryBlock.beehives.setHarvestLevel("scoop", 0, 3); - ForestryBlock.beehives.setHarvestLevel("scoop", 0, 4); - ForestryBlock.beehives.setHarvestLevel("scoop", 0, 5); - ForestryBlock.beehives.setHarvestLevel("scoop", 0, 6); - ForestryBlock.beehives.setHarvestLevel("scoop", 0, 7); - ForestryBlock.beehives.setHarvestLevel("scoop", 0, 8); + ForestryBlock.beehives.registerBlock(new BlockBeehives(), ItemForestryBlock.class, "beehives"); + ForestryBlock.beehives.block().setHarvestLevel("pickaxe", 1, 0); + ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 1); + ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 2); + ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 3); + ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 4); + ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 5); + ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 6); + ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 7); + ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 8); // Init bee interface AlleleManager.alleleRegistry.registerSpeciesRoot(PluginApiculture.beeInterface = BeeManager.beeInterface = new BeeHelper()); - BeeManager.villageBees = new ArrayList[] { new ArrayList(), new ArrayList() }; + BeeManager.villageBees = new ArrayList[]{new ArrayList(), new ArrayList()}; // Candles - ForestryBlock.candle = new BlockCandle().setBlockName("candle"); - Proxies.common.registerBlock(ForestryBlock.candle, ItemCandleBlock.class); - ForestryBlock.stump = new BlockStump().setBlockName("stump"); - Proxies.common.registerBlock(ForestryBlock.stump, ItemForestryBlock.class); + ForestryBlock.candle.registerBlock(new BlockCandle(), ItemCandleBlock.class, "candle"); + ForestryBlock.stump.registerBlock(new BlockStump(), ItemForestryBlock.class, "stump"); // Alveary and Components - ForestryBlock.alveary = new BlockAlveary().setBlockName("alveary"); - Proxies.common.registerBlock(ForestryBlock.alveary, ItemAlvearyBlock.class); - ForestryBlock.alveary.setHarvestLevel("axe", 0); + ForestryBlock.alveary.registerBlock(new BlockAlveary(), ItemAlvearyBlock.class, "alveary"); + ForestryBlock.alveary.block().setHarvestLevel("axe", 0); // Add triggers triggerNoFrames = new TriggerNoFrames(); @@ -432,19 +442,18 @@ public class PluginApiculture extends NativePlugin { protected void registerRecipes() { // / APIARIST'S ARMOR - Proxies.common.addRecipe(ForestryItem.apiaristHat.getItemStack(), new Object[] { "###", "# #", '#', - ForestryItem.craftingMaterial.getItemStack(1, 3) }); - Proxies.common.addRecipe(ForestryItem.apiaristChest.getItemStack(), new Object[] { "# #", "###", "###", '#', - ForestryItem.craftingMaterial.getItemStack(1, 3) }); - Proxies.common.addRecipe(ForestryItem.apiaristLegs.getItemStack(), new Object[] { "###", "# #", "# #", '#', - ForestryItem.craftingMaterial.getItemStack(1, 3) }); - Proxies.common.addRecipe(ForestryItem.apiaristBoots.getItemStack(), new Object[] { "# #", "# #", '#', - ForestryItem.craftingMaterial.getItemStack(1, 3) }); + Proxies.common.addRecipe(ForestryItem.apiaristHat.getItemStack(), new Object[]{"###", "# #", '#', + ForestryItem.craftingMaterial.getItemStack(1, 3)}); + Proxies.common.addRecipe(ForestryItem.apiaristChest.getItemStack(), new Object[]{"# #", "###", "###", '#', + ForestryItem.craftingMaterial.getItemStack(1, 3)}); + Proxies.common.addRecipe(ForestryItem.apiaristLegs.getItemStack(), new Object[]{"###", "# #", "# #", '#', + ForestryItem.craftingMaterial.getItemStack(1, 3)}); + Proxies.common.addRecipe(ForestryItem.apiaristBoots.getItemStack(), new Object[]{"# #", "# #", '#', + ForestryItem.craftingMaterial.getItemStack(1, 3)}); // / HABITAT LOCATOR //Proxies.common.addRecipe(ForestryItem.biomeFinder.getItemStack(), // new Object[] { " X ", "X#X", " X ", '#', Items.redstone, 'X', "ingotBronze" }); - Proxies.common.addRecipe(ForestryItem.vialCatalyst.getItemStack(3), "###", "YXY", '#', ForestryItem.waxCapsule, @@ -523,86 +532,108 @@ public class PluginApiculture extends NativePlugin { // / BITUMINOUS PEAT Proxies.common.addRecipe(ForestryItem.bituminousPeat.getItemStack(), - new Object[] { " # ", "XYX", " # ", '#', "dustAsh", 'X', ForestryItem.peat, 'Y', - ForestryItem.propolis }); + new Object[]{" # ", "XYX", " # ", '#', "dustAsh", 'X', ForestryItem.peat, 'Y', + ForestryItem.propolis}); // / TORCHES Proxies.common.addRecipe(new ItemStack(Blocks.torch, 3), - new Object[] { " # ", " # ", " Y ", '#', ForestryItem.beeswax, 'Y', "stickWood" }); - Proxies.common.addRecipe(ForestryItem.craftingMaterial.getItemStack(1, 1), new Object[] { "# #", " # ", "# #", '#', - ForestryItem.propolis.getItemStack(1, 2) }); + new Object[]{" # ", " # ", " Y ", '#', ForestryItem.beeswax, 'Y', "stickWood"}); + Proxies.common.addRecipe(ForestryItem.craftingMaterial.getItemStack(1, 1), new Object[]{"# #", " # ", "# #", '#', + ForestryItem.propolis.getItemStack(1, 2)}); // / CANDLES - RecipeManagers.carpenterManager.addRecipe(30, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 600), null, new ItemStack(ForestryBlock.candle, 24), new Object[] { - " X ", "###", "###", '#', ForestryItem.beeswax, 'X', Items.string }); - RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 200), null, new ItemStack(ForestryBlock.candle, 6), new Object[] { - "#X#", '#', ForestryItem.beeswax, 'X', ForestryItem.craftingMaterial.getItemStack(1, 2) }); - Proxies.common.addShapelessRecipe(new ItemStack(ForestryBlock.candle), new ItemStack(ForestryBlock.candle)); - Proxies.common.addShapelessRecipe(new ItemStack(ForestryBlock.candle, 1, 1), new ItemStack(ForestryBlock.candle, 1, 1)); + RecipeManagers.carpenterManager.addRecipe(30, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 600), null, ForestryBlock.candle.getItemStack(24), + " X ", + "###", + "###", + '#', ForestryItem.beeswax, + 'X', Items.string); + RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 200), null, ForestryBlock.candle.getItemStack(6), + "#X#", + '#', ForestryItem.beeswax, + 'X', ForestryItem.craftingMaterial.getItemStack(1, 2)); + Proxies.common.addShapelessRecipe(ForestryBlock.candle.getItemStack(), ForestryBlock.candle.getItemStack()); + Proxies.common.addShapelessRecipe(ForestryBlock.candle.getItemStack(1, 1), ForestryBlock.candle.getItemStack(1, 1)); // / WAX CAST Proxies.common.addRecipe(ForestryItem.waxCast.getItemStack(), - "###", "# #", "###", + "###", + "# #", + "###", '#', ForestryItem.beeswax); // / ALVEARY - Proxies.common.addRecipe(new ItemStack(ForestryBlock.alveary), - "###", "#X#", "###", + Proxies.common.addRecipe(ForestryBlock.alveary.getItemStack(), + "###", + "#X#", + "###", 'X', ForestryItem.impregnatedCasing, '#', ForestryItem.craftingMaterial.getItemStack(1, 6)); // SWARMER - Proxies.common.addRecipe(new ItemStack(ForestryBlock.alveary, 1, 2), - "#G#", " X ", "#G#", + Proxies.common.addRecipe(ForestryBlock.alveary.getItemStack(1, 2), + "#G#", + " X ", + "#G#", '#', ForestryItem.tubes.getItemStack(1, 5), 'X', ForestryBlock.alveary, 'G', Items.gold_ingot); // FAN - Proxies.common.addRecipe(new ItemStack(ForestryBlock.alveary, 1, 3), - "I I", " X ", "I#I", + Proxies.common.addRecipe(ForestryBlock.alveary.getItemStack(1, 3), + "I I", + " X ", + "I#I", '#', ForestryItem.tubes.getItemStack(1, 4), 'X', ForestryBlock.alveary, 'I', Items.iron_ingot); // HEATER - Proxies.common.addRecipe(new ItemStack(ForestryBlock.alveary, 1, 4), - "#I#", " X ", "YYY", + Proxies.common.addRecipe(ForestryBlock.alveary.getItemStack(1, 4), + "#I#", + " X ", + "YYY", '#', ForestryItem.tubes.getItemStack(1, 4), 'X', ForestryBlock.alveary, 'I', Items.iron_ingot, 'Y', Blocks.stone); // HYGROREGULATOR - Proxies.common.addRecipe(new ItemStack(ForestryBlock.alveary, 1, 5), - "GIG", "GXG", "GIG", + Proxies.common.addRecipe(ForestryBlock.alveary.getItemStack(1, 5), + "GIG", + "GXG", + "GIG", 'X', ForestryBlock.alveary, 'I', Items.iron_ingot, 'G', Blocks.glass); // STABILISER - Proxies.common.addRecipe(new ItemStack(ForestryBlock.alveary, 1, 6), - "G G", "GXG", "G G", + Proxies.common.addRecipe(ForestryBlock.alveary.getItemStack(1, 6), + "G G", + "GXG", + "G G", 'X', ForestryBlock.alveary, 'G', Items.quartz); // SIEVE - Proxies.common.addRecipe(new ItemStack(ForestryBlock.alveary, 1, TileAlvearySieve.BLOCK_META), - "III", " X ", "WWW", + Proxies.common.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlvearySieve.BLOCK_META), + "III", + " X ", + "WWW", 'X', ForestryBlock.alveary, 'I', Items.iron_ingot, 'W', ForestryItem.craftingMaterial.getItemStack(1, 3)); // / SQUEEZER - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.honeyDrop.getItemStack() }, LiquidHelper.getLiquid(Defaults.LIQUID_HONEY, 100), + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.honeyDrop.getItemStack()}, LiquidHelper.getLiquid(Defaults.LIQUID_HONEY, 100), ForestryItem.propolis.getItemStack(), 5); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.honeydew.getItemStack() }, LiquidHelper.getLiquid(Defaults.LIQUID_HONEY, 100)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.sand) }, LiquidHelper.getLiquid(Defaults.LIQUID_LAVA, 2000)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.dirt) }, LiquidHelper.getLiquid(Defaults.LIQUID_LAVA, 1600)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.honeydew.getItemStack()}, LiquidHelper.getLiquid(Defaults.LIQUID_HONEY, 100)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.sand)}, LiquidHelper.getLiquid(Defaults.LIQUID_LAVA, 2000)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.dirt)}, LiquidHelper.getLiquid(Defaults.LIQUID_LAVA, 1600)); // / CARPENTER RecipeManagers.carpenterManager.addRecipe(100, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 2000), null, ForestryItem.beealyzer.getItemStack(), - new Object[] { "X#X", "X#X", "RDR", '#', Blocks.glass_pane, 'X', "ingotTin", 'R', - Items.redstone, 'D', Items.diamond }); + new Object[]{"X#X", "X#X", "RDR", '#', Blocks.glass_pane, 'X', "ingotTin", 'R', + Items.redstone, 'D', Items.diamond}); RecipeManagers.carpenterManager.addRecipe( 50, LiquidHelper.getLiquid(Defaults.LIQUID_HONEY, 500), null, ForestryItem.craftingMaterial.getItemStack(1, 6), - new Object[] { " J ", "###", "WPW", '#', "plankWood", 'J', ForestryItem.royalJelly, - 'W', ForestryItem.beeswax, 'P', ForestryItem.pollen }); + new Object[]{" J ", "###", "WPW", '#', "plankWood", 'J', ForestryItem.royalJelly, + 'W', ForestryItem.beeswax, 'P', ForestryItem.pollen}); // / CENTRIFUGE // Honey combs @@ -616,40 +647,40 @@ public class PluginApiculture extends NativePlugin { // Drippig combs RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 5), ForestryItem.honeydew.getItemStack(), ForestryItem.honeyDrop.getItemStack(), 40); // Frozen combs - RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 4), new ItemStack[] { ForestryItem.beeswax.getItemStack(), - ForestryItem.honeyDrop.getItemStack(), new ItemStack(Items.snowball), ForestryItem.pollen.getItemStack(1, 1) }, new int[] { 80, 70, 40, 20 }); + RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 4), new ItemStack[]{ForestryItem.beeswax.getItemStack(), + ForestryItem.honeyDrop.getItemStack(), new ItemStack(Items.snowball), ForestryItem.pollen.getItemStack(1, 1)}, new int[]{80, 70, 40, 20}); // Silky combs RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 6), ForestryItem.honeyDrop.getItemStack(), ForestryItem.propolis.getItemStack(1, 3), 80); // Parched combs RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 7), ForestryItem.beeswax.getItemStack(), ForestryItem.honeyDrop.getItemStack(), 90); // Mysterious combs - RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 8), new ItemStack[] { ForestryItem.honeyDrop.getItemStack(), - ForestryItem.propolis.getItemStack(1, 2) }, new int[] { 40, 100 }); + RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 8), new ItemStack[]{ForestryItem.honeyDrop.getItemStack(), + ForestryItem.propolis.getItemStack(1, 2)}, new int[]{40, 100}); // Irradiated combs - RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 9), new ItemStack[] {}, new int[] {}); + RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 9), new ItemStack[]{}, new int[]{}); // Powdery combs - RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 10), new ItemStack[] { ForestryItem.honeyDrop.getItemStack(), - ForestryItem.beeswax.getItemStack(), new ItemStack(Items.gunpowder) }, new int[] { 20, 20, 90 }); + RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 10), new ItemStack[]{ForestryItem.honeyDrop.getItemStack(), + ForestryItem.beeswax.getItemStack(), new ItemStack(Items.gunpowder)}, new int[]{20, 20, 90}); // Reddened Combs RecipeManagers.centrifugeManager.addRecipe(80, ForestryItem.beeComb.getItemStack(1, 11), - new ItemStack[] { ForestryItem.honeyDrop.getItemStack(2, 1) }, new int[] { 100 }); + new ItemStack[]{ForestryItem.honeyDrop.getItemStack(2, 1)}, new int[]{100}); // Darkened Combs RecipeManagers.centrifugeManager.addRecipe(80, ForestryItem.beeComb.getItemStack(1, 12), - new ItemStack[] { ForestryItem.honeyDrop.getItemStack(1, 1) }, new int[] { 100 }); + new ItemStack[]{ForestryItem.honeyDrop.getItemStack(1, 1)}, new int[]{100}); // Omega Combs - RecipeManagers.centrifugeManager.addRecipe(400, ForestryItem.beeComb.getItemStack(1, 13), new ItemStack[] { ForestryItem.honeyDrop.getItemStack(1, 2) }, new int[] { 100 }); + RecipeManagers.centrifugeManager.addRecipe(400, ForestryItem.beeComb.getItemStack(1, 13), new ItemStack[]{ForestryItem.honeyDrop.getItemStack(1, 2)}, new int[]{100}); // Wheaten Combs - RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 14), new ItemStack[] { ForestryItem.honeyDrop.getItemStack(), - ForestryItem.beeswax.getItemStack(), new ItemStack(Items.wheat) }, new int[] { 20, 20, 80 }); + RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 14), new ItemStack[]{ForestryItem.honeyDrop.getItemStack(), + ForestryItem.beeswax.getItemStack(), new ItemStack(Items.wheat)}, new int[]{20, 20, 80}); // Mossy Combs RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 15), ForestryItem.beeswax.getItemStack(), ForestryItem.honeyDrop.getItemStack(), 90); // Mellow Combs - RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 16), new ItemStack[] { ForestryItem.honeydew.getItemStack(), - ForestryItem.beeswax.getItemStack(), new ItemStack(Items.quartz) }, new int[] { 60, 20, 30 }); + RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 16), new ItemStack[]{ForestryItem.honeydew.getItemStack(), + ForestryItem.beeswax.getItemStack(), new ItemStack(Items.quartz)}, new int[]{60, 20, 30}); // Silk - RecipeManagers.centrifugeManager.addRecipe(5, ForestryItem.propolis.getItemStack(1, 3), new ItemStack[] { - ForestryItem.craftingMaterial.getItemStack(1, 2), ForestryItem.propolis.getItemStack() }, new int[] { 60, 10 }); + RecipeManagers.centrifugeManager.addRecipe(5, ForestryItem.propolis.getItemStack(1, 3), new ItemStack[]{ + ForestryItem.craftingMaterial.getItemStack(1, 2), ForestryItem.propolis.getItemStack()}, new int[]{60, 10}); // / FERMENTER RecipeManagers.fermenterManager.addRecipe(ForestryItem.honeydew.getItemStack(), 500, 1.0f, LiquidHelper.getLiquid(Defaults.LIQUID_MEAD, 1), @@ -658,26 +689,26 @@ public class PluginApiculture extends NativePlugin { } private void registerBeehiveDrops() { - forestDrops.add(new HiveDrop(BeeTemplates.getForestTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 0) }, 80).setIgnobleShare(0.7f)); - forestDrops.add(new HiveDrop(BeeTemplates.getForestRainResistTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 0) }, 8)); - forestDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 0) }, 3)); + forestDrops.add(new HiveDrop(BeeTemplates.getForestTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 0)}, 80).setIgnobleShare(0.7f)); + forestDrops.add(new HiveDrop(BeeTemplates.getForestRainResistTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 0)}, 8)); + forestDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 0)}, 3)); - meadowsDrops.add(new HiveDrop(BeeTemplates.getMeadowsTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 0) }, 80).setIgnobleShare(0.7f)); - meadowsDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 0) }, 3)); + meadowsDrops.add(new HiveDrop(BeeTemplates.getMeadowsTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 0)}, 80).setIgnobleShare(0.7f)); + meadowsDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 0)}, 3)); - desertDrops.add(new HiveDrop(BeeTemplates.getModestTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 7) }, 80).setIgnobleShare(0.7f)); - desertDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 7) }, 3)); + desertDrops.add(new HiveDrop(BeeTemplates.getModestTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 7)}, 80).setIgnobleShare(0.7f)); + desertDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 7)}, 3)); - jungleDrops.add(new HiveDrop(BeeTemplates.getTropicalTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 6) }, 80).setIgnobleShare(0.7f)); - jungleDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 6) }, 3)); + jungleDrops.add(new HiveDrop(BeeTemplates.getTropicalTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 6)}, 80).setIgnobleShare(0.7f)); + jungleDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 6)}, 3)); - endDrops.add(new HiveDrop(BeeTemplates.getEnderTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 8) }, 90)); + endDrops.add(new HiveDrop(BeeTemplates.getEnderTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 8)}, 90)); - snowDrops.add(new HiveDrop(BeeTemplates.getWintryTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 4) }, 80).setIgnobleShare(0.5f)); - snowDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 4) }, 3)); + snowDrops.add(new HiveDrop(BeeTemplates.getWintryTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 4)}, 80).setIgnobleShare(0.5f)); + snowDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 4)}, 3)); - swampDrops.add(new HiveDrop(BeeTemplates.getMarshyTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 15) }, 80).setIgnobleShare(0.4f)); - swampDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[] { ForestryItem.beeComb.getItemStack(1, 15) }, 3)); + swampDrops.add(new HiveDrop(BeeTemplates.getMarshyTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 15)}, 80).setIgnobleShare(0.4f)); + swampDrops.add(new HiveDrop(BeeTemplates.getValiantTemplate(), new ItemStack[]{ForestryItem.beeComb.getItemStack(1, 15)}, 3)); } private void registerDungeonLoot() { @@ -689,7 +720,7 @@ public class PluginApiculture extends NativePlugin { ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(getBeeItemFromTemplate(BeeTemplates.getSteadfastTemplate(), EnumBeeType.DRONE), 1, 1, rarity)); - ItemStack stack = new ItemStack(ForestryBlock.candle); + ItemStack stack = ForestryBlock.candle.getItemStack(); NBTTagCompound tag = new NBTTagCompound(); tag.setInteger(BlockCandle.colourTagName, 0xffffff); stack.setTagCompound(tag); @@ -803,7 +834,7 @@ public class PluginApiculture extends NativePlugin { Allele.speciesCommon = new AlleleBeeSpecies("speciesCommon", true, "bees.species.common", honey, "cerana", 0xb2b2b2, 0xffdc16).addProduct( ForestryItem.beeComb.getItemStack(1, 0), 35).setIsSecret(); Allele.speciesCultivated = new AlleleBeeSpecies("speciesCultivated", true, "bees.species.cultivated", honey, "mellifera", 0x5734ec, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 40).setIsSecret(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 40).setIsSecret(); // Noble Branch Allele.speciesNoble = new AlleleBeeSpecies("speciesNoble", false, "bees.species.noble", noble, "nobilis", 0xec9a19, 0xffdc16).addProduct( @@ -811,109 +842,109 @@ public class PluginApiculture extends NativePlugin { Allele.speciesMajestic = new AlleleBeeSpecies("speciesMajestic", true, "bees.species.majestic", noble, "regalis", 0x7f0000, 0xffdc16).addProduct( ForestryItem.beeComb.getItemStack(1, 5), 30).setIsSecret(); Allele.speciesImperial = new AlleleBeeSpecies("speciesImperial", false, "bees.species.imperial", noble, "imperatorius", 0xa3e02f, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 5), 20).addProduct(ForestryItem.royalJelly.getItemStack(), 15).setHasEffect().setIsSecret(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 5), 20).addProduct(ForestryItem.royalJelly.getItemStack(), 15).setHasEffect().setIsSecret(); // Industrious Branch Allele.speciesDiligent = new AlleleBeeSpecies("speciesDiligent", false, "bees.species.diligent", industrious, "sedulus", 0xc219ec, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 3), 20).setIsSecret(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 3), 20).setIsSecret(); Allele.speciesUnweary = new AlleleBeeSpecies("speciesUnweary", true, "bees.species.unweary", industrious, "assiduus", 0x19ec5a, 0xffdc16).addProduct( ForestryItem.beeComb.getItemStack(1, 3), 30).setIsSecret(); Allele.speciesIndustrious = new AlleleBeeSpecies("speciesIndustrious", false, "bees.species.industrious", industrious, "industria", 0xffffff, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 3), 20).addProduct(ForestryItem.pollen.getItemStack(), 15).setHasEffect().setIsSecret(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 3), 20).addProduct(ForestryItem.pollen.getItemStack(), 15).setHasEffect().setIsSecret(); // Heroic Branch Allele.speciesSteadfast = new AlleleBeeSpecies("speciesSteadfast", false, "bees.species.steadfast", heroic, "legio", 0x4d2b15, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 1), 20).setIsSecret().setHasEffect(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 1), 20).setIsSecret().setHasEffect(); Allele.speciesValiant = new AlleleBeeSpecies("speciesValiant", true, "bees.species.valiant", heroic, "centurio", 0x626bdd, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 1), 30).addSpecialty(new ItemStack(Items.sugar), 15).setIsSecret(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 1), 30).addSpecialty(new ItemStack(Items.sugar), 15).setIsSecret(); Allele.speciesHeroic = new AlleleBeeSpecies("speciesHeroic", false, "bees.species.heroic", heroic, "kraphti", 0xb3d5e4, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 1), 40).setIsSecret().setHasEffect(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 1), 40).setIsSecret().setHasEffect(); // Infernal Branch Allele.speciesSinister = new AlleleBeeSpecies("speciesSinister", false, "bees.species.sinister", infernal, "caecus", 0xb3d5e4, 0x9a2323) - .addProduct(ForestryItem.beeComb.getItemStack(1, 2), 45).setEntityTexture("sinisterBee").setIsSecret().setTemperature(EnumTemperature.HELLISH).setHumidity(EnumHumidity.ARID); + .addProduct(ForestryItem.beeComb.getItemStack(1, 2), 45).setEntityTexture("sinisterBee").setIsSecret().setTemperature(EnumTemperature.HELLISH).setHumidity(EnumHumidity.ARID); Allele.speciesFiendish = new AlleleBeeSpecies("speciesFiendish", true, "bees.species.fiendish", infernal, "diabolus", 0xd7bee5, 0x9a2323) - .addProduct(ForestryItem.beeComb.getItemStack(1, 2), 55).addProduct(ForestryItem.ash.getItemStack(), 15).setEntityTexture("sinisterBee").setIsSecret() - .setTemperature(EnumTemperature.HELLISH).setHumidity(EnumHumidity.ARID); + .addProduct(ForestryItem.beeComb.getItemStack(1, 2), 55).addProduct(ForestryItem.ash.getItemStack(), 15).setEntityTexture("sinisterBee").setIsSecret() + .setTemperature(EnumTemperature.HELLISH).setHumidity(EnumHumidity.ARID); Allele.speciesDemonic = new AlleleBeeSpecies("speciesDemonic", false, "bees.species.demonic", infernal, "draco", 0xf4e400, 0x9a2323) - .addProduct(ForestryItem.beeComb.getItemStack(1, 2), 45).addProduct(new ItemStack(Items.glowstone_dust), 15).setEntityTexture("sinisterBee").setHasEffect().setIsSecret() - .setTemperature(EnumTemperature.HELLISH).setHumidity(EnumHumidity.ARID); + .addProduct(ForestryItem.beeComb.getItemStack(1, 2), 45).addProduct(new ItemStack(Items.glowstone_dust), 15).setEntityTexture("sinisterBee").setHasEffect().setIsSecret() + .setTemperature(EnumTemperature.HELLISH).setHumidity(EnumHumidity.ARID); // Austere Branch Allele.speciesModest = new AlleleBeeSpecies("speciesModest", false, "bees.species.modest", austere, "modicus", 0xc5be86, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 7), 20).setTemperature(EnumTemperature.HOT).setHumidity(EnumHumidity.ARID); + .addProduct(ForestryItem.beeComb.getItemStack(1, 7), 20).setTemperature(EnumTemperature.HOT).setHumidity(EnumHumidity.ARID); Allele.speciesFrugal = new AlleleBeeSpecies("speciesFrugal", true, "bees.species.frugal", austere, "permodestus", 0xe8dcb1, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 7), 30).setIsSecret().setTemperature(EnumTemperature.HOT).setHumidity(EnumHumidity.ARID); + .addProduct(ForestryItem.beeComb.getItemStack(1, 7), 30).setIsSecret().setTemperature(EnumTemperature.HOT).setHumidity(EnumHumidity.ARID); Allele.speciesAustere = new AlleleBeeSpecies("speciesAustere", false, "bees.species.austere", austere, "correpere", 0xfffac2, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 7), 20).addSpecialty(ForestryItem.beeComb.getItemStack(1, 10), 50).setHasEffect() - .setIsSecret().setTemperature(EnumTemperature.HOT).setHumidity(EnumHumidity.ARID); + .addProduct(ForestryItem.beeComb.getItemStack(1, 7), 20).addSpecialty(ForestryItem.beeComb.getItemStack(1, 10), 50).setHasEffect() + .setIsSecret().setTemperature(EnumTemperature.HOT).setHumidity(EnumHumidity.ARID); // / Tropical Branch Allele.speciesTropical = new AlleleBeeSpecies("speciesTropical", false, "bees.species.tropical", tropical, "mendelia", 0x378020, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 6), 20).setEntityTexture("tropicalBee").setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); + .addProduct(ForestryItem.beeComb.getItemStack(1, 6), 20).setEntityTexture("tropicalBee").setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); Allele.speciesExotic = new AlleleBeeSpecies("speciesExotic", true, "bees.species.exotic", tropical, "darwini", 0x304903, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 6), 30).setEntityTexture("tropicalBee").setIsSecret().setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); + .addProduct(ForestryItem.beeComb.getItemStack(1, 6), 30).setEntityTexture("tropicalBee").setIsSecret().setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); Allele.speciesEdenic = new AlleleBeeSpecies("speciesEdenic", false, "bees.species.edenic", tropical, "humboldti", 0x393d0d, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 6), 20).setEntityTexture("tropicalBee").setHasEffect().setIsSecret().setTemperature(EnumTemperature.WARM) - .setHumidity(EnumHumidity.DAMP); + .addProduct(ForestryItem.beeComb.getItemStack(1, 6), 20).setEntityTexture("tropicalBee").setHasEffect().setIsSecret().setTemperature(EnumTemperature.WARM) + .setHumidity(EnumHumidity.DAMP); // End Branch Allele.speciesEnded = new AlleleBeeSpecies("speciesEnded", false, "bees.species.ender", end, "notchi", 0xe079fa, 0xd9de9e) - .addProduct(ForestryItem.beeComb.getItemStack(1, 8), 30).setEntityTexture("endBee").setIsSecret().setTemperature(EnumTemperature.COLD); + .addProduct(ForestryItem.beeComb.getItemStack(1, 8), 30).setEntityTexture("endBee").setIsSecret().setTemperature(EnumTemperature.COLD); Allele.speciesSpectral = new AlleleBeeSpecies("speciesSpectral", true, "bees.species.spectral", end, "idolum", 0xa98bed, 0xd9de9e) // 0xa98bed - .addProduct(ForestryItem.beeComb.getItemStack(1, 8), 50).setEntityTexture("endBee").setIsSecret().setTemperature(EnumTemperature.COLD); + .addProduct(ForestryItem.beeComb.getItemStack(1, 8), 50).setEntityTexture("endBee").setIsSecret().setTemperature(EnumTemperature.COLD); Allele.speciesPhantasmal = new AlleleBeeSpecies("speciesPhantasmal", false, "bees.species.phantasmal", end, "lemur", 0xcc00fa, 0xd9de9e) // 0x31023a // - // 0x8bc3ed - .addProduct(ForestryItem.beeComb.getItemStack(1, 8), 40).setEntityTexture("endBee").setIsSecret().setHasEffect().setTemperature(EnumTemperature.COLD); + // 0x8bc3ed + .addProduct(ForestryItem.beeComb.getItemStack(1, 8), 40).setEntityTexture("endBee").setIsSecret().setHasEffect().setTemperature(EnumTemperature.COLD); // Frozen Branch Allele.speciesWintry = new AlleleBeeSpecies("speciesWintry", false, "bees.species.wintry", frozen, "brumalis", 0xa0ffc8, 0xdaf5f3).addProduct( ForestryItem.beeComb.getItemStack(1, 4), 30).setEntityTexture("icyBee").setTemperature(EnumTemperature.ICY); Allele.speciesIcy = new AlleleBeeSpecies("speciesIcy", true, "bees.species.icy", frozen, "coagulis", 0xa0ffff, 0xdaf5f3) - .addProduct(ForestryItem.beeComb.getItemStack(1, 4), 20).setEntityTexture("icyBee").addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 20) - .setTemperature(EnumTemperature.ICY).setIsSecret(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 4), 20).setEntityTexture("icyBee").addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 20) + .setTemperature(EnumTemperature.ICY).setIsSecret(); Allele.speciesGlacial = new AlleleBeeSpecies("speciesGlacial", false, "bees.species.glacial", frozen, "glacialis", 0xefffff, 0xdaf5f3) - .addProduct(ForestryItem.beeComb.getItemStack(1, 4), 20).setEntityTexture("icyBee").addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 40) - .setTemperature(EnumTemperature.ICY).setHasEffect().setIsSecret(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 4), 20).setEntityTexture("icyBee").addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 40) + .setTemperature(EnumTemperature.ICY).setHasEffect().setIsSecret(); // Vengeful Branch Allele.speciesVindictive = new AlleleBeeSpecies("speciesVindictive", false, "bees.species.vindictive", vengeful, "ultio", 0xeafff3, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 9), 25).setIsSecret().setIsNotCounted(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 9), 25).setIsSecret().setIsNotCounted(); Allele.speciesVengeful = new AlleleBeeSpecies("speciesVengeful", false, "bees.species.vengeful", vengeful, "punire", 0xc2de00, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 9), 40).setIsSecret().setIsNotCounted(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 9), 40).setIsSecret().setIsNotCounted(); Allele.speciesAvenging = new AlleleBeeSpecies("speciesAvenging", false, "bees.species.avenging", vengeful, "hostimentum", 0xddff00, 0xffdc16) - .addProduct(ForestryItem.beeComb.getItemStack(1, 9), 40).setIsSecret().setHasEffect().setIsNotCounted(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 9), 40).setIsSecret().setHasEffect().setIsNotCounted(); // Reddened Branch (EE) Allele.speciesDarkened = new AlleleBeeSpecies("speciesDarkened", false, "bees.species.darkened", reddened, "pahimas", 0xd7bee5, 0x260f29) - .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 100).addSpecialty(ForestryItem.beeComb.getItemStack(1, 12), 100) - .setJubilanceProvider(new JubilanceNone()).setIsSecret().setIsNotCounted(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 100).addSpecialty(ForestryItem.beeComb.getItemStack(1, 12), 100) + .setJubilanceProvider(new JubilanceNone()).setIsSecret().setIsNotCounted(); AlleleManager.alleleRegistry.blacklistAllele(Allele.speciesDarkened.getUID()); Allele.speciesReddened = new AlleleBeeSpecies("speciesReddened", false, "bees.species.reddened", reddened, "xenophos", 0xf8c1c1, 0x260f29) - .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 100).addSpecialty(ForestryItem.beeComb.getItemStack(1, 11), 100) - .setJubilanceProvider(new JubilanceNone()).setIsSecret().setIsNotCounted(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 100).addSpecialty(ForestryItem.beeComb.getItemStack(1, 11), 100) + .setJubilanceProvider(new JubilanceNone()).setIsSecret().setIsNotCounted(); AlleleManager.alleleRegistry.blacklistAllele(Allele.speciesReddened.getUID()); Allele.speciesOmega = new AlleleBeeSpecies("speciesOmega", false, "bees.species.omega", reddened, "slopokis", 0xfeff8f, 0x260f29) - .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 100).addSpecialty(ForestryItem.beeComb.getItemStack(1, 13), 100) - .setJubilanceProvider(new JubilanceNone()).setIsSecret().setIsNotCounted(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 100).addSpecialty(ForestryItem.beeComb.getItemStack(1, 13), 100) + .setJubilanceProvider(new JubilanceNone()).setIsSecret().setIsNotCounted(); AlleleManager.alleleRegistry.blacklistAllele(Allele.speciesOmega.getUID()); // Festive branch Allele.speciesLeporine = new AlleleBeeSpecies("speciesLeporine", false, "bees.species.leporine", festive, "lepus", 0xfeff8f, 0x3cd757) - .addProduct(ForestryItem.beeComb.getItemStack(1, 6), 30).addProduct(new ItemStack(Items.egg), 10).setIsSecret().setIsNotCounted() - .setHasEffect(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 6), 30).addProduct(new ItemStack(Items.egg), 10).setIsSecret().setIsNotCounted() + .setHasEffect(); Allele.speciesMerry = new AlleleBeeSpecies("speciesMerry", false, "bees.species.merry", festive, "feliciter", 0xffffff, 0xd40000) - .addProduct(ForestryItem.beeComb.getItemStack(1, 4), 30).addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 20) - .setTemperature(EnumTemperature.ICY).setIsSecret().setIsNotCounted().setHasEffect(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 4), 30).addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 20) + .setTemperature(EnumTemperature.ICY).setIsSecret().setIsNotCounted().setHasEffect(); Allele.speciesTipsy = new AlleleBeeSpecies("speciesTipsy", false, "bees.species.tipsy", festive, "ebrius", 0xffffff, 0xc219ec) - .addProduct(ForestryItem.beeComb.getItemStack(1, 4), 30).addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 20) - .setTemperature(EnumTemperature.ICY).setIsSecret().setIsNotCounted().setHasEffect(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 4), 30).addProduct(ForestryItem.craftingMaterial.getItemStack(1, 5), 20) + .setTemperature(EnumTemperature.ICY).setIsSecret().setIsNotCounted().setHasEffect(); // 35 Solstice Allele.speciesTricky = new AlleleBeeSpecies("speciesTricky", false, "bees.species.tricky", festive, "libita", 0x49413B, 0xFF6A00) - .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 40).addProduct(new ItemStack(Items.cookie), 15) - .addSpecialty(new ItemStack(Items.skull, 1, 0), 2).addSpecialty(new ItemStack(Items.skull, 1, 2), 2) - .addSpecialty(new ItemStack(Items.skull, 1, 3), 2).addSpecialty(new ItemStack(Items.skull, 1, 4), 2) - .setIsSecret().setIsNotCounted().setHasEffect(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 0), 40).addProduct(new ItemStack(Items.cookie), 15) + .addSpecialty(new ItemStack(Items.skull, 1, 0), 2).addSpecialty(new ItemStack(Items.skull, 1, 2), 2) + .addSpecialty(new ItemStack(Items.skull, 1, 3), 2).addSpecialty(new ItemStack(Items.skull, 1, 4), 2) + .setIsSecret().setIsNotCounted().setHasEffect(); // 37 Thanksgiving // Agrarian branch @@ -930,12 +961,12 @@ public class PluginApiculture extends NativePlugin { // Monastic branch Allele.speciesMonastic = new AlleleBeeSpecies("speciesMonastic", false, "bees.species.monastic", monastic, "monachus", 0x42371c, 0xfff7b6) - .addProduct(ForestryItem.beeComb.getItemStack(1, 14), 30).addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 10) - .setJubilanceProvider(new JubilanceProviderHermit()).setIsSecret(); + .addProduct(ForestryItem.beeComb.getItemStack(1, 14), 30).addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 10) + .setJubilanceProvider(new JubilanceProviderHermit()).setIsSecret(); Allele.speciesSecluded = new AlleleBeeSpecies("speciesSecluded", true, "bees.species.secluded", monastic, "contractus", 0x7b6634, 0xfff7b6) - .addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 20).setJubilanceProvider(new JubilanceProviderHermit()).setIsSecret(); + .addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 20).setJubilanceProvider(new JubilanceProviderHermit()).setIsSecret(); Allele.speciesHermitic = new AlleleBeeSpecies("speciesHermitic", false, "bees.species.hermitic", monastic, "anachoreta", 0xffd46c, 0xfff7b6) - .addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 20).setJubilanceProvider(new JubilanceProviderHermit()).setHasEffect().setIsSecret(); + .addSpecialty(ForestryItem.beeComb.getItemStack(1, 16), 20).setJubilanceProvider(new JubilanceProviderHermit()).setHasEffect().setIsSecret(); // / BEES // FLOWER PROVIDERS 1500 - 1599 Allele.flowersVanilla = new AlleleFlowers("flowersVanilla", new FlowerProviderVanilla(), true); @@ -1007,20 +1038,20 @@ public class PluginApiculture extends NativePlugin { BeeTemplates.industriousA = new BeeMutation(Allele.speciesDiligent, Allele.speciesUnweary, BeeTemplates.getIndustriousTemplate(), 8); BeeTemplates.heroicA = new BeeMutation(Allele.speciesSteadfast, Allele.speciesValiant, BeeTemplates.getHeroicTemplate(), 6) - .restrictBiomeType(BiomeDictionary.Type.FOREST).enableStrictBiomeCheck(); + .restrictBiomeType(BiomeDictionary.Type.FOREST).enableStrictBiomeCheck(); BeeTemplates.sinisterA = new BeeMutation(Allele.speciesModest, Allele.speciesCultivated, BeeTemplates.getSinisterTemplate(), 60) - .restrictBiomeType(BiomeDictionary.Type.NETHER); + .restrictBiomeType(BiomeDictionary.Type.NETHER); BeeTemplates.sinisterB = new BeeMutation(Allele.speciesTropical, Allele.speciesCultivated, BeeTemplates.getSinisterTemplate(), 60) - .restrictBiomeType(BiomeDictionary.Type.NETHER); + .restrictBiomeType(BiomeDictionary.Type.NETHER); BeeTemplates.fiendishA = new BeeMutation(Allele.speciesSinister, Allele.speciesCultivated, BeeTemplates.getFiendishTemplate(), 40) - .restrictBiomeType(BiomeDictionary.Type.NETHER); + .restrictBiomeType(BiomeDictionary.Type.NETHER); BeeTemplates.fiendishB = new BeeMutation(Allele.speciesSinister, Allele.speciesModest, BeeTemplates.getFiendishTemplate(), 40) - .restrictBiomeType(BiomeDictionary.Type.NETHER); + .restrictBiomeType(BiomeDictionary.Type.NETHER); BeeTemplates.fiendishC = new BeeMutation(Allele.speciesSinister, Allele.speciesTropical, BeeTemplates.getFiendishTemplate(), 40) - .restrictBiomeType(BiomeDictionary.Type.NETHER); + .restrictBiomeType(BiomeDictionary.Type.NETHER); BeeTemplates.demonicA = new BeeMutation(Allele.speciesSinister, Allele.speciesFiendish, BeeTemplates.getDemonicTemplate(), 25) - .restrictBiomeType(BiomeDictionary.Type.NETHER); + .restrictBiomeType(BiomeDictionary.Type.NETHER); // Austere branch BeeTemplates.frugalA = new BeeMutation(Allele.speciesModest, Allele.speciesSinister, BeeTemplates.getFrugalTemplate(), 16).setTemperatureRainfall(1.9f, @@ -1050,7 +1081,7 @@ public class PluginApiculture extends NativePlugin { // Agrarian branch BeeTemplates.ruralA = new BeeMutation(Allele.speciesMeadows, Allele.speciesDiligent, BeeTemplates.getRuralTemplate(), 12) - .restrictBiomeType(BiomeDictionary.Type.PLAINS).enableStrictBiomeCheck(); + .restrictBiomeType(BiomeDictionary.Type.PLAINS).enableStrictBiomeCheck(); // Monastic branch BeeTemplates.secludedA = new BeeMutation(Allele.speciesMonastic, Allele.speciesAustere, BeeTemplates.getSecludedTemplate(), 12); @@ -1172,37 +1203,33 @@ public class PluginApiculture extends NativePlugin { @Override public ICommand[] getConsoleCommands() { - return new ICommand[] { new CommandBeekeepingMode(), new CommandGiveBee(EnumBeeType.DRONE), new CommandGiveBee(EnumBeeType.PRINCESS), - new CommandGiveBee(EnumBeeType.QUEEN), }; + return new ICommand[]{new CommandBeekeepingMode(), new CommandGiveBee(EnumBeeType.DRONE), new CommandGiveBee(EnumBeeType.PRINCESS), + new CommandGiveBee(EnumBeeType.QUEEN),}; } @Override public boolean processIMCMessage(IMCMessage message) { if (message.key.equals("add-candle-lighting-id")) { ItemStack value = message.getItemStackValue(); - if (value != null) { - ((BlockCandle) ForestryBlock.candle).addItemToLightingList(value.getItem()); - } else { + if (value != null) + ((BlockCandle) ForestryBlock.candle.block()).addItemToLightingList(value.getItem()); + else Logger.getLogger("Forestry").log(Level.WARNING, "Recieved an invalid 'add-candle-lighting-id' request from mod %s. Please contact the author and report this issue.", message.getSender()); - } return true; - } - else if (message.key.equals("add-alveary-slab") && message.isStringMessage()) { + } else if (message.key.equals("add-alveary-slab") && message.isStringMessage()) try { Block block = GameData.getBlockRegistry().getRaw(message.getStringValue()); - if (block == null || block == Blocks.air) { + if (block == null || block == Blocks.air) Logger.getLogger("Forestry").log(Level.WARNING, "Recieved an invalid 'add-alveary-slab' request from mod %s. Please contact the author and report this issue.", message.getSender()); - } else { + else StructureLogicAlveary.slabBlocks.add(block); - } } catch (Exception e) { } - } return super.processIMCMessage(message); } @@ -1211,9 +1238,8 @@ public class PluginApiculture extends NativePlugin { public void textureHook(TextureStitchEvent.Pre event) { if (event.map.getTextureType() == 1) { EntitySnowFX.icons = new IIcon[3]; - for (int i = 0; i < EntitySnowFX.icons.length; i++) { + for (int i = 0; i < EntitySnowFX.icons.length; i++) EntitySnowFX.icons[i] = event.map.registerIcon("forestry:particles/snow." + (i + 1)); - } } } } diff --git a/src/main/java/forestry/plugins/PluginArboriculture.java b/src/main/java/forestry/plugins/PluginArboriculture.java index 1b3dd4e4c..8c272876f 100755 --- a/src/main/java/forestry/plugins/PluginArboriculture.java +++ b/src/main/java/forestry/plugins/PluginArboriculture.java @@ -142,6 +142,7 @@ import forestry.core.proxy.Proxies; import forestry.core.utils.LiquidHelper; import forestry.core.utils.RecipeUtil; import forestry.core.utils.ShapedRecipeCustom; +import java.util.EnumSet; @PluginInfo(pluginID = "Arboriculture", name = "Arboriculture", author = "Binnie & SirSengir", url = Defaults.URL, description = "Adds additional tree species and products.") public class PluginArboriculture extends NativePlugin implements IFuelHandler { @@ -156,6 +157,24 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { public static ITreeRoot treeInterface; public static MachineDefinition definitionChest; public static List validFences = new ArrayList(); + private static final EnumSet logs = EnumSet.of( + ForestryBlock.log1, + ForestryBlock.log2, + ForestryBlock.log3, + ForestryBlock.log4, + ForestryBlock.log5, + ForestryBlock.log6, + ForestryBlock.log7); + private static final EnumSet planks = EnumSet.of( + ForestryBlock.planks1, + ForestryBlock.planks2); + private static final EnumSet slabs = EnumSet.of( + ForestryBlock.slabs1, + ForestryBlock.slabs2, + ForestryBlock.slabs3); + private static final EnumSet fences = EnumSet.of( + ForestryBlock.fences1, + ForestryBlock.fences1); @Override public boolean isAvailable() { @@ -166,139 +185,76 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { public void preInit() { super.preInit(); - ForestryBlock.log1 = new BlockLog(LogCat.CAT0).setBlockName("for.log1"); - Proxies.common.registerBlock(ForestryBlock.log1, ItemWoodBlock.class); - ForestryBlock.log1.setHarvestLevel("axe", 0); + ForestryBlock.log1.registerBlock(new BlockLog(LogCat.CAT0), ItemWoodBlock.class, "log1"); + ForestryBlock.log2.registerBlock(new BlockLog(LogCat.CAT1), ItemWoodBlock.class, "log2"); + ForestryBlock.log3.registerBlock(new BlockLog(LogCat.CAT2), ItemWoodBlock.class, "log3"); + ForestryBlock.log4.registerBlock(new BlockLog(LogCat.CAT3), ItemWoodBlock.class, "log4"); + ForestryBlock.log5.registerBlock(new BlockLog(LogCat.CAT4), ItemWoodBlock.class, "log5"); + ForestryBlock.log6.registerBlock(new BlockLog(LogCat.CAT5), ItemWoodBlock.class, "log6"); + ForestryBlock.log7.registerBlock(new BlockLog(LogCat.CAT6), ItemWoodBlock.class, "log7"); - ForestryBlock.log2 = new BlockLog(LogCat.CAT1).setBlockName("for.log2"); - Proxies.common.registerBlock(ForestryBlock.log2, ItemWoodBlock.class); - ForestryBlock.log2.setHarvestLevel("axe", 0); + for (ForestryBlock log : logs) { + log.block().setHarvestLevel("axe", 0); + OreDictionary.registerOre("logWood", log.getWildcard()); + FurnaceRecipes.smelting().func_151393_a(log.block(), new ItemStack(Items.coal, 1, 1), 0.15F); + } - ForestryBlock.log3 = new BlockLog(LogCat.CAT2).setBlockName("for.log3"); - Proxies.common.registerBlock(ForestryBlock.log3, ItemWoodBlock.class); - ForestryBlock.log3.setHarvestLevel("axe", 0); + ForestryBlock.planks1.registerBlock(new BlockPlanks(PlankCat.CAT0), ItemWoodBlock.class, "planks"); + ForestryBlock.planks2.registerBlock(new BlockPlanks(PlankCat.CAT1), ItemWoodBlock.class, "planks2"); - ForestryBlock.log4 = new BlockLog(LogCat.CAT3).setBlockName("for.log4"); - Proxies.common.registerBlock(ForestryBlock.log4, ItemWoodBlock.class); - ForestryBlock.log4.setHarvestLevel("axe", 0); + for (ForestryBlock plank : planks) { + plank.block().setHarvestLevel("axe", 0); + OreDictionary.registerOre("plankWood", plank.getWildcard()); + } - ForestryBlock.log5 = new BlockLog(LogCat.CAT4).setBlockName("for.log5"); - Proxies.common.registerBlock(ForestryBlock.log5, ItemWoodBlock.class); - ForestryBlock.log5.setHarvestLevel("axe", 0); + ForestryBlock.slabs1.registerBlock(new BlockSlab(SlabCat.CAT0), ItemWoodBlock.class, "slabs1"); + ForestryBlock.slabs2.registerBlock(new BlockSlab(SlabCat.CAT1), ItemWoodBlock.class, "slabs2"); + ForestryBlock.slabs3.registerBlock(new BlockSlab(SlabCat.CAT2), ItemWoodBlock.class, "slabs3"); - ForestryBlock.log6 = new BlockLog(LogCat.CAT5).setBlockName("for.log6"); - Proxies.common.registerBlock(ForestryBlock.log6, ItemWoodBlock.class); - ForestryBlock.log6.setHarvestLevel("axe", 0); - - ForestryBlock.log7 = new BlockLog(LogCat.CAT6).setBlockName("for.log7"); - Proxies.common.registerBlock(ForestryBlock.log7, ItemWoodBlock.class); - ForestryBlock.log7.setHarvestLevel("axe", 0); - - // Register as workableLogs - OreDictionary.registerOre("logWood", - new ItemStack(ForestryBlock.log1, 1, Defaults.WILDCARD)); - OreDictionary.registerOre("logWood", - new ItemStack(ForestryBlock.log2, 1, Defaults.WILDCARD)); - OreDictionary.registerOre("logWood", - new ItemStack(ForestryBlock.log3, 1, Defaults.WILDCARD)); - OreDictionary.registerOre("logWood", - new ItemStack(ForestryBlock.log4, 1, Defaults.WILDCARD)); - OreDictionary.registerOre("logWood", - new ItemStack(ForestryBlock.log5, 1, Defaults.WILDCARD)); - OreDictionary.registerOre("logWood", - new ItemStack(ForestryBlock.log6, 1, Defaults.WILDCARD)); - OreDictionary.registerOre("logWood", - new ItemStack(ForestryBlock.log7, 1, Defaults.WILDCARD)); - - // Register smelting - FurnaceRecipes.smelting().func_151393_a(ForestryBlock.log1, - new ItemStack(Items.coal, 1, 1), 0.15F); - FurnaceRecipes.smelting().func_151393_a(ForestryBlock.log2, - new ItemStack(Items.coal, 1, 1), 0.15F); - FurnaceRecipes.smelting().func_151393_a(ForestryBlock.log3, - new ItemStack(Items.coal, 1, 1), 0.15F); - FurnaceRecipes.smelting().func_151393_a(ForestryBlock.log4, - new ItemStack(Items.coal, 1, 1), 0.15F); - FurnaceRecipes.smelting().func_151393_a(ForestryBlock.log5, - new ItemStack(Items.coal, 1, 1), 0.15F); - FurnaceRecipes.smelting().func_151393_a(ForestryBlock.log6, - new ItemStack(Items.coal, 1, 1), 0.15F); - - ForestryBlock.planks1 = new BlockPlanks(PlankCat.CAT0).setBlockName("for.planks"); - Proxies.common.registerBlock(ForestryBlock.planks1, ItemWoodBlock.class); - ForestryBlock.planks1.setHarvestLevel("axe", 0); - - ForestryBlock.planks2 = new BlockPlanks(PlankCat.CAT1).setBlockName("for.planks2"); - Proxies.common.registerBlock(ForestryBlock.planks2, ItemWoodBlock.class); - ForestryBlock.planks2.setHarvestLevel("axe", 0); - - // Register as craftablePlanks - OreDictionary.registerOre("plankWood", new ItemStack(ForestryBlock.planks1, 1, - Defaults.WILDCARD)); - OreDictionary.registerOre("plankWood", new ItemStack(ForestryBlock.planks2, 1, - Defaults.WILDCARD)); - - ForestryBlock.slabs1 = new BlockSlab(SlabCat.CAT0).setBlockName("for.slabs1"); - Proxies.common.registerBlock(ForestryBlock.slabs1, ItemWoodBlock.class); - ForestryBlock.slabs1.setHarvestLevel("axe", 0); - - ForestryBlock.slabs2 = new BlockSlab(SlabCat.CAT1).setBlockName("for.slabs2"); - Proxies.common.registerBlock(ForestryBlock.slabs2, ItemWoodBlock.class); - ForestryBlock.slabs2.setHarvestLevel("axe", 0); - - ForestryBlock.slabs3 = new BlockSlab(SlabCat.CAT2).setBlockName("for.slabs3"); - Proxies.common.registerBlock(ForestryBlock.slabs3, ItemWoodBlock.class); - ForestryBlock.slabs3.setHarvestLevel("axe", 0); - - OreDictionary.registerOre("slabWood", new ItemStack(ForestryBlock.slabs1, 1, - Defaults.WILDCARD)); - OreDictionary.registerOre("slabWood", new ItemStack(ForestryBlock.slabs2, 1, - Defaults.WILDCARD)); - OreDictionary.registerOre("slabWood", new ItemStack(ForestryBlock.slabs3, 1, - Defaults.WILDCARD)); + for (ForestryBlock plank : slabs) { + plank.block().setHarvestLevel("axe", 0); + OreDictionary.registerOre("slabWood", plank.getWildcard()); + } // Fences - ForestryBlock.fences1 = new BlockArbFence(FenceCat.CAT0).setBlockName("for.fences"); - Proxies.common.registerBlock(ForestryBlock.fences1, ItemWoodBlock.class); - ForestryBlock.fences1.setHarvestLevel("axe", 0); + ForestryBlock.fences1.registerBlock(new BlockArbFence(FenceCat.CAT0), ItemWoodBlock.class, "fences"); + ForestryBlock.fences2.registerBlock(new BlockArbFence(FenceCat.CAT1), ItemWoodBlock.class, "fences2"); - ForestryBlock.fences2 = new BlockArbFence(FenceCat.CAT1).setBlockName("for.fences2"); - Proxies.common.registerBlock(ForestryBlock.fences2, ItemWoodBlock.class); - ForestryBlock.fences2.setHarvestLevel("axe", 0); + for (ForestryBlock block : fences) { + block.block().setHarvestLevel("axe", 0); + OreDictionary.registerOre("fenceWood", block.getWildcard()); + } // Stairs - ForestryBlock.stairs = new BlockArbStairs(ForestryBlock.planks1, 0) .setBlockName("for.stairs"); - Proxies.common.registerBlock(ForestryBlock.stairs, ItemStairs.class); - ForestryBlock.stairs.setHarvestLevel("axe", 0); + ForestryBlock.stairs.registerBlock(new BlockArbStairs(ForestryBlock.planks1.block(), 0), ItemStairs.class, "stairs"); + ForestryBlock.stairs.block().setHarvestLevel("axe", 0); // Saplings - ForestryBlock.saplingGE = new BlockSapling().setBlockName("saplingGE"); - Proxies.common.registerBlock(ForestryBlock.saplingGE, ItemForestryBlock.class); + ForestryBlock.saplingGE.registerBlock(new BlockSapling(), ItemForestryBlock.class, "saplingGE"); // Leaves - ForestryBlock.leaves = new BlockLeaves().setBlockName("leaves"); - Proxies.common.registerBlock(ForestryBlock.leaves, ItemForestryBlock.class); + ForestryBlock.leaves.registerBlock(new BlockLeaves(), ItemForestryBlock.class, "leaves"); // Pods - ForestryBlock.pods = new BlockFruitPod().setBlockName("for.pods"); - Proxies.common.registerBlock(ForestryBlock.pods, ItemForestryBlock.class); + ForestryBlock.pods.registerBlock(new BlockFruitPod(), ItemForestryBlock.class, "pods"); // Machines - ForestryBlock.arboriculture = new BlockBase(Material.iron); - ForestryBlock.arboriculture.setBlockName("for.arboriculture").setCreativeTab(Tabs.tabArboriculture); - Proxies.common.registerBlock(ForestryBlock.arboriculture, ItemForestryBlock.class); + ForestryBlock.arboriculture.registerBlock(new BlockBase(Material.iron), ItemForestryBlock.class, "arboriculture"); + ForestryBlock.arboriculture.block().setCreativeTab(Tabs.tabArboriculture); - definitionChest = ForestryBlock.arboriculture.addDefinition(new MachineDefinition(Defaults.DEFINITION_ARBCHEST_META, + definitionChest = ((BlockBase) ForestryBlock.arboriculture.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_ARBCHEST_META, "forestry.ArbChest", TileArboristChest.class, - ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.arboriculture, - 1, Defaults.DEFINITION_ARBCHEST_META), new Object[] { " # ", "XYX", "XXX", '#', - Blocks.glass, 'X', "treeSapling", 'Y', Blocks.chest })).setFaces(0, 1, 2, 3, 4, 4, 0, 7)); - - + ShapedRecipeCustom.createShapedRecipe(ForestryBlock.arboriculture.getItemStack(1, Defaults.DEFINITION_ARBCHEST_META), + " # ", + "XYX", + "XXX", + '#', Blocks.glass, + 'X', "treeSapling", + 'Y', Blocks.chest)) + .setFaces(0, 1, 2, 3, 4, 4, 0, 7)); // Init tree interface - AlleleManager.alleleRegistry - .registerSpeciesRoot(PluginArboriculture.treeInterface = TreeManager.treeInterface = new TreeHelper()); + AlleleManager.alleleRegistry.registerSpeciesRoot(PluginArboriculture.treeInterface = TreeManager.treeInterface = new TreeHelper()); // Init rendering proxy.initializeRendering(); @@ -307,8 +263,8 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { createAlleles(); // Register vanilla and forestry fence ids - validFences.add(ForestryBlock.fences1); - validFences.add(ForestryBlock.fences2); + validFences.add(ForestryBlock.fences1.block()); + validFences.add(ForestryBlock.fences2.block()); validFences.add(Blocks.fence); validFences.add(Blocks.fence_gate); validFences.add(Blocks.nether_brick_fence); @@ -369,34 +325,20 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { if (BackpackManager.backpackItems == null) return; - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryBlock.log1, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryBlock.log2, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryBlock.log3, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryBlock.log4, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryBlock.log5, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryBlock.log6, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryBlock.log7, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryItem.sapling.item(), 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("forester").addValidItem(new ItemStack(ForestryItem.fruits.item(), 1, Defaults.WILDCARD)); + for (ForestryBlock block : logs) + BackpackManager.definitions.get("forester").addValidItem(block.getWildcard()); - BackpackManager.definitions.get("builder").addValidItem( - new ItemStack(ForestryBlock.stairs, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("builder").addValidItem( - new ItemStack(ForestryBlock.slabs1, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("builder").addValidItem( - new ItemStack(ForestryBlock.slabs2, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("builder").addValidItem( - new ItemStack(ForestryBlock.slabs3, 1, Defaults.WILDCARD)); - // BackpackManager.definitions.item("builder").addValidItem(new - // ItemStack(ForestryBlock.slabs4, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("builder").addValidItem( - new ItemStack(ForestryBlock.fences1, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("builder").addValidItem( - new ItemStack(ForestryBlock.fences2, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("builder").addValidItem( - new ItemStack(ForestryBlock.planks1, 1, Defaults.WILDCARD)); - BackpackManager.definitions.get("builder").addValidItem( - new ItemStack(ForestryBlock.planks2, 1, Defaults.WILDCARD)); + BackpackManager.definitions.get("forester").addValidItem(ForestryItem.sapling.getWildcard()); + BackpackManager.definitions.get("forester").addValidItem(ForestryItem.fruits.getWildcard()); + + for (ForestryBlock block : slabs) + BackpackManager.definitions.get("builder").addValidItem(block.getWildcard()); + for (ForestryBlock block : fences) + BackpackManager.definitions.get("builder").addValidItem(block.getWildcard()); + for (ForestryBlock block : planks) + BackpackManager.definitions.get("builder").addValidItem(block.getWildcard()); + + BackpackManager.definitions.get("builder").addValidItem(ForestryBlock.stairs.getWildcard()); } @Override @@ -407,66 +349,49 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { protected void registerRecipes() { // / Plank recipes - for (int i = 0; i < 4; i++) { - Proxies.common.addShapelessRecipe(new ItemStack(ForestryBlock.planks1, 4, i), - new ItemStack(ForestryBlock.log1, 1, i)); - } - for (int i = 0; i < 4; i++) { - Proxies.common.addShapelessRecipe(new ItemStack(ForestryBlock.planks1, 4, 4 + i), - new ItemStack(ForestryBlock.log2, 1, i)); - } - for (int i = 0; i < 4; i++) { - Proxies.common.addShapelessRecipe(new ItemStack(ForestryBlock.planks1, 4, 8 + i), - new ItemStack(ForestryBlock.log3, 1, i)); - } - for (int i = 0; i < 4; i++) { - Proxies.common.addShapelessRecipe(new ItemStack(ForestryBlock.planks1, 4, 12 + i), - new ItemStack(ForestryBlock.log4, 1, i)); - } - for (int i = 0; i < 4; i++) { - Proxies.common.addShapelessRecipe(new ItemStack(ForestryBlock.planks2, 4, i), - new ItemStack(ForestryBlock.log5, 1, i)); - } - for (int i = 0; i < 4; i++) { - Proxies.common.addShapelessRecipe(new ItemStack(ForestryBlock.planks2, 4, 4 + i), - new ItemStack(ForestryBlock.log6, 1, i)); - } + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.planks1.getItemStack(4, i), ForestryBlock.log1.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.planks1.getItemStack(4, 4 + i), ForestryBlock.log2.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.planks1.getItemStack(4, 8 + i), ForestryBlock.log3.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.planks1.getItemStack(4, 12 + i), ForestryBlock.log4.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.planks2.getItemStack(4, i), ForestryBlock.log5.getItemStack(1, i)); + for (int i = 0; i < 4; i++) + Proxies.common.addShapelessRecipe(ForestryBlock.planks2.getItemStack(4, 4 + i), ForestryBlock.log6.getItemStack(1, i)); // Slab recipes - for (int i = 0; i < 8; i++) { - Proxies.common.addPriorityRecipe(new ItemStack(ForestryBlock.slabs1, 6, i), "###", '#', new ItemStack(ForestryBlock.planks1, 1, i)); - } - for (int i = 0; i < 8; i++) { - Proxies.common.addPriorityRecipe(new ItemStack(ForestryBlock.slabs2, 6, i), "###", '#', new ItemStack(ForestryBlock.planks1, 1, 8 + i)); - } - for (int i = 0; i < 8; i++) { - Proxies.common.addPriorityRecipe(new ItemStack(ForestryBlock.slabs3, 6, i), "###", '#', new ItemStack(ForestryBlock.planks2, 1, i)); - } + for (int i = 0; i < 8; i++) + Proxies.common.addPriorityRecipe(ForestryBlock.slabs1.getItemStack(6, i), "###", '#', ForestryBlock.planks1.getItemStack(1, i)); + for (int i = 0; i < 8; i++) + Proxies.common.addPriorityRecipe(ForestryBlock.slabs2.getItemStack(6, i), "###", '#', ForestryBlock.planks1.getItemStack(1, 8 + i)); + for (int i = 0; i < 8; i++) + Proxies.common.addPriorityRecipe(ForestryBlock.slabs3.getItemStack(6, i), "###", '#', ForestryBlock.planks2.getItemStack(1, i)); // Fence recipes - for (int i = 0; i < 16; i++) { - Proxies.common.addRecipe(new ItemStack(ForestryBlock.fences1, 4, i), "###", "# #", '#', new ItemStack(ForestryBlock.planks1, 1, i)); - } - for (int i = 0; i < 8; i++) { - Proxies.common.addRecipe(new ItemStack(ForestryBlock.fences2, 4, i), "###", "# #", '#', new ItemStack(ForestryBlock.planks2, 1, i)); - } + for (int i = 0; i < 16; i++) + Proxies.common.addRecipe(ForestryBlock.fences1.getItemStack(4, i), "###", "# #", '#', ForestryBlock.planks1.getItemStack(1, i)); + for (int i = 0; i < 8; i++) + Proxies.common.addRecipe(ForestryBlock.fences2.getItemStack(4, i), "###", "# #", '#', ForestryBlock.planks2.getItemStack(1, i)); // Treealyzer - RecipeManagers.carpenterManager.addRecipe(100, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 2000), null, ForestryItem.treealyzer.getItemStack(), new Object[] { + RecipeManagers.carpenterManager.addRecipe(100, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 2000), null, ForestryItem.treealyzer.getItemStack(), new Object[]{ "X#X", "X#X", "RDR", '#', Blocks.glass_pane, 'X', "ingotCopper", 'R', Items.redstone, - 'D', Items.diamond }); + 'D', Items.diamond}); // SQUEEZER RECIPES - RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[] { ForestryItem.fruits.getItemStack(1, EnumFruit.CHERRY.ordinal()) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 5 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 5); - RecipeManagers.squeezerManager.addRecipe(60, new ItemStack[] { ForestryItem.fruits.getItemStack(1, EnumFruit.WALNUT.ordinal()) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 18 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 5); - RecipeManagers.squeezerManager.addRecipe(70, new ItemStack[] { ForestryItem.fruits.getItemStack(1, EnumFruit.CHESTNUT.ordinal()) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 22 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 2); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.fruits.getItemStack(1, EnumFruit.LEMON.ordinal()) }, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 2), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 0.5f)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.fruits.getItemStack(1, EnumFruit.PLUM.ordinal()) }, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 0.5f)), ForestryItem.mulch.getItemStack(), GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 3); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.fruits.getItemStack(1, EnumFruit.PAPAYA.ordinal()) }, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 3), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 0.5f)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.fruits.getItemStack(1, EnumFruit.DATES.ordinal()) }, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 0.25)), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple"))); + RecipeManagers.squeezerManager.addRecipe(20, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.CHERRY.ordinal())}, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 5 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 5); + RecipeManagers.squeezerManager.addRecipe(60, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.WALNUT.ordinal())}, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 18 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 5); + RecipeManagers.squeezerManager.addRecipe(70, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.CHESTNUT.ordinal())}, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 22 * GameMode.getGameMode().getIntegerSetting("squeezer.liquid.seed")), ForestryItem.mulch.getItemStack(), 2); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.LEMON.ordinal())}, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 2), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 0.5f)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.PLUM.ordinal())}, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 0.5f)), ForestryItem.mulch.getItemStack(), GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 3); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.PAPAYA.ordinal())}, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 3), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple") * 0.5f)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.fruits.getItemStack(1, EnumFruit.DATES.ordinal())}, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple") * 0.25)), ForestryItem.mulch.getItemStack(), (int) Math.floor(GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple"))); RecipeUtil.injectLeveledRecipe(ForestryItem.sapling.getItemStack(), GameMode.getGameMode().getIntegerSetting("fermenter.yield.sapling"), Defaults.LIQUID_BIOMASS); @@ -476,20 +401,25 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { NBTTagCompound compound = new NBTTagCompound(); type.saveToCompound(compound); - ItemStack stairs = new ItemStack(ForestryBlock.stairs, 4, 0); + ItemStack stairs = ForestryBlock.stairs.getItemStack(4, 0); stairs.setTagCompound(compound); - Proxies.common.addPriorityRecipe(stairs, new Object[] { "# ", "## ", "###", '#', - new ItemStack(ForestryBlock.planks1, 1, i) }); + Proxies.common.addPriorityRecipe(stairs, + "# ", + "## ", + "###", '#', ForestryBlock.planks1.getItemStack(1, i)); } for (int i = 0; i < 8; i++) { WoodType type = WoodType.VALUES[16 + i]; NBTTagCompound compound = new NBTTagCompound(); type.saveToCompound(compound); - ItemStack stairs = new ItemStack(ForestryBlock.stairs, 4, 0); + ItemStack stairs = ForestryBlock.stairs.getItemStack(4, 0); stairs.setTagCompound(compound); - Proxies.common.addPriorityRecipe(stairs, new Object[] { "# ", "## ", "###", '#', - new ItemStack(ForestryBlock.planks2, 1, i) }); + Proxies.common.addPriorityRecipe(stairs, + "# ", + "## ", + "###", + '#', ForestryBlock.planks2.getItemStack(1, i)); } // Grafter @@ -710,24 +640,24 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { Allele.treeOak = new AlleleTreeSpecies("treeOak", false, "Apple Oak", quercus, "robur", proxy.getFoliageColorBasic(), WorldGenOak.class, new ItemStack(Blocks.log, 1, 0)).addFruitFamily(pomes) .setVanillaMap(0).setIsSecret(); - + Allele.treeDarkOak = new AlleleTreeSpecies("treeDarkOak", false, "Dark Oak", quercus, "velutina", proxy.getFoliageColorBasic(), WorldGenDarkOak.class, new ItemStack(Blocks.log2, 1, 1)).addFruitFamily(pomes) .setVanillaMap(5); - + Allele.treeBirch = new AlleleTreeSpecies("treeBirch", false, "Silver Birch", betula, "pendula", proxy.getFoliageColorBirch(), 0xb0c648, WorldGenBirch.class, new ItemStack(Blocks.log, 1, 2)) - .setVanillaMap(2).setIsSecret(); + .setVanillaMap(2).setIsSecret(); Allele.treeLime = new AlleleTreeSpecies("treeLime", true, "Silver Lime", tilia, - "tomentosa", 0x5ea107, WorldGenLime.class, new ItemStack(ForestryBlock.log1, 1, 3)).addFruitFamily(nux) + "tomentosa", 0x5ea107, WorldGenLime.class, ForestryBlock.log1.getItemStack(1, 3)).addFruitFamily(nux) .addFruitFamily(prunes).addFruitFamily(pomes); // Nucifera Allele.treeWalnut = new AlleleTreeSpecies("treeWalnut", true, "Common Walnut", juglans, - "regia", 0x798c55, 0xb0c648, WorldGenWalnut.class, new ItemStack(ForestryBlock.log4, 1, 1)).addFruitFamily(nux) + "regia", 0x798c55, 0xb0c648, WorldGenWalnut.class, ForestryBlock.log4.getItemStack(1, 1)).addFruitFamily(nux) .addFruitFamily(prunes).addFruitFamily(pomes).setGirth(2); Allele.treeChestnut = new AlleleTreeSpecies("treeChestnut", true, "Sweet Chestnut", - castanea, "sativa", 0x5ea107, 0xb0c648, WorldGenChestnut.class, new ItemStack(ForestryBlock.log2, 1, 0)).addFruitFamily(nux) + castanea, "sativa", 0x5ea107, 0xb0c648, WorldGenChestnut.class, ForestryBlock.log2.getItemStack(1, 0)).addFruitFamily(nux) .addFruitFamily(prunes).addFruitFamily(pomes).setGirth(2); // Prunus & Citrus @@ -735,49 +665,49 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { // bearing fruit year round, bearing fruit twice a year, bearing golden // fruit Allele.treeCherry = new AlleleTreeSpecies("treeCherry", true, "Hill Cherry", prunus, - "serrulata", 0xe691da, 0xe63e59, WorldGenCherry.class, new ItemStack(ForestryBlock.log4, 1, 3)).addFruitFamily(prunes) + "serrulata", 0xe691da, 0xe63e59, WorldGenCherry.class, ForestryBlock.log4.getItemStack(1, 3)).addFruitFamily(prunes) .addFruitFamily(pomes); Allele.treeLemon = new AlleleTreeSpecies("treeLemon", true, "Lemon", citrus, "limon", - 0x88af54, 0xa3b850, WorldGenLemon.class, new ItemStack(ForestryBlock.log6, 1, 3)).addFruitFamily(pomes).addFruitFamily( + 0x88af54, 0xa3b850, WorldGenLemon.class, ForestryBlock.log6.getItemStack(1, 3)).addFruitFamily(pomes).addFruitFamily( prunes); Allele.treePlum = new AlleleTreeSpecies("treePlum", true, "Plum", prunus, "domestica", - 0x589246, 0xa3b850, WorldGenPlum.class, new ItemStack(ForestryBlock.log6, 1, 1)).addFruitFamily(pomes) + 0x589246, 0xa3b850, WorldGenPlum.class, ForestryBlock.log6.getItemStack(1, 1)).addFruitFamily(pomes) .addFruitFamily(prunes); // Maples Allele.treeMaple = new AlleleTreeSpecies("treeMaple", true, "Sugar Maple", acer, - "saccharum", 0xd4f425, 0x619a3c, WorldGenMaple.class, new ItemStack(ForestryBlock.log6, 1, 2)).addFruitFamily(prunes) + "saccharum", 0xd4f425, 0x619a3c, WorldGenMaple.class, ForestryBlock.log6.getItemStack(1, 2)).addFruitFamily(prunes) .addFruitFamily(pomes).setLeafIndices("maple"); Allele.treeSpruce = new AlleleTreeSpecies("treeSpruce", false, "Red Spruce", picea, "abies", proxy.getFoliageColorPine(), 0x539d12, WorldGenSpruce.class, new ItemStack(Blocks.log, 1, 1)) - .setLeafIndices("conifers").setVanillaMap(1).setIsSecret(); + .setLeafIndices("conifers").setVanillaMap(1).setIsSecret(); Allele.treeLarch = new AlleleTreeSpecies("treeLarch", true, "Mundane Larch", larix, - "decidua", 0x698f90, 0x569896, WorldGenLarch.class, new ItemStack(ForestryBlock.log1, 1, 0)).setLeafIndices("conifers"); + "decidua", 0x698f90, 0x569896, WorldGenLarch.class, ForestryBlock.log1.getItemStack(1, 0)).setLeafIndices("conifers"); Allele.treePine = new AlleleTreeSpecies("treePine", true, "Bull Pine", pinus, "sabiniana", - 0xfeff8f, 0xffd98f, WorldGenPine.class, new ItemStack(ForestryBlock.log6, 1, 0)).setLeafIndices("conifers"); + 0xfeff8f, 0xffd98f, WorldGenPine.class, ForestryBlock.log6.getItemStack(1, 0)).setLeafIndices("conifers"); Allele.treeSequioa = new AlleleTreeSpecies("treeSequioa", false, "Coast Sequoia", sequoia, - "sempervirens", 0x418e71, 0x569896, WorldGenSequoia.class, new ItemStack(ForestryBlock.log2, 1, 3)).setLeafIndices( + "sempervirens", 0x418e71, 0x569896, WorldGenSequoia.class, ForestryBlock.log2.getItemStack(1, 3)).setLeafIndices( "conifers").setGirth(3); Allele.treeGiganteum = new AlleleTreeSpecies("treeGigant", false, "Giant Sequoia", - sequoiadendron, "giganteum", 0x738434, WorldGenGiganteum.class, new ItemStack(ForestryBlock.log2, 1, 3)).setLeafIndices( + sequoiadendron, "giganteum", 0x738434, WorldGenGiganteum.class, ForestryBlock.log2.getItemStack(1, 3)).setLeafIndices( "conifers").setGirth(4); // Jungle Allele.treeJungle = new AlleleTreeSpecies("treeJungle", false, "Jungle", tropical, "tectona", proxy.getFoliageColorBasic(), 0x539d12, WorldGenJungle.class, new ItemStack(Blocks.log, 1, 3)) - .addFruitFamily(jungle).setLeafIndices("jungle").setVanillaMap(3).setIsSecret(); + .addFruitFamily(jungle).setLeafIndices("jungle").setVanillaMap(3).setIsSecret(); Allele.treeTeak = new AlleleTreeSpecies("treeTeak", true, "Teak", tectona, "grandis", - 0xfeff8f, 0xffd98f, WorldGenTeak.class, new ItemStack(ForestryBlock.log1, 1, 3)).addFruitFamily(jungle).setLeafIndices( + 0xfeff8f, 0xffd98f, WorldGenTeak.class, ForestryBlock.log1.getItemStack(1, 3)).addFruitFamily(jungle).setLeafIndices( "jungle"); Allele.treeKapok = new AlleleTreeSpecies("treeKapok", true, "Kapok", ceiba, "pentandra", - 0x89987b, 0x89aa9e, WorldGenKapok.class, new ItemStack(ForestryBlock.log3, 1, 0)).addFruitFamily(jungle) + 0x89987b, 0x89aa9e, WorldGenKapok.class, ForestryBlock.log3.getItemStack(1, 0)).addFruitFamily(jungle) .addFruitFamily(prunes).setLeafIndices("jungle"); // Ebony Allele.treeEbony = new AlleleTreeSpecies("treeEbony", true, "Myrtle Ebony", diospyros, - "pentamera", 0xa2d24a, 0xc4d24a, WorldGenEbony.class, new ItemStack(ForestryBlock.log3, 1, 1)).addFruitFamily(jungle) + "pentamera", 0xa2d24a, 0xc4d24a, WorldGenEbony.class, ForestryBlock.log3.getItemStack(1, 1)).addFruitFamily(jungle) .addFruitFamily(prunes).setGirth(3).setLeafIndices("jungle"); // Diospyros mespiliformis, the Jackalberry (also known as African Ebony @@ -791,10 +721,9 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { // "The wood this particular tree produces is believed to be the blackest of all timber-producing Diospyros species" // Coromandel Ebony or East Indian Ebony (Diospyros melanoxylon) - // " locally it is known as temburini or by its Hindi name tendu. In Orissa and Jharkhand it known as kendu." - // Mahogany Allele.treeMahogany = new AlleleTreeSpecies("treeMahogony", true, "Yellow Meranti", shorea, - "gibbosa", 0x8ab154, 0xa9b154, WorldGenMahogany.class, new ItemStack(ForestryBlock.log3, 1, 2)).addFruitFamily(jungle) + "gibbosa", 0x8ab154, 0xa9b154, WorldGenMahogany.class, ForestryBlock.log3.getItemStack(1, 2)).addFruitFamily(jungle) .setGirth(2).setLeafIndices("jungle"); // 80+ meters tall: @@ -802,47 +731,45 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { // Shorea gibbosa (also called Yellow Meranti) // Shorea smithiana (also called Light Red Meranti) // Shorea superba - // Malva - Allele.treeAcacia = new AlleleTreeSpecies("treeAcaciaVanilla", true, "Acacia", acacia, "aneura", 0x616101, 0xb3b302, WorldGenAcaciaVanilla.class, new ItemStack(Blocks.log2, 1, 0)).addFruitFamily(jungle) .addFruitFamily(nux).setVanillaMap(4); - + Allele.treeDesertAcacia = new AlleleTreeSpecies("treeAcacia", true, "Desert Acacia", acacia, - "erioloba", 0x748C1C, 0xb3b302, WorldGenAcacia.class, new ItemStack(ForestryBlock.log1, 1, 2)).addFruitFamily(jungle) + "erioloba", 0x748C1C, 0xb3b302, WorldGenAcacia.class, ForestryBlock.log1.getItemStack(1, 2)).addFruitFamily(jungle) .addFruitFamily(nux); Allele.treeBalsa = new AlleleTreeSpecies("treeBalsa", true, "Balsa", ochroma, "pyramidale", - 0x59ac00, 0xfeff8f, WorldGenBalsa.class, new ItemStack(ForestryBlock.log3, 1, 3)).addFruitFamily(jungle).addFruitFamily(nux); + 0x59ac00, 0xfeff8f, WorldGenBalsa.class, ForestryBlock.log3.getItemStack(1, 3)).addFruitFamily(jungle).addFruitFamily(nux); Allele.treeWenge = new AlleleTreeSpecies("treeWenge", true, "Wenge", millettia, - "laurentii", 0xada157, 0xad8a57, WorldGenWenge.class, new ItemStack(ForestryBlock.log2, 1, 1)).addFruitFamily(jungle) + "laurentii", 0xada157, 0xad8a57, WorldGenWenge.class, ForestryBlock.log2.getItemStack(1, 1)).addFruitFamily(jungle) .addFruitFamily(nux).setGirth(2); Allele.treeBaobab = new AlleleTreeSpecies("treeBaobab", true, "Grandidier's Baobab", - adansonia, "digitata", 0xfeff8f, 0xffd98f, WorldGenBaobab.class, new ItemStack(ForestryBlock.log2, 1, 2)) - .addFruitFamily(jungle).addFruitFamily(nux).setGirth(3); + adansonia, "digitata", 0xfeff8f, 0xffd98f, WorldGenBaobab.class, ForestryBlock.log2.getItemStack(1, 2)) + .addFruitFamily(jungle).addFruitFamily(nux).setGirth(3); Allele.treeMahoe = new AlleleTreeSpecies("treeMahoe", true, "Blue Mahoe", talipariti, - "elatum", 0xa0ba1b, 0x79a175, WorldGenMahoe.class, new ItemStack(ForestryBlock.log5, 1, 0)).addFruitFamily(jungle) + "elatum", 0xa0ba1b, 0x79a175, WorldGenMahoe.class, ForestryBlock.log5.getItemStack(1, 0)).addFruitFamily(jungle) .addFruitFamily(pomes).addFruitFamily(prunes); // Willows Allele.treeWillow = new AlleleTreeSpecies("treeWillow", true, "White Willow", salix, - "alba", 0xa3b8a5, 0xa3b850, WorldGenWillow.class, new ItemStack(ForestryBlock.log4, 1, 0)).addFruitFamily(nux) + "alba", 0xa3b8a5, 0xa3b850, WorldGenWillow.class, ForestryBlock.log4.getItemStack(1, 0)).addFruitFamily(nux) .addFruitFamily(prunes).addFruitFamily(pomes).setLeafIndices("willow"); // Lauraceae Allele.treeSipiri = new AlleleTreeSpecies("treeSipiri", true, "Sipiri", chlorocardium, - "rodiei", 0x678911, 0x79a175, WorldGenGreenheart.class, new ItemStack(ForestryBlock.log3, 1, 2)).addFruitFamily(jungle); + "rodiei", 0x678911, 0x79a175, WorldGenGreenheart.class, ForestryBlock.log3.getItemStack(1, 2)).addFruitFamily(jungle); // Unclassified Allele.treePapaya = new AlleleTreeSpecies("treePapaya", true, "Papaya", carica, "papaya", - 0x6d9f58, 0x9ee67f, WorldGenPapaya.class, new ItemStack(ForestryBlock.log5, 1, 3)).addFruitFamily(jungle) + 0x6d9f58, 0x9ee67f, WorldGenPapaya.class, ForestryBlock.log5.getItemStack(1, 3)).addFruitFamily(jungle) .addFruitFamily(nux).setLeafIndices("palm"); Allele.treeDate = new AlleleTreeSpecies("treeDate", true, "Date Palm", null, "dactylifera", - 0xcbcd79, 0xf0f38f, WorldGenDate.class, new ItemStack(ForestryBlock.log4, 1, 2)).addFruitFamily(jungle).addFruitFamily(nux) + 0xcbcd79, 0xf0f38f, WorldGenDate.class, ForestryBlock.log4.getItemStack(1, 2)).addFruitFamily(jungle).addFruitFamily(nux) .setLeafIndices("palm"); Allele.treePoplar = new AlleleTreeSpecies("treePoplar", true, "White Poplar", populus, - "alba", 0xa3b8a5, 0x539d12, WorldGenPoplar.class, new ItemStack(ForestryBlock.log5, 1, 1)).addFruitFamily(pomes) + "alba", 0xa3b8a5, 0x539d12, WorldGenPoplar.class, ForestryBlock.log5.getItemStack(1, 1)).addFruitFamily(pomes) .addFruitFamily(prunes); // FRUITS @@ -1042,8 +969,8 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { @Override public ICommand[] getConsoleCommands() { - return new ICommand[] { new CommandSpawnTree(), new CommandSpawnForest(), - new CommandTreekeepingMode() }; + return new ICommand[]{new CommandSpawnTree(), new CommandSpawnForest(), + new CommandTreekeepingMode()}; } @Override @@ -1064,11 +991,10 @@ public class PluginArboriculture extends NativePlugin implements IFuelHandler { if (message.key.equals("add-fence-block") && message.isStringMessage()) { Block block = GameData.getBlockRegistry().getRaw(message.getStringValue()); - if (block == null || block == Blocks.air) { + if (block == null || block == Blocks.air) Proxies.log.warning("invalid add-fence-block IMC: can't resolve block name %s.", message.getStringValue()); - } else { + else validFences.add(block); - } } return super.processIMCMessage(message); } diff --git a/src/main/java/forestry/plugins/PluginCore.java b/src/main/java/forestry/plugins/PluginCore.java index 89e022fc3..e75a3e390 100755 --- a/src/main/java/forestry/plugins/PluginCore.java +++ b/src/main/java/forestry/plugins/PluginCore.java @@ -104,36 +104,31 @@ public class PluginCore extends NativePlugin implements IFuelHandler { Allele.initialize(); - ForestryBlock.core = new BlockBase(Material.iron, true); - ForestryBlock.core.setBlockName("for.core"); - Proxies.common.registerBlock(ForestryBlock.core, ItemForestryBlock.class); + ForestryBlock.core.registerBlock(new BlockBase(Material.iron, true), ItemForestryBlock.class, "core"); - definitionAnalyzer = ForestryBlock.core.addDefinition(new MachineDefinition(Defaults.DEFINITION_ANALYZER_META, "forestry.Analyzer", TileAnalyzer.class, + definitionAnalyzer = ((BlockBase) ForestryBlock.core.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_ANALYZER_META, "forestry.Analyzer", TileAnalyzer.class, PluginApiculture.proxy.getRendererAnalyzer(Defaults.TEXTURE_PATH_BLOCKS + "/analyzer_"))); - definitionEscritoire = ForestryBlock.core.addDefinition(new MachineDefinition(Defaults.DEFINITION_ESCRITOIRE_META, "forestry.Escritoire", TileEscritoire.class, + definitionEscritoire = ((BlockBase) ForestryBlock.core.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_ESCRITOIRE_META, "forestry.Escritoire", TileEscritoire.class, Proxies.render.getRenderEscritoire())); - ForestryBlock.soil = new BlockSoil().setBlockName("soil"); - Proxies.common.registerBlock(ForestryBlock.soil, ItemForestryBlock.class); - ForestryBlock.soil.setHarvestLevel("shovel", 0, 0); - ForestryBlock.soil.setHarvestLevel("shovel", 0, 1); + ForestryBlock.soil.registerBlock(new BlockSoil(), ItemForestryBlock.class, "soil"); + ForestryBlock.soil.block().setHarvestLevel("shovel", 0, 0); + ForestryBlock.soil.block().setHarvestLevel("shovel", 0, 1); - ForestryBlock.resources = new BlockResource().setBlockName("resources"); - Proxies.common.registerBlock(ForestryBlock.resources, ItemForestryBlock.class); - ForestryBlock.resources.setHarvestLevel("pickaxe", 1, 0); - ForestryBlock.resources.setHarvestLevel("pickaxe", 1, 1); - ForestryBlock.resources.setHarvestLevel("pickaxe", 1, 2); + ForestryBlock.resources.registerBlock(new BlockResource(), ItemForestryBlock.class, "resources"); + ForestryBlock.resources.block().setHarvestLevel("pickaxe", 1, 0); + ForestryBlock.resources.block().setHarvestLevel("pickaxe", 1, 1); + ForestryBlock.resources.block().setHarvestLevel("pickaxe", 1, 2); - OreDictionary.registerOre("oreApatite", new ItemStack(ForestryBlock.resources, 1, 0)); - OreDictionary.registerOre("oreCopper", new ItemStack(ForestryBlock.resources, 1, 1)); - OreDictionary.registerOre("oreTin", new ItemStack(ForestryBlock.resources, 1, 2)); + OreDictionary.registerOre("oreApatite", ForestryBlock.resources.getItemStack(1, 0)); + OreDictionary.registerOre("oreCopper", ForestryBlock.resources.getItemStack(1, 1)); + OreDictionary.registerOre("oreTin", ForestryBlock.resources.getItemStack(1, 2)); - ForestryBlock.glass = new BlockStainedGlass().setBlockName("stained"); - Proxies.common.registerBlock(ForestryBlock.glass, ItemForestryBlock.class); + ForestryBlock.glass.registerBlock(new BlockStainedGlass(), ItemForestryBlock.class, "stained"); /* SMELTING RECIPES */ - FurnaceRecipes.smelting().func_151394_a(new ItemStack(ForestryBlock.resources, 1, 1), ForestryItem.ingotCopper.getItemStack(), 0.5f); - FurnaceRecipes.smelting().func_151394_a(new ItemStack(ForestryBlock.resources, 1, 2), ForestryItem.ingotTin.getItemStack(), 0.5f); + FurnaceRecipes.smelting().func_151394_a(ForestryBlock.resources.getItemStack(1, 1), ForestryItem.ingotCopper.getItemStack(), 0.5f); + FurnaceRecipes.smelting().func_151394_a(ForestryBlock.resources.getItemStack(1, 2), ForestryItem.ingotTin.getItemStack(), 0.5f); GameRegistry.registerFuelHandler(this); @@ -142,14 +137,14 @@ public class PluginCore extends NativePlugin implements IFuelHandler { @Override public void doInit() { super.doInit(); - definitionAnalyzer.recipes = createAlyzerRecipes(ForestryBlock.core, Defaults.DEFINITION_ANALYZER_META); + definitionAnalyzer.recipes = createAlyzerRecipes(ForestryBlock.core.block(), Defaults.DEFINITION_ANALYZER_META); definitionAnalyzer.register(); definitionEscritoire.register(); crashCallable = new ForestryModEnvWarningCallable(); - RecipeSorter.register("forestry:shapedrecipecustom", ShapedRecipeCustom.class, RecipeSorter.Category.SHAPED, "before:minecraft:shaped"); - } + RecipeSorter.register("forestry:shapedrecipecustom", ShapedRecipeCustom.class, RecipeSorter.Category.SHAPED, "before:minecraft:shaped"); + } @Override public boolean isAvailable() { @@ -211,7 +206,6 @@ public class PluginCore extends NativePlugin implements IFuelHandler { // .setItemName("vialEmpty").setIconIndex(10); ForestryItem.vialCatalyst.registerItem((new ItemForestry()), "vialCatalyst"); - // / PEAT PRODUCTION ForestryItem.peat.registerItem((new ItemForestry()), "peat"); OreDictionary.registerOre("brickPeat", ForestryItem.peat.getItemStack()); @@ -348,8 +342,8 @@ public class PluginCore extends NativePlugin implements IFuelHandler { ForestryItem.cratedNetherrack.registerItem(new ItemCrated(new ItemStack(Blocks.netherrack)), "cratedNetherrack"); ForestryItem.cratedSoulsand.registerItem(new ItemCrated(new ItemStack(Blocks.soul_sand)), "cratedSoulsand"); ForestryItem.cratedSandstone.registerItem(new ItemCrated(new ItemStack(Blocks.sandstone)), "cratedSandstone"); - ForestryItem.cratedBogearth.registerItem(new ItemCrated(new ItemStack(ForestryBlock.soil, 1, 1)), "cratedBogearth"); - ForestryItem.cratedHumus.registerItem(new ItemCrated(new ItemStack(ForestryBlock.soil, 1, 0)), "cratedHumus"); + ForestryItem.cratedBogearth.registerItem(new ItemCrated(ForestryBlock.soil.getItemStack(1, 1)), "cratedBogearth"); + ForestryItem.cratedHumus.registerItem(new ItemCrated(ForestryBlock.soil.getItemStack(1, 0)), "cratedHumus"); ForestryItem.cratedNetherbrick.registerItem(new ItemCrated(new ItemStack(Blocks.nether_brick)), "cratedNetherbrick"); ForestryItem.cratedPeat.registerItem(new ItemCrated(ForestryItem.peat.getItemStack()), "cratedPeat"); ForestryItem.cratedApatite.registerItem(new ItemCrated(ForestryItem.apatite.getItemStack()), "cratedApatite"); @@ -388,9 +382,8 @@ public class PluginCore extends NativePlugin implements IFuelHandler { protected void registerRecipes() { /* BRONZE INGOTS */ - if (Config.getCraftingBronzeEnabled()) { + if (Config.getCraftingBronzeEnabled()) Proxies.common.addShapelessRecipe(ForestryItem.ingotBronze.getItemStack(4), "ingotTin", "ingotCopper", "ingotCopper", "ingotCopper"); - } /* STURDY MACHINE */ Proxies.common.addRecipe(ForestryItem.sturdyCasing.getItemStack(), "###", "# #", "###", '#', "ingotBronze"); @@ -473,7 +466,7 @@ public class PluginCore extends NativePlugin implements IFuelHandler { @Override public ICommand[] getConsoleCommands() { - return new ICommand[] { new CommandForestry() }; + return new ICommand[]{new CommandForestry()}; } @Override diff --git a/src/main/java/forestry/plugins/PluginEnergy.java b/src/main/java/forestry/plugins/PluginEnergy.java index 89722e52d..f578cac3c 100755 --- a/src/main/java/forestry/plugins/PluginEnergy.java +++ b/src/main/java/forestry/plugins/PluginEnergy.java @@ -70,13 +70,11 @@ public class PluginEnergy extends NativePlugin { public void preInit() { super.preInit(); - ForestryBlock.engine = new BlockBase(Material.iron, true); - ForestryBlock.engine.setBlockName("for.engine"); - Proxies.common.registerBlock(ForestryBlock.engine, ItemForestryBlock.class); + ForestryBlock.engine.registerBlock(new BlockBase(Material.iron, true), ItemForestryBlock.class, "engine"); - definitionEngineTin = ForestryBlock.engine.addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINETIN_META, "forestry.EngineTin", EngineTin.class, + definitionEngineTin = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINETIN_META, "forestry.EngineTin", EngineTin.class, PluginEnergy.proxy.getRenderDefaultEngine(Defaults.TEXTURE_PATH_BLOCKS + "/engine_tin_"), ShapedRecipeCustom.createShapedRecipe( - new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_ENGINETIN_META), + ForestryBlock.engine.getItemStack(1, Defaults.DEFINITION_ENGINETIN_META), "###", " X ", "YVY", @@ -84,9 +82,9 @@ public class PluginEnergy extends NativePlugin { 'X', Blocks.glass, 'Y', "gearTin", 'V', Blocks.piston))); - definitionEngineCopper = ForestryBlock.engine.addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINECOPPER_META, "forestry.EngineCopper", EngineCopper.class, + definitionEngineCopper = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINECOPPER_META, "forestry.EngineCopper", EngineCopper.class, PluginEnergy.proxy.getRenderDefaultEngine(Defaults.TEXTURE_PATH_BLOCKS + "/engine_copper_"), ShapedRecipeCustom.createShapedRecipe( - new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_ENGINECOPPER_META), + ForestryBlock.engine.getItemStack(1, Defaults.DEFINITION_ENGINECOPPER_META), "###", " X ", "YVY", @@ -94,9 +92,9 @@ public class PluginEnergy extends NativePlugin { 'X', Blocks.glass, 'Y', "gearCopper", 'V', Blocks.piston))); - definitionEngineBronze = ForestryBlock.engine.addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINEBRONZE_META, "forestry.EngineBronze", EngineBronze.class, + definitionEngineBronze = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINEBRONZE_META, "forestry.EngineBronze", EngineBronze.class, PluginEnergy.proxy.getRenderDefaultEngine(Defaults.TEXTURE_PATH_BLOCKS + "/engine_bronze_"), ShapedRecipeCustom.createShapedRecipe( - new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_ENGINEBRONZE_META), + ForestryBlock.engine.getItemStack(1, Defaults.DEFINITION_ENGINEBRONZE_META), "###", " X ", "YVY", @@ -105,8 +103,9 @@ public class PluginEnergy extends NativePlugin { 'Y', "gearBronze", 'V', Blocks.piston))); - definitionGenerator = ForestryBlock.engine.addDefinition(new MachineDefinition(Defaults.DEFINITION_GENERATOR_META, "forestry.Generator", MachineGenerator.class, - Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/generator_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_GENERATOR_META), + definitionGenerator = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new MachineDefinition(Defaults.DEFINITION_GENERATOR_META, "forestry.Generator", MachineGenerator.class, + Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/generator_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.engine.getItemStack(1, Defaults.DEFINITION_GENERATOR_META), "X#X", "XYX", "X#X", @@ -115,9 +114,9 @@ public class PluginEnergy extends NativePlugin { 'Y', ForestryItem.sturdyCasing))); ShapedRecipeCustom clockworkRecipe = null; - if (GameMode.getGameMode().getBooleanSetting("energy.engine.clockwork")) { + if (GameMode.getGameMode().getBooleanSetting("energy.engine.clockwork")) clockworkRecipe = ShapedRecipeCustom.createShapedRecipe( - new ItemStack(ForestryBlock.engine, 1, Defaults.DEFINITION_ENGINECLOCKWORK_META), + ForestryBlock.engine.getItemStack(1, Defaults.DEFINITION_ENGINECLOCKWORK_META), "###", " X ", "ZVY", @@ -126,9 +125,8 @@ public class PluginEnergy extends NativePlugin { 'Y', Items.clock, 'Z', ForestryItem.gearCopper, 'V', Blocks.piston); - } - definitionEngineClockwork = ForestryBlock.engine.addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINECLOCKWORK_META, "forestry.EngineClockwork", EngineClockwork.class, + definitionEngineClockwork = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new EngineDefinition(Defaults.DEFINITION_ENGINECLOCKWORK_META, "forestry.EngineClockwork", EngineClockwork.class, PluginEnergy.proxy.getRenderDefaultEngine(Defaults.TEXTURE_PATH_BLOCKS + "/engine_clock_"), clockworkRecipe)); ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_CHOKE_I, "forestry.energyChoke1"); @@ -156,10 +154,10 @@ public class PluginEnergy extends NativePlugin { Circuit.energyElectricChoke1 = new CircuitElectricChoke("energyChoke1"); Circuit.energyFireDampener1 = new CircuitFireDampener("energyDampener1"); Circuit.energyElectricEfficiency1 = new CircuitElectricEfficiency("energyEfficiency1"); - Circuit.energyElectricBoost1 = new CircuitElectricBoost("energyBoost1", 2, 7, 2, "electric.boost.1", new String[] { "Increases output by 2 MJ/t", - "Increases intake by 7 EU/t" }); - Circuit.energyElectricBoost2 = new CircuitElectricBoost("energyBoost2", 2, 15, 4, "electric.boost.2", new String[] { "Increases output by 4 MJ/t", - "Increases intake by 15 EU/t" }); + Circuit.energyElectricBoost1 = new CircuitElectricBoost("energyBoost1", 2, 7, 2, "electric.boost.1", new String[]{"Increases output by 2 MJ/t", + "Increases intake by 7 EU/t"}); + Circuit.energyElectricBoost2 = new CircuitElectricBoost("energyBoost2", 2, 15, 4, "electric.boost.2", new String[]{"Increases output by 4 MJ/t", + "Increases intake by 15 EU/t"}); } @Override diff --git a/src/main/java/forestry/plugins/PluginFactory.java b/src/main/java/forestry/plugins/PluginFactory.java index e15752882..973a66887 100755 --- a/src/main/java/forestry/plugins/PluginFactory.java +++ b/src/main/java/forestry/plugins/PluginFactory.java @@ -95,12 +95,13 @@ public class PluginFactory extends NativePlugin { // Init still manager RecipeManagers.craftingProviders.add(RecipeManagers.stillManager = new MachineStill.RecipeManager()); - ForestryBlock.factoryTESR = new BlockBase(Material.iron, true); - ForestryBlock.factoryTESR.setBlockName("for.factory"); - Proxies.common.registerBlock(ForestryBlock.factoryTESR, ItemForestryBlock.class); + ForestryBlock.factoryTESR.registerBlock(new BlockBase(Material.iron, true), ItemForestryBlock.class, "factory"); - definitionBottler = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_BOTTLER_META, "forestry.Bottler", MachineBottler.class, - Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/bottler_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_BOTTLER_META), + BlockBase factoryTESR = ((BlockBase) ForestryBlock.factoryTESR.block()); + + definitionBottler = factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_BOTTLER_META, "forestry.Bottler", MachineBottler.class, + Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/bottler_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_BOTTLER_META), "X#X", "#Y#", "X#X", @@ -108,8 +109,9 @@ public class PluginFactory extends NativePlugin { 'X', ForestryItem.canEmpty, 'Y', ForestryItem.sturdyCasing))); - definitionCarpenter = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_CARPENTER_META, "forestry.Carpenter", MachineCarpenter.class, - Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/carpenter_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_CARPENTER_META), + definitionCarpenter = factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_CARPENTER_META, "forestry.Carpenter", MachineCarpenter.class, + Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/carpenter_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_CARPENTER_META), "X#X", "XYX", "X#X", @@ -117,8 +119,9 @@ public class PluginFactory extends NativePlugin { 'X', "ingotBronze", 'Y', ForestryItem.sturdyCasing))); - definitionCentrifuge = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_CENTRIFUGE_META, "forestry.Centrifuge", MachineCentrifuge.class, - Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/centrifuge_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_CENTRIFUGE_META), + definitionCentrifuge = factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_CENTRIFUGE_META, "forestry.Centrifuge", MachineCentrifuge.class, + Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/centrifuge_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_CENTRIFUGE_META), "X#X", "XYX", "X#X", @@ -126,8 +129,9 @@ public class PluginFactory extends NativePlugin { 'X', "ingotCopper", 'Y', ForestryItem.sturdyCasing.getItemStack()))); - definitionFermenter = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_FERMENTER_META, "forestry.Fermenter", MachineFermenter.class, - Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/fermenter_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_FERMENTER_META), + definitionFermenter = factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_FERMENTER_META, "forestry.Fermenter", MachineFermenter.class, + Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/fermenter_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_FERMENTER_META), "X#X", "#Y#", "X#X", @@ -135,8 +139,9 @@ public class PluginFactory extends NativePlugin { 'X', "gearBronze", 'Y', ForestryItem.sturdyCasing))); - definitionMoistener = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_MOISTENER_META, "forestry.Moistener", MachineMoistener.class, - Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/moistener_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_MOISTENER_META), + definitionMoistener = factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_MOISTENER_META, "forestry.Moistener", MachineMoistener.class, + Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/moistener_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_MOISTENER_META), "X#X", "#Y#", "X#X", @@ -144,8 +149,9 @@ public class PluginFactory extends NativePlugin { 'X', "gearCopper", 'Y', ForestryItem.sturdyCasing))); - definitionSqueezer = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_SQUEEZER_META, "forestry.Squeezer", MachineSqueezer.class, - Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/squeezer_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_SQUEEZER_META), + definitionSqueezer = factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_SQUEEZER_META, "forestry.Squeezer", MachineSqueezer.class, + Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/squeezer_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_SQUEEZER_META), "X#X", "XYX", "X#X", @@ -153,8 +159,9 @@ public class PluginFactory extends NativePlugin { 'X', "ingotTin", 'Y', ForestryItem.sturdyCasing.getItemStack()))); - definitionStill = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_STILL_META, "forestry.Still", MachineStill.class, - Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/still_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_STILL_META), + definitionStill = factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_STILL_META, "forestry.Still", MachineStill.class, + Proxies.render.getRenderDefaultMachine(Defaults.TEXTURE_PATH_BLOCKS + "/still_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_STILL_META), "X#X", "#Y#", "X#X", @@ -162,8 +169,9 @@ public class PluginFactory extends NativePlugin { 'X', Items.redstone, 'Y', ForestryItem.sturdyCasing))); - definitionRainmaker = ForestryBlock.factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_RAINMAKER_META, "forestry.Rainmaker", MillRainmaker.class, - Proxies.render.getRenderMill(Defaults.TEXTURE_PATH_BLOCKS + "/rainmaker_"), ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryTESR, 1, Defaults.DEFINITION_RAINMAKER_META), + definitionRainmaker = factoryTESR.addDefinition(new MachineDefinition(Defaults.DEFINITION_RAINMAKER_META, "forestry.Rainmaker", MillRainmaker.class, + Proxies.render.getRenderMill(Defaults.TEXTURE_PATH_BLOCKS + "/rainmaker_"), ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryTESR.getItemStack(1, Defaults.DEFINITION_RAINMAKER_META), "X#X", "#Y#", "X#X", @@ -171,39 +179,41 @@ public class PluginFactory extends NativePlugin { 'X', "gearTin", 'Y', ForestryItem.hardenedCasing))); - ForestryBlock.factoryPlain = new BlockBase(Material.iron); - ForestryBlock.factoryPlain.setBlockName("for.factory2"); - Proxies.common.registerBlock(ForestryBlock.factoryPlain, ItemNBTTile.class); + ForestryBlock.factoryPlain.registerBlock(new BlockBase(Material.iron), ItemNBTTile.class, "factory2"); - definitionFabricator = ForestryBlock.factoryPlain.addDefinition(new MachineDefinition(Defaults.DEFINITION_FABRICATOR_META, "forestry.Fabricator", MachineFabricator.class, - ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryPlain, - 1, Defaults.DEFINITION_FABRICATOR_META), + BlockBase factoryPlain = ((BlockBase) ForestryBlock.factoryPlain.block()); + + definitionFabricator = factoryPlain.addDefinition(new MachineDefinition(Defaults.DEFINITION_FABRICATOR_META, "forestry.Fabricator", MachineFabricator.class, + ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.factoryPlain.getItemStack(1, Defaults.DEFINITION_FABRICATOR_META), "X#X", "#Y#", "XZX", '#', Blocks.glass, 'X', Items.gold_ingot, 'Y', ForestryItem.sturdyCasing, - 'Z', Blocks.chest)).setFaces(0, 1, 2, 3, 4, 4)); + 'Z', Blocks.chest)) + .setFaces(0, 1, 2, 3, 4, 4)); - definitionRaintank = ForestryBlock.factoryPlain.addDefinition(new MachineDefinition(Defaults.DEFINITION_RAINTANK_META, "forestry.Raintank", MachineRaintank.class, - ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryPlain, 1, Defaults.DEFINITION_RAINTANK_META), + definitionRaintank = factoryPlain.addDefinition(new MachineDefinition(Defaults.DEFINITION_RAINTANK_META, "forestry.Raintank", MachineRaintank.class, + ShapedRecipeCustom.createShapedRecipe(ForestryBlock.factoryPlain.getItemStack(1, Defaults.DEFINITION_RAINTANK_META), "X#X", "XYX", "X#X", '#', Blocks.glass, 'X', Items.iron_ingot, 'Y', ForestryItem.sturdyCasing)) - .setFaces(0, 1, 0, 0, 0, 0)); + .setFaces(0, 1, 0, 0, 0, 0)); - definitionWorktable = ForestryBlock.factoryPlain.addDefinition(new MachineNBTDefinition(Defaults.DEFINITION_WORKTABLE_META, "forestry.Worktable", TileWorktable.class, - ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.factoryPlain, 1, Defaults.DEFINITION_WORKTABLE_META), + definitionWorktable = factoryPlain.addDefinition(new MachineNBTDefinition(Defaults.DEFINITION_WORKTABLE_META, "forestry.Worktable", TileWorktable.class, + ShapedRecipeCustom.createShapedRecipe(ForestryBlock.factoryPlain.getItemStack(1, Defaults.DEFINITION_WORKTABLE_META), "B", "W", "C", 'B', Items.book, 'W', Blocks.crafting_table, - 'C', Blocks.chest)).setFaces(0, 1, 2, 3, 4, 4)); + 'C', Blocks.chest)) + .setFaces(0, 1, 2, 3, 4, 4)); } @Override @@ -246,55 +256,54 @@ public class PluginFactory extends NativePlugin { protected void registerRecipes() { // / FABRICATOR - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 0), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotCopper" }); - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 1), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotTin" }); - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 2), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotBronze" }); - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 3), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.iron_ingot }); - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 4), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.gold_ingot }); - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 5), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.diamond }); - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 6), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', Blocks.obsidian }); - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 7), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.blaze_powder }); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 0), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotCopper"}); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 1), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotTin"}); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 2), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', "ingotBronze"}); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 3), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.iron_ingot}); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 4), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.gold_ingot}); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 5), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.diamond}); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 6), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', Blocks.obsidian}); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 7), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.blaze_powder}); if (PluginIC2.rubber != null) RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 8), - new Object[] { " X ", "#X#", "XXX", '#', Items.redstone, 'X', PluginIC2.rubber }); - RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 9), new Object[] { - " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.emerald }); + new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', PluginIC2.rubber}); + RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 9), new Object[]{ + " X ", "#X#", "XXX", '#', Items.redstone, 'X', Items.emerald}); RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 10), - new Object[] { " X ", "#X#", "XXX", '#', Items.redstone, 'X', "gemApatite" }); + new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', "gemApatite"}); RecipeManagers.fabricatorManager.addRecipe(null, LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, 500), ForestryItem.tubes.getItemStack(4, 11), - new Object[] { " X ", "#X#", "XXX", '#', Items.redstone, 'X', new ItemStack(Items.dye, 1, 4) }); + new Object[]{" X ", "#X#", "XXX", '#', Items.redstone, 'X', new ItemStack(Items.dye, 1, 4)}); - String[] dyes = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", - "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" }; + String[] dyes = {"dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", + "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite"}; if (ForestryItem.propolis != null) - for (int i = 0; i < 16; i++) { + for (int i = 0; i < 16; i++) RecipeManagers.fabricatorManager.addRecipe(ForestryItem.waxCast.getItemStack(1, Defaults.WILDCARD), LiquidHelper.getLiquid(Defaults.LIQUID_GLASS, - Defaults.BUCKET_VOLUME), new ItemStack(ForestryBlock.glass, 1, 15 - i), new Object[] { "#", "X", '#', dyes[i], - 'X', ForestryItem.propolis.getItemStack(1, Defaults.WILDCARD) }); - } + Defaults.BUCKET_VOLUME), ForestryBlock.glass.getItemStack(1, 15 - i), new Object[]{"#", "X", '#', dyes[i], + 'X', ForestryItem.propolis.getItemStack(1, Defaults.WILDCARD)}); // / SQUEEZER - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.apple) }, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple")), + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.apple)}, LiquidHelper.getLiquid(Defaults.LIQUID_JUICE, GameMode.getGameMode().getIntegerSetting("squeezer.liquid.apple")), ForestryItem.mulch.getItemStack(), GameMode.getGameMode().getIntegerSetting("squeezer.mulch.apple")); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.wheat_seeds) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.wheat_seeds)}, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode .getGameMode().getIntegerSetting("squeezer.liquid.seed"))); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.pumpkin_seeds) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.pumpkin_seeds)}, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode .getGameMode().getIntegerSetting("squeezer.liquid.seed"))); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.melon_seeds) }, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.melon_seeds)}, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, GameMode .getGameMode().getIntegerSetting("squeezer.liquid.seed"))); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.cobblestone) }, + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.cobblestone)}, LiquidHelper.getLiquid(Defaults.LIQUID_LAVA, 1600)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Blocks.cactus) }, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 500)); - RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] { new ItemStack(Items.snowball), ForestryItem.craftingMaterial.getItemStack(4, 5) }, + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.cactus)}, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 500)); + RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.snowball), ForestryItem.craftingMaterial.getItemStack(4, 5)}, LiquidHelper.getLiquid(Defaults.LIQUID_ICE, 4000)); // STILL @@ -325,80 +334,108 @@ public class PluginFactory extends NativePlugin { // / CARPENTER RecipeManagers.carpenterManager.addRecipe(50, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 250), null, ForestryItem.impregnatedCasing.getItemStack(), - new Object[] { "###", "# #", "###", '#', "logWood" }); - RecipeManagers.carpenterManager.addRecipe(50, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 500), null, new ItemStack(ForestryBlock.core, 1, Defaults.DEFINITION_ESCRITOIRE_META), - new Object[] { "# ", "###", "# #", '#', "plankWood" }); + "###", + "# #", + "###", + '#', "logWood"); + RecipeManagers.carpenterManager.addRecipe(50, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 500), null, + ForestryBlock.core.getItemStack(1, Defaults.DEFINITION_ESCRITOIRE_META), + "# ", + "###", + "# #", + '#', "plankWood"); // RESOURCES - RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 100), null, ForestryItem.stickImpregnated.getItemStack(2), - new Object[] { "#", "#", '#', "logWood" }); - RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, ForestryItem.woodPulp.getItemStack(4), - new Object[] { "#", '#', "logWood" }); - RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, new ItemStack(Items.paper, 1), new Object[] { "#", - "#", '#', "pulpWood" }); - RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, new ItemStack(ForestryBlock.soil, 9, 0), - new Object[] { "###", "#X#", "###", '#', Blocks.dirt, 'X', ForestryItem.mulch }); - RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, new ItemStack(ForestryBlock.soil, 8, 1), - new Object[] { "#X#", "XYX", "#X#", '#', Blocks.dirt, 'X', Blocks.sand, 'Y', - ForestryItem.mulch }); + RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 100), null, + ForestryItem.stickImpregnated.getItemStack(2), + "#", + "#", + '#', "logWood"); + RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, + ForestryItem.woodPulp.getItemStack(4), + "#", + '#', "logWood"); + RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, + new ItemStack(Items.paper, 1), + "#", + "#", + '#', "pulpWood"); + RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, + ForestryBlock.soil.getItemStack(9), + "###", + "#X#", + "###", + '#', Blocks.dirt, + 'X', ForestryItem.mulch); + RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, + ForestryBlock.soil.getItemStack(8, 1), + "#X#", + "XYX", "#X#", + '#', Blocks.dirt, + 'X', Blocks.sand, + 'Y', ForestryItem.mulch); RecipeManagers.carpenterManager.addRecipe(75, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 5000), null, ForestryItem.hardenedCasing.getItemStack(), - new Object[] { "# #", " Y ", "# #", '#', Items.diamond, 'Y', ForestryItem.sturdyCasing }); + "# #", + " Y ", + "# #", + '#', Items.diamond, + 'Y', ForestryItem.sturdyCasing); // / CHIPSETS RecipeManagers.carpenterManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 0), - new Object[] { "R R", "R#R", "R R", '#', "ingotTin", 'R', Items.redstone }); + new Object[]{"R R", "R#R", "R R", '#', "ingotTin", 'R', Items.redstone}); RecipeManagers.carpenterManager.addRecipe(40, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 1), - new Object[] { "R#R", "R#R", "R#R", '#', "ingotBronze", 'R', Items.redstone }); + new Object[]{"R#R", "R#R", "R#R", '#', "ingotBronze", 'R', Items.redstone}); RecipeManagers.carpenterManager.addRecipe(80, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 2), - new Object[] { "R#R", "R#R", "R#R", '#', Items.iron_ingot, 'R', Items.redstone }); + new Object[]{"R#R", "R#R", "R#R", '#', Items.iron_ingot, 'R', Items.redstone}); RecipeManagers.carpenterManager.addRecipe(80, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.circuitboards.getItemStack(1, 3), - new Object[] { "R#R", "R#R", "R#R", '#', Items.gold_ingot, 'R', Items.redstone }); + new Object[]{"R#R", "R#R", "R#R", '#', Items.gold_ingot, 'R', Items.redstone}); RecipeManagers.carpenterManager.addRecipe(40, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.solderingIron.getItemStack(), - new Object[] { " # ", "# #", " B", '#', Items.iron_ingot, 'B', "ingotBronze" }); + new Object[]{" # ", "# #", " B", '#', Items.iron_ingot, 'B', "ingotBronze"}); // ForestryCore.oreHandler.registerCarpenterRecipe(solderingIron); // RAIN SUBSTRATES RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.iodineCharge.getItemStack(), - new Object[] { "Z#Z", "#Y#", "X#X", '#', ForestryItem.pollen, 'X', Items.gunpowder, - 'Y', ForestryItem.canEmpty, 'Z', ForestryItem.honeyDrop }); + new Object[]{"Z#Z", "#Y#", "X#X", '#', ForestryItem.pollen, 'X', Items.gunpowder, + 'Y', ForestryItem.canEmpty, 'Z', ForestryItem.honeyDrop}); // ForestryCore.oreHandler.registerCarpenterRecipe(iodineCapsule); RecipeManagers.carpenterManager.addRecipe( 5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.craftingMaterial.getItemStack(1, 4), - new Object[] { "Z#Z", "#Y#", "X#X", '#', ForestryItem.royalJelly, 'X', Items.gunpowder, - 'Y', ForestryItem.canEmpty, 'Z', ForestryItem.honeydew }); + new Object[]{"Z#Z", "#Y#", "X#X", '#', ForestryItem.royalJelly, 'X', Items.gunpowder, + 'Y', ForestryItem.canEmpty, 'Z', ForestryItem.honeydew}); // ForestryCore.oreHandler.registerCarpenterRecipe(dissipationCharge); // Ender pearl - RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ender_pearl, 1), new Object[] { " # ", "###", " # ", '#', - ForestryItem.craftingMaterial.getItemStack(1, 1) }); + RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ender_pearl, 1), new Object[]{" # ", "###", " # ", '#', + ForestryItem.craftingMaterial.getItemStack(1, 1)}); // Woven Silk RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 500), null, ForestryItem.craftingMaterial.getItemStack(1, 3), - new Object[] { "###", "###", "###", '#', ForestryItem.craftingMaterial.getItemStack(1, 2) }); + new Object[]{"###", "###", "###", '#', ForestryItem.craftingMaterial.getItemStack(1, 2)}); // Boxes RecipeManagers.carpenterManager.addRecipe(5, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.carton.getItemStack(2), - new Object[] { " # ", "# #", " # ", '#', "pulpWood" }); + new Object[]{" # ", "# #", " # ", '#', "pulpWood"}); RecipeManagers.carpenterManager.addRecipe(20, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.crate.getItemStack(24), - new Object[] { " # ", "# #", " # ", '#', "logWood" }); + new Object[]{" # ", "# #", " # ", '#', "logWood"}); // Assembly Kits - RecipeManagers.carpenterManager.addRecipe(20, null, ForestryItem.carton.getItemStack(), ForestryItem.kitPickaxe.getItemStack(), new Object[] { + RecipeManagers.carpenterManager.addRecipe(20, null, ForestryItem.carton.getItemStack(), ForestryItem.kitPickaxe.getItemStack(), new Object[]{ "###", " X ", " X ", '#', "ingotBronze", - 'X', "stickWood" }); + 'X', "stickWood"}); RecipeManagers.carpenterManager.addRecipe(20, null, ForestryItem.carton.getItemStack(), ForestryItem.kitShovel.getItemStack(), - new Object[] { " # ", " X ", " X ", '#', "ingotBronze", 'X', "stickWood" }); + new Object[]{" # ", " X ", " X ", '#', "ingotBronze", 'X', "stickWood"}); // Reclamation RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(2, ForestryItem.ingotBronze.item().getMaxDamage()), - new Object[] { "#", '#', ForestryItem.brokenBronzePickaxe }); - RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(), new Object[] { "#", '#', ForestryItem.brokenBronzeShovel }); + new Object[]{"#", '#', ForestryItem.brokenBronzePickaxe}); + RecipeManagers.carpenterManager.addRecipe(null, ForestryItem.ingotBronze.getItemStack(), new Object[]{"#", '#', ForestryItem.brokenBronzeShovel}); // Crating and uncrating condensed RecipeManagers.carpenterManager.addCrating(ForestryItem.cratedWood.getItemStack()); diff --git a/src/main/java/forestry/plugins/PluginFarming.java b/src/main/java/forestry/plugins/PluginFarming.java index 923a7166d..b5980eb2c 100755 --- a/src/main/java/forestry/plugins/PluginFarming.java +++ b/src/main/java/forestry/plugins/PluginFarming.java @@ -40,6 +40,7 @@ import forestry.core.config.ForestryBlock; import forestry.core.config.ForestryItem; import forestry.core.interfaces.IOreDictionaryHandler; import forestry.core.interfaces.ISaveEventHandler; +import forestry.core.items.ItemForestryBlock; import forestry.core.proxy.Proxies; import forestry.core.triggers.Trigger; import forestry.core.utils.ShapedRecipeCustom; @@ -106,7 +107,7 @@ public class PluginFarming extends NativePlugin { Farmables.farmInterface = new FarmHelper(); - ForestryBlock.mushroom = new BlockMushroom(); + ForestryBlock.mushroom.registerBlock(new BlockMushroom(), ItemForestryBlock.class, "mushroom"); Farmables.farmables.put("farmArboreal", new ArrayList()); Farmables.farmables.get("farmArboreal").add(new FarmableVanillaSapling()); @@ -137,11 +138,10 @@ public class PluginFarming extends NativePlugin { Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.potato), Blocks.potatoes, 7)); Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.carrot), Blocks.carrots, 7)); - ForestryBlock.farm = new BlockFarm().setBlockName("ffarm"); - Proxies.common.registerBlock(ForestryBlock.farm, ItemFarmBlock.class); + ForestryBlock.farm.registerBlock(new BlockFarm(), ItemFarmBlock.class, "ffarm"); /*Item.itemsList[ForestryBlock.farm] = null; - Item.itemsList[ForestryBlock.farm] = (new ItemFarmBlock(ForestryBlock.farm - 256, "ffarm"));*/ - ForestryBlock.farm.setHarvestLevel("pickaxe", 0); + Item.itemsList[ForestryBlock.farm] = (new ItemFarmBlock(ForestryBlock.farm - 256, "ffarm"));*/ + ForestryBlock.farm.block().setHarvestLevel("pickaxe", 0); proxy.initializeRendering(); @@ -171,24 +171,24 @@ public class PluginFarming extends NativePlugin { GameRegistry.registerTileEntity(TileValve.class, "forestry.FarmValve"); GameRegistry.registerTileEntity(TileControl.class, "forestry.FarmControl"); - Circuit.farmArborealManaged = new CircuitFarmLogic("managedArboreal", FarmLogicArboreal.class, new String[] { "Arboreal Plants" }); - Circuit.farmShroomManaged = new CircuitFarmLogic("managedShroom", FarmLogicShroom.class, new String[] { "Mushrooms" }); - Circuit.farmPeatManaged = new CircuitFarmLogic("managedPeat", FarmLogicPeat.class, new String[] { "Peat Bog" }); - Circuit.farmCerealManaged = new CircuitFarmLogic("managedCereal", FarmLogicCereal.class, new String[] { "Crops" }); - Circuit.farmVegetableManaged = new CircuitFarmLogic("managedVegetable", FarmLogicVegetable.class, new String[] { "Vegetables" }); - Circuit.farmInfernalManaged = new CircuitFarmLogic("managedInfernal", FarmLogicInfernal.class, new String[] { "Infernal Crops" }); + Circuit.farmArborealManaged = new CircuitFarmLogic("managedArboreal", FarmLogicArboreal.class, new String[]{"Arboreal Plants"}); + Circuit.farmShroomManaged = new CircuitFarmLogic("managedShroom", FarmLogicShroom.class, new String[]{"Mushrooms"}); + Circuit.farmPeatManaged = new CircuitFarmLogic("managedPeat", FarmLogicPeat.class, new String[]{"Peat Bog"}); + Circuit.farmCerealManaged = new CircuitFarmLogic("managedCereal", FarmLogicCereal.class, new String[]{"Crops"}); + Circuit.farmVegetableManaged = new CircuitFarmLogic("managedVegetable", FarmLogicVegetable.class, new String[]{"Vegetables"}); + Circuit.farmInfernalManaged = new CircuitFarmLogic("managedInfernal", FarmLogicInfernal.class, new String[]{"Infernal Crops"}); - Circuit.farmPeatManual = new CircuitFarmLogic("manualPeat", FarmLogicPeat.class, new String[] { "Peat Bog" }).setManual(); - Circuit.farmShroomManual = new CircuitFarmLogic("manualShroom", FarmLogicShroom.class, new String[] { "Mushrooms" }).setManual(); - Circuit.farmCerealManual = new CircuitFarmLogic("manualCereal", FarmLogicCereal.class, new String[] { "Crops" }).setManual(); - Circuit.farmVegetableManual = new CircuitFarmLogic("manualVegetable", FarmLogicVegetable.class, new String[] { "Vegetables" }).setManual(); - Circuit.farmSucculentManual = new CircuitFarmLogic("manualSucculent", FarmLogicSucculent.class, new String[] { "Succulents" }).setManual(); - Circuit.farmPoalesManual = new CircuitFarmLogic("manualPoales", FarmLogicPoale.class, new String[] { "Reeds" }).setManual(); - Circuit.farmGourdManual = new CircuitFarmLogic("manualGourd", FarmLogicGourd.class, new String[] { "Gourds" }).setManual(); - Circuit.farmCocoaManual = new CircuitFarmLogic("manualCocoa", FarmLogicCocoa.class, new String[] { "Cocoa Plantation" }).setManual(); + Circuit.farmPeatManual = new CircuitFarmLogic("manualPeat", FarmLogicPeat.class, new String[]{"Peat Bog"}).setManual(); + Circuit.farmShroomManual = new CircuitFarmLogic("manualShroom", FarmLogicShroom.class, new String[]{"Mushrooms"}).setManual(); + Circuit.farmCerealManual = new CircuitFarmLogic("manualCereal", FarmLogicCereal.class, new String[]{"Crops"}).setManual(); + Circuit.farmVegetableManual = new CircuitFarmLogic("manualVegetable", FarmLogicVegetable.class, new String[]{"Vegetables"}).setManual(); + Circuit.farmSucculentManual = new CircuitFarmLogic("manualSucculent", FarmLogicSucculent.class, new String[]{"Succulents"}).setManual(); + Circuit.farmPoalesManual = new CircuitFarmLogic("manualPoales", FarmLogicPoale.class, new String[]{"Reeds"}).setManual(); + Circuit.farmGourdManual = new CircuitFarmLogic("manualGourd", FarmLogicGourd.class, new String[]{"Gourds"}).setManual(); + Circuit.farmCocoaManual = new CircuitFarmLogic("manualCocoa", FarmLogicCocoa.class, new String[]{"Cocoa Plantation"}).setManual(); - Circuit.farmOrchardManual = new CircuitFarmLogic("manualOrchard", FarmLogicOrchard.class, new String[] { "Orchard" }); - Circuit.farmRubberManual = new CircuitFarmLogic("manualRubber", FarmLogicRubber.class, new String[] { "Rubber Plantation" }); + Circuit.farmOrchardManual = new CircuitFarmLogic("manualOrchard", FarmLogicOrchard.class, new String[]{"Orchard"}); + Circuit.farmRubberManual = new CircuitFarmLogic("manualRubber", FarmLogicRubber.class, new String[]{"Rubber Plantation"}); MinecraftForge.EVENT_BUS.register(new EventHandlerFarming()); } @@ -224,13 +224,15 @@ public class PluginFarming extends NativePlugin { try { Block sapling = GameData.getBlockRegistry().getRaw(items[0]); - if (sapling == null || sapling == Blocks.air) throw new RuntimeException("can't find block for "+items[0]); + if (sapling == null || sapling == Blocks.air) + throw new RuntimeException("can't find block for " + items[0]); - if (items.length == 2) { + if (items.length == 2) Farmables.farmables.get(tokens[0]).add(new FarmableGenericSapling(sapling, Integer.parseInt(items[1]))); - } else { + else { Item windfall = GameData.getItemRegistry().getRaw(items[2]); - if (windfall == null) throw new RuntimeException("can't find item for "+items[2]); + if (windfall == null) + throw new RuntimeException("can't find item for " + items[2]); Farmables.farmables.get(tokens[0]).add( new FarmableGenericSapling(sapling, Integer.parseInt(items[1]), @@ -263,9 +265,11 @@ public class PluginFarming extends NativePlugin { try { Item seed = GameData.getItemRegistry().getRaw(items[0]); - if (seed == null) throw new RuntimeException("can't find item for "+items[0]); + if (seed == null) + throw new RuntimeException("can't find item for " + items[0]); Block crop = GameData.getBlockRegistry().getRaw(items[2]); - if (crop == null || crop == Blocks.air) throw new RuntimeException("can't find block for "+items[2]); + if (crop == null || crop == Blocks.air) + throw new RuntimeException("can't find block for " + items[2]); Farmables.farmables.get(tokens[0]).add( new FarmableGenericCrop(new ItemStack(seed, 1, Integer.parseInt(items[1])), @@ -311,7 +315,7 @@ public class PluginFarming extends NativePlugin { @Override protected void registerRecipes() { - ItemStack basic = new ItemStack(ForestryBlock.farm, 1, 0); + ItemStack basic = ForestryBlock.farm.getItemStack(1, 0); for (EnumFarmBlock block : EnumFarmBlock.values()) { NBTTagCompound compound = new NBTTagCompound(); block.saveToCompound(compound); @@ -321,16 +325,16 @@ public class PluginFarming extends NativePlugin { } - ItemStack gearbox = new ItemStack(ForestryBlock.farm, 1, 2); + ItemStack gearbox = ForestryBlock.farm.getItemStack(1, 2); ShapedRecipeCustom.buildRecipe(gearbox, " # ", "TTT", '#', basic, 'T', "gearTin").setPreserveNBT(); - ItemStack hatch = new ItemStack(ForestryBlock.farm, 1, 3); + ItemStack hatch = ForestryBlock.farm.getItemStack(1, 3); ShapedRecipeCustom.buildRecipe(hatch, " # ", "TDT", '#', basic, 'T', "gearTin", 'D', Blocks.trapdoor).setPreserveNBT(); - ItemStack valve = new ItemStack(ForestryBlock.farm, 1, 4); + ItemStack valve = ForestryBlock.farm.getItemStack(1, 4); ShapedRecipeCustom.buildRecipe(valve, " # ", "XTX", '#', basic, 'T', "gearTin", 'X', Blocks.glass).setPreserveNBT(); - ItemStack control = new ItemStack(ForestryBlock.farm, 1, 5); + ItemStack control = ForestryBlock.farm.getItemStack(1, 5); ShapedRecipeCustom.buildRecipe(control, " # ", "XTX", '#', basic, 'T', ForestryItem.tubes.getItemStack(1, 4), 'X', Items.redstone).setPreserveNBT(); // Circuits diff --git a/src/main/java/forestry/plugins/PluginLepidopterology.java b/src/main/java/forestry/plugins/PluginLepidopterology.java index 997c811c1..50fc74806 100755 --- a/src/main/java/forestry/plugins/PluginLepidopterology.java +++ b/src/main/java/forestry/plugins/PluginLepidopterology.java @@ -91,15 +91,21 @@ public class PluginLepidopterology extends NativePlugin { public void preInit() { super.preInit(); - ForestryBlock.lepidopterology = new BlockBase(Material.iron); - ForestryBlock.lepidopterology.setBlockName("for.lepidopterology").setCreativeTab(Tabs.tabLepidopterology); - Proxies.common.registerBlock(ForestryBlock.lepidopterology, ItemForestryBlock.class); + ForestryBlock.lepidopterology.registerBlock(new BlockBase(Material.iron), ItemForestryBlock.class, "lepidopterology"); + ForestryBlock.lepidopterology.block().setCreativeTab(Tabs.tabLepidopterology); - definitionChest = ForestryBlock.lepidopterology.addDefinition((new MachineDefinition(Defaults.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class, - ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.lepidopterology, 1, Defaults.DEFINITION_LEPICHEST_META), new Object[] { " # ", "XYX", "XXX", '#', Blocks.glass, 'X', - ForestryItem.butterflyGE.getItemStack(1, Defaults.WILDCARD), 'Y', Blocks.chest })) - .setFaces(0, 1, 2, 3, 4, 4, 0, 7))); + BlockBase lepidopterology = ((BlockBase) ForestryBlock.lepidopterology.block()); + definitionChest = lepidopterology.addDefinition((new MachineDefinition(Defaults.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class, + ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.lepidopterology.getItemStack(1, Defaults.DEFINITION_LEPICHEST_META), + " # ", + "XYX", + "XXX", + '#', Blocks.glass, + 'X', ForestryItem.butterflyGE.getItemStack(1, Defaults.WILDCARD), + 'Y', Blocks.chest)) + .setFaces(0, 1, 2, 3, 4, 4, 0, 7))); AlleleManager.alleleRegistry.registerSpeciesRoot(PluginLepidopterology.butterflyInterface = new ButterflyHelper()); createAlleles(); @@ -129,7 +135,7 @@ public class PluginLepidopterology extends NativePlugin { ((ITreeRoot) AlleleManager.alleleRegistry.getSpeciesRoot("rootTrees")).registerLeafTickHandler(new ButterflySpawner()); - RecipeSorter.register("forestry:lepidopterologymating", MatingRecipe.class, RecipeSorter.Category.SHAPELESS, "before:minecraft:shapeless"); + RecipeSorter.register("forestry:lepidopterologymating", MatingRecipe.class, RecipeSorter.Category.SHAPELESS, "before:minecraft:shapeless"); } @Override @@ -154,8 +160,8 @@ public class PluginLepidopterology extends NativePlugin { CraftingManager.getInstance().getRecipeList().add(new MatingRecipe()); RecipeManagers.carpenterManager.addRecipe(100, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 2000), null, ForestryItem.flutterlyzer.getItemStack(), - new Object[] { "X#X", "X#X", "RDR", Character.valueOf('#'), Blocks.glass_pane, Character.valueOf('X'), "ingotBronze", Character.valueOf('R'), - Items.redstone, Character.valueOf('D'), Items.diamond }); + new Object[]{"X#X", "X#X", "RDR", Character.valueOf('#'), Blocks.glass_pane, Character.valueOf('X'), "ingotBronze", Character.valueOf('R'), + Items.redstone, Character.valueOf('D'), Items.diamond}); } private void createAlleles() { @@ -216,7 +222,7 @@ public class PluginLepidopterology extends NativePlugin { Allele.lepiCitrusSwallow = new AlleleButterflySpecies("lepiCitrusSwallow", false, "Citrus Swallowtail", papilio, "demodocus", 0xeae389).setRarity(1.0f) .setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); Allele.lepiEmeraldPeacock = new AlleleButterflySpecies("lepiEmeraldPeacock", true, "Emerald Peacock", papilio, "palinurus", 0x7cfe80) - .setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); + .setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); Allele.lepiThoasSwallow = new AlleleButterflySpecies("lepiThoasSwallow", false, "Thoas Swallowtail", papilio, "thoas", 0xeac783).setRarity(0.2f) .setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); Allele.lepiSpicebush = new AlleleButterflySpecies("lepiSpicebush", true, "Spicebush Swallowtail", papilio, "troilus", 0xeefeff).setRarity(0.5f); @@ -240,7 +246,7 @@ public class PluginLepidopterology extends NativePlugin { IClassification cethosia = createButterflyBranch(nymphalidae, "Cethosia"); Allele.lepiGlasswing = new AlleleButterflySpecies("lepiGlasswing", true, "Glasswing", greta, "oto", 0x583732) - .setTemperature(EnumTemperature.WARM); + .setTemperature(EnumTemperature.WARM); Allele.lepiSpeckledWood = new AlleleButterflySpecies("lepiSpeckledWood", true, "Speckled Wood", pararge, "aegeria", 0x947245).setRarity(1.0f); Allele.lepiMadeiranSpeckledWood = new AlleleButterflySpecies("lepiMSpeckledWood", true, "Madeiran Speckled Wood", pararge, "xiphia", 0x402919).setRarity(0.5f); @@ -251,7 +257,7 @@ public class PluginLepidopterology extends NativePlugin { Allele.lepiPeleidesBlueMorpho = new AlleleButterflySpecies("lepiPBlueMorpho", true, "Peleides Blue Morpho", morpho, "peleides", 0x6ecce8).setRarity(0.25f) .setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); Allele.lepiRhetenorBlueMorpho = new AlleleButterflySpecies("lepiRBlueMorpho", true, "Rhetenor Blue Morpho", morpho, "rhetenor", 0x00bef8) - .setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); + .setTemperature(EnumTemperature.WARM).setHumidity(EnumHumidity.DAMP); Allele.lepiComma = new AlleleButterflySpecies("lepiComma", true, "Comma", polygonia, "c-album", 0xf89505).setRarity(0.3f); Allele.lepiBatesia = new AlleleButterflySpecies("lepiBatesia", true, "Painted Beauty", batesia, "hypochlora", 0xfe7763).setRarity(0.3f) diff --git a/src/main/java/forestry/plugins/PluginMail.java b/src/main/java/forestry/plugins/PluginMail.java index 57c0af251..22b471e6e 100755 --- a/src/main/java/forestry/plugins/PluginMail.java +++ b/src/main/java/forestry/plugins/PluginMail.java @@ -99,31 +99,32 @@ public class PluginMail extends NativePlugin { highBuffer75 = new TriggerBuffer("mail.lowBuffer.75", 0.75f); highBuffer90 = new TriggerBuffer("mail.lowBuffer.90", 0.90f); - ForestryBlock.mail = new BlockBase(Material.iron); - ForestryBlock.mail.setBlockName("for.mail"); - Proxies.common.registerBlock(ForestryBlock.mail, ItemForestryBlock.class); + ForestryBlock.mail.registerBlock(new BlockBase(Material.iron), ItemForestryBlock.class, "mail"); - ShapedRecipeCustom recipe = ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.mail, 1, Defaults.DEFINITION_MAILBOX_META), + ShapedRecipeCustom recipe = ShapedRecipeCustom.createShapedRecipe(ForestryBlock.mail.getItemStack(1, Defaults.DEFINITION_MAILBOX_META), " # ", "#Y#", "XXX", '#', "ingotTin", 'X', Blocks.chest, 'Y', ForestryItem.sturdyCasing); - definitionMailbox = ForestryBlock.mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_MAILBOX_META, "forestry.Mailbox", MachineMailbox.class, recipe).setFaces(0, 1, 2, 2, 2, 2, 0, 7)); + BlockBase mail = ((BlockBase) ForestryBlock.mail.block()); - recipe = ShapedRecipeCustom.createShapedRecipe(new ItemStack(ForestryBlock.mail, 1, Defaults.DEFINITION_TRADESTATION_META), - "Z#Z", "#Y#", "XWX", + definitionMailbox = mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_MAILBOX_META, "forestry.Mailbox", MachineMailbox.class, recipe).setFaces(0, 1, 2, 2, 2, 2, 0, 7)); + + recipe = ShapedRecipeCustom.createShapedRecipe( + ForestryBlock.mail.getItemStack(1, Defaults.DEFINITION_TRADESTATION_META), + "Z#Z", + "#Y#", + "XWX", '#', ForestryItem.tubes.getItemStack(1, 2), 'X', Blocks.chest, 'Y', ForestryItem.sturdyCasing, 'Z', ForestryItem.tubes.getItemStack(1, 3), 'W', ForestryItem.circuitboards.getItemStack(1, 2)); - definitionTradestation = ForestryBlock.mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_TRADESTATION_META, "forestry.Tradestation", MachineTrader.class, recipe).setFaces(0, 1, 2, 3, 4, 4, 0, 7)); - - definitionPhilatelist = ForestryBlock.mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_PHILATELIST_META, "forestry.Philatelist", MachinePhilatelist.class) - .setFaces(0, 1, 2, 3, 2, 2, 0, 7)); - + definitionTradestation = mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_TRADESTATION_META, "forestry.Tradestation", MachineTrader.class, recipe).setFaces(0, 1, 2, 3, 4, 4, 0, 7)); + definitionPhilatelist = mail.addDefinition(new MachineDefinition(Defaults.DEFINITION_PHILATELIST_META, "forestry.Philatelist", MachinePhilatelist.class) + .setFaces(0, 1, 2, 3, 2, 2, 0, 7)); PostManager.postRegistry = new PostRegistry(); PostManager.postRegistry.registerCarrier(new PostalCarrier(EnumAddressee.PLAYER)); @@ -157,11 +158,11 @@ public class PluginMail extends NativePlugin { @Override protected void registerItems() { - stampDefinitions = new StampInfo[] { - new StampInfo("1n", EnumPostage.P_1, ForestryItem.apatite, 0x4a8ca7, 0xffffff), new StampInfo("2n", EnumPostage.P_2, "ingotCopper", 0xe8c814, 0xffffff), - new StampInfo("5n", EnumPostage.P_5, "ingotTin", 0x9c0707, 0xffffff), new StampInfo("10n", EnumPostage.P_10, Items.gold_ingot, 0x7bd1b8, 0xffffff), - new StampInfo("20n", EnumPostage.P_20, Items.diamond, 0xff9031, 0xfff7dd), new StampInfo("50n", EnumPostage.P_50, Items.emerald, 0x6431d7, 0xfff7dd), - new StampInfo("100n", EnumPostage.P_100, Items.nether_star, 0xd731ba, 0xfff7dd) }; //new StampInfo("200n", EnumPostage.P_200, Item.netherStar, 0xcd9831, 0xfff7dd)}; + stampDefinitions = new StampInfo[]{ + new StampInfo("1n", EnumPostage.P_1, ForestryItem.apatite, 0x4a8ca7, 0xffffff), new StampInfo("2n", EnumPostage.P_2, "ingotCopper", 0xe8c814, 0xffffff), + new StampInfo("5n", EnumPostage.P_5, "ingotTin", 0x9c0707, 0xffffff), new StampInfo("10n", EnumPostage.P_10, Items.gold_ingot, 0x7bd1b8, 0xffffff), + new StampInfo("20n", EnumPostage.P_20, Items.diamond, 0xff9031, 0xfff7dd), new StampInfo("50n", EnumPostage.P_50, Items.emerald, 0x6431d7, 0xfff7dd), + new StampInfo("100n", EnumPostage.P_100, Items.nether_star, 0xd731ba, 0xfff7dd)}; //new StampInfo("200n", EnumPostage.P_200, Item.netherStar, 0xcd9831, 0xfff7dd)}; /* STAMPS */ ForestryItem.stamps.registerItem(new ItemStamps(stampDefinitions), "stamps"); @@ -186,25 +187,24 @@ public class PluginMail extends NativePlugin { // Letters Proxies.common.addShapelessRecipe(ForestryItem.letters.getItemStack(), Items.paper, ForestryItem.propolis.getItemStack(1, Defaults.WILDCARD)); - if (Config.craftingStampsEnabled) { + if (Config.craftingStampsEnabled) for (int i = 0; i < stampDefinitions.length; i++) { if (Config.collectorStamps.contains(stampDefinitions[i].name)) continue; - Proxies.common.addRecipe(ForestryItem.stamps.getItemStack(9, i), new Object[] { "XXX", "###", "ZZZ", 'X', - stampDefinitions[i].getCraftingIngredient(), '#', Items.paper, 'Z', ForestryItem.honeyDrop }); + Proxies.common.addRecipe(ForestryItem.stamps.getItemStack(9, i), new Object[]{"XXX", "###", "ZZZ", 'X', + stampDefinitions[i].getCraftingIngredient(), '#', Items.paper, 'Z', ForestryItem.honeyDrop}); RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_SEEDOIL, 300), null, ForestryItem.stamps.getItemStack(9, i), - new Object[] { "XXX", "###", 'X', stampDefinitions[i].getCraftingIngredient(), '#', Items.paper }); + new Object[]{"XXX", "###", 'X', stampDefinitions[i].getCraftingIngredient(), '#', Items.paper}); } - } // Recycling - Proxies.common.addRecipe(new ItemStack(Items.paper), new Object[] { "###", '#', ForestryItem.letters.getItemStack(1, Defaults.WILDCARD) }); + Proxies.common.addRecipe(new ItemStack(Items.paper), new Object[]{"###", '#', ForestryItem.letters.getItemStack(1, Defaults.WILDCARD)}); // Carpenter - RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, ForestryItem.letters.getItemStack(), new Object[] { "###", "###", '#', ForestryItem.woodPulp }); + RecipeManagers.carpenterManager.addRecipe(10, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 250), null, ForestryItem.letters.getItemStack(), new Object[]{"###", "###", '#', ForestryItem.woodPulp}); - Proxies.common.addShapelessRecipe(ForestryItem.catalogue.getItemStack(), new Object[] { ForestryItem.stamps.getItemStack(1, Defaults.WILDCARD), new ItemStack(Items.book) }); + Proxies.common.addShapelessRecipe(ForestryItem.catalogue.getItemStack(), new Object[]{ForestryItem.stamps.getItemStack(1, Defaults.WILDCARD), new ItemStack(Items.book)}); } @Override @@ -219,6 +219,6 @@ public class PluginMail extends NativePlugin { @Override public ICommand[] getConsoleCommands() { - return new ICommand[] { new CommandMail() }; + return new ICommand[]{new CommandMail()}; } } diff --git a/src/main/java/forestry/plugins/PluginStorage.java b/src/main/java/forestry/plugins/PluginStorage.java index 9743eea9f..68fb8290c 100755 --- a/src/main/java/forestry/plugins/PluginStorage.java +++ b/src/main/java/forestry/plugins/PluginStorage.java @@ -148,38 +148,37 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler } public static void scanForItems() { - for (Object id : Block.blockRegistry.getKeys()) { + for (Object id : Block.blockRegistry.getKeys()) try { Block block = (Block) Block.blockRegistry.getObject(id); - if (block instanceof IPlantable || - block instanceof IShearable || - block instanceof BlockLog || - block instanceof BlockMelon || - block instanceof BlockPumpkin) + if (block instanceof IPlantable + || block instanceof IShearable + || block instanceof BlockLog + || block instanceof BlockMelon + || block instanceof BlockPumpkin) addBackpackItem("forester", block); - if (block instanceof BlockStairs || block.getRenderType() == 10 || - block instanceof BlockFence || block.getRenderType() == 11 || - block instanceof BlockFenceGate || block.getRenderType() == 21 || - block instanceof BlockWall || block.getRenderType() == 32 || - block instanceof BlockBasePressurePlate || - block instanceof BlockLever || - block instanceof BlockButton || - block instanceof BlockTorch || - block instanceof BlockRedstoneDiode || - block instanceof BlockChest || block.getRenderType() == 22 || - block instanceof BlockWorkbench || - block instanceof BlockFurnace || - block instanceof BlockLadder || block.getRenderType() == 8 || - block instanceof BlockTrapDoor || - block.getUnlocalizedName().contains("door")) + if (block instanceof BlockStairs || block.getRenderType() == 10 + || block instanceof BlockFence || block.getRenderType() == 11 + || block instanceof BlockFenceGate || block.getRenderType() == 21 + || block instanceof BlockWall || block.getRenderType() == 32 + || block instanceof BlockBasePressurePlate + || block instanceof BlockLever + || block instanceof BlockButton + || block instanceof BlockTorch + || block instanceof BlockRedstoneDiode + || block instanceof BlockChest || block.getRenderType() == 22 + || block instanceof BlockWorkbench + || block instanceof BlockFurnace + || block instanceof BlockLadder || block.getRenderType() == 8 + || block instanceof BlockTrapDoor + || block.getUnlocalizedName().contains("door")) addBackpackItem("builder", block); } catch (Throwable error) { error.printStackTrace(); } - } - for (Object id : Item.itemRegistry.getKeys()) { + for (Object id : Item.itemRegistry.getKeys()) try { Item item = (Item) Item.itemRegistry.getObject(id); @@ -192,7 +191,6 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler } catch (Throwable error) { error.printStackTrace(); } - } } @Override @@ -257,7 +255,7 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler ForestryItem.diggerBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "diggerBagT2"); definition = new BackpackDefinition("forester", 0x347427) - .setValidItems(BackpackManager.backpackItems[2]); + .setValidItems(BackpackManager.backpackItems[2]); BackpackManager.definitions.put(definition.getKey(), definition); ForestryItem.foresterBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "foresterBag"); ForestryItem.foresterBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "foresterBagT2"); @@ -268,13 +266,13 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler ForestryItem.hunterBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "hunterBagT2"); definition = new BackpackDefinition("adventurer", 0x7fb8c2) - .setValidItems(BackpackManager.backpackItems[4]); + .setValidItems(BackpackManager.backpackItems[4]); BackpackManager.definitions.put(definition.getKey(), definition); ForestryItem.adventurerBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "adventurerBackpack"); ForestryItem.adventurerBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "adventurerBackpackT2"); definition = new BackpackDefinition("builder", 0xdd3a3a) - .setValidItems(BackpackManager.backpackItems[5]); + .setValidItems(BackpackManager.backpackItems[5]); BackpackManager.definitions.put(definition.getKey(), definition); ForestryItem.builderBackpack.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T1), "builderBackpack"); ForestryItem.builderBackpackT2.registerItem(BackpackManager.backpackInterface.addBackpack(definition, EnumBackpackType.T2), "builderBackpackT2"); @@ -346,7 +344,7 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler foresterItems.add(new ItemStack(Items.pumpkin_seeds)); foresterItems.add(new ItemStack(Items.melon_seeds)); foresterItems.add(new ItemStack(Items.wheat)); - foresterItems.add(new ItemStack(ForestryBlock.saplingGE, 1)); + foresterItems.add(ForestryBlock.saplingGE.getWildcard()); // [3] Set valid items in hunter's backpack hunterItems.add(new ItemStack(Items.feather)); @@ -389,13 +387,12 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler hunterItems.add(new ItemStack(Items.iron_horse_armor)); // [4] Set valid items in adventurer's backpack - // [5] Set valid items in builder's backpack builderItems.add(new ItemStack(Blocks.torch)); builderItems.add(new ItemStack(Blocks.redstone_torch)); builderItems.add(new ItemStack(Blocks.redstone_lamp)); - builderItems.add(new ItemStack(ForestryBlock.candle)); - builderItems.add(new ItemStack(ForestryBlock.stump)); + builderItems.add(ForestryBlock.candle.getWildcard()); + builderItems.add(ForestryBlock.stump.getWildcard()); builderItems.add(new ItemStack(Blocks.stonebrick, 1, Defaults.WILDCARD)); builderItems.add(new ItemStack(Blocks.sandstone, 1, 1)); builderItems.add(new ItemStack(Blocks.sandstone, 1, 2)); @@ -445,54 +442,54 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler // Apiarist's Backpack Proxies.common.addRecipe(ForestryItem.apiaristBackpack.getItemStack(), - new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', - "stickWood", 'Y', new ItemStack(ForestryBlock.apiculture, 1, Defaults.DEFINITION_APIARISTCHEST_META) }); + new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', + "stickWood", 'Y', ForestryBlock.apiculture.getItemStack(1, Defaults.DEFINITION_APIARISTCHEST_META)}); // Lepidopterist's Backpack Proxies.common.addRecipe(ForestryItem.lepidopteristBackpack.getItemStack(), - new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', - "stickWood", 'Y', new ItemStack(ForestryBlock.lepidopterology, 1, Defaults.DEFINITION_LEPICHEST_META) }); + new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', + "stickWood", 'Y', ForestryBlock.lepidopterology.getItemStack(1, Defaults.DEFINITION_LEPICHEST_META)}); // Miner's Backpack Proxies.common.addRecipe(ForestryItem.minerBackpack.getItemStack(), - new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', - Items.iron_ingot, 'Y', Blocks.chest }); + new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', + Items.iron_ingot, 'Y', Blocks.chest}); // Digger's Backpack Proxies.common.addRecipe(ForestryItem.diggerBackpack.getItemStack(), - new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', - Blocks.stone, 'Y', Blocks.chest }); + new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', + Blocks.stone, 'Y', Blocks.chest}); // Forester's Backpack - Proxies.common.addRecipe(ForestryItem.foresterBackpack.getItemStack(), new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, - 'X', Items.string, 'V', "logWood", 'Y', Blocks.chest }); + Proxies.common.addRecipe(ForestryItem.foresterBackpack.getItemStack(), new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, + 'X', Items.string, 'V', "logWood", 'Y', Blocks.chest}); // Hunter's Backpack Proxies.common.addRecipe(ForestryItem.hunterBackpack.getItemStack(), - new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', - Items.feather, 'Y', Blocks.chest }); + new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, 'X', Items.string, 'V', + Items.feather, 'Y', Blocks.chest}); // Adventurer's Backpack - Proxies.common.addRecipe(ForestryItem.adventurerBackpack.getItemStack(), new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, - 'X', Items.string, 'V', Items.bone, 'Y', Blocks.chest }); + Proxies.common.addRecipe(ForestryItem.adventurerBackpack.getItemStack(), new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, + 'X', Items.string, 'V', Items.bone, 'Y', Blocks.chest}); // Builder's Backpack - Proxies.common.addRecipe(ForestryItem.builderBackpack.getItemStack(), new Object[] { "X#X", "VYV", "X#X", '#', Blocks.wool, - 'X', Items.string, 'V', Items.clay_ball, 'Y', Blocks.chest }); + Proxies.common.addRecipe(ForestryItem.builderBackpack.getItemStack(), new Object[]{"X#X", "VYV", "X#X", '#', Blocks.wool, + 'X', Items.string, 'V', Items.clay_ball, 'Y', Blocks.chest}); // / CARPENTER // / BACKPACKS T2 RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.minerBackpackT2.getItemStack(), - new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.minerBackpack }); + new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.minerBackpack}); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.diggerBackpackT2.getItemStack(), - new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.diggerBackpack }); + new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.diggerBackpack}); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.foresterBackpackT2.getItemStack(), - new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.foresterBackpack }); + new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.foresterBackpack}); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.hunterBackpackT2.getItemStack(), - new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.hunterBackpack }); + new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.hunterBackpack}); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.adventurerBackpackT2.getItemStack(), - new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.adventurerBackpack }); + new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.adventurerBackpack}); RecipeManagers.carpenterManager.addRecipe(200, LiquidHelper.getLiquid(Defaults.LIQUID_WATER, 1000), null, ForestryItem.builderBackpackT2.getItemStack(), - new Object[] { "WXW", "WTW", "WWW", 'X', Items.diamond, 'W', - ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.builderBackpack }); + new Object[]{"WXW", "WTW", "WWW", 'X', Items.diamond, 'W', + ForestryItem.craftingMaterial.getItemStack(1, 3), 'T', ForestryItem.builderBackpack}); } @@ -527,23 +524,22 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler String[] ident = part.split("[:]+"); if (ident.length != 2 && ident.length != 3) { - Proxies.log.warning("Failed to add block/item of (" + part + ") to "+backpackIdent+" since it isn't formatted properly. Suitable are , : or :*, e.g. IC2:blockWall:*."); + Proxies.log.warning("Failed to add block/item of (" + part + ") to " + backpackIdent + " since it isn't formatted properly. Suitable are , : or :*, e.g. IC2:blockWall:*."); continue; } String name = ident[0] + ":" + ident[1]; int meta; - if (ident.length == 2) { + if (ident.length == 2) meta = 0; - } else { + else try { meta = ident[2].equals("*") ? OreDictionary.WILDCARD_VALUE : NumberFormat.getIntegerInstance().parse(ident[2]).intValue(); } catch (ParseException e) { - Proxies.log.warning("Failed to add block/item of (" + part + ") to "+backpackIdent+" since its metadata isn't formatted properly. Suitable are integer values or *."); + Proxies.log.warning("Failed to add block/item of (" + part + ") to " + backpackIdent + " since its metadata isn't formatted properly. Suitable are integer values or *."); continue; } - } Item item = GameData.getItemRegistry().getRaw(name); @@ -551,14 +547,14 @@ public class PluginStorage extends NativePlugin implements IOreDictionaryHandler Block block = GameData.getBlockRegistry().getRaw(name); if (block == null || Item.getItemFromBlock(block) == null) { - Proxies.log.warning("Failed to add block/item of (" + part + ") to "+backpackIdent+" since it couldn't be found."); + Proxies.log.warning("Failed to add block/item of (" + part + ") to " + backpackIdent + " since it couldn't be found."); continue; } item = Item.getItemFromBlock(block); } - Proxies.log.finer("Adding block/item of (" + part + ") to "+backpackIdent+"."); + Proxies.log.finer("Adding block/item of (" + part + ") to " + backpackIdent + "."); target.addValidItem(new ItemStack(item, 1, meta)); } } diff --git a/src/main/java/forestry/storage/BackpackDefinition.java b/src/main/java/forestry/storage/BackpackDefinition.java index 8fa87bfdb..f4fb42039 100755 --- a/src/main/java/forestry/storage/BackpackDefinition.java +++ b/src/main/java/forestry/storage/BackpackDefinition.java @@ -17,7 +17,9 @@ import net.minecraft.item.ItemStack; import forestry.api.storage.IBackpackDefinition; import forestry.core.config.Defaults; -import forestry.core.utils.StringUtil; +import net.minecraft.item.Item; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.StatCollector; public class BackpackDefinition implements IBackpackDefinition { @@ -45,12 +47,22 @@ public class BackpackDefinition implements IBackpackDefinition { @Override public String getName() { - return StringUtil.localize("storage.backpack." + name); + return "Update Forestry!"; } @Override public String getName(ItemStack backpack) { - return getName(); + Item item = backpack.getItem(); + String display = ("" + StatCollector.translateToLocal(item.getUnlocalizedNameInefficiently(backpack) + ".name")).trim(); + + if (backpack.stackTagCompound != null && backpack.stackTagCompound.hasKey("display", 10)) { + NBTTagCompound nbt = backpack.stackTagCompound.getCompoundTag("display"); + + if (nbt.hasKey("Name", 8)) + display = nbt.getString("Name"); + } + + return display; } @Override diff --git a/src/main/java/forestry/storage/items/ItemBackpack.java b/src/main/java/forestry/storage/items/ItemBackpack.java index d632617f7..3dbe05c69 100755 --- a/src/main/java/forestry/storage/items/ItemBackpack.java +++ b/src/main/java/forestry/storage/items/ItemBackpack.java @@ -43,7 +43,6 @@ import forestry.core.render.TextureManager; import forestry.core.utils.ItemInventory; import forestry.core.utils.StringUtil; import forestry.storage.BackpackMode; -import java.util.EnumSet; public class ItemBackpack extends ItemInventoried {