diff --git a/src/main/java/forestry/apiculture/VillageHandlerApiculture.java b/src/main/java/forestry/apiculture/VillageHandlerApiculture.java index e14117da6..bb19efa41 100755 --- a/src/main/java/forestry/apiculture/VillageHandlerApiculture.java +++ b/src/main/java/forestry/apiculture/VillageHandlerApiculture.java @@ -29,10 +29,9 @@ import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; import forestry.api.apiculture.EnumBeeType; +import forestry.apiculture.blocks.BlockApiculture; import forestry.apiculture.genetics.BeeDefinition; import forestry.apiculture.worldgen.ComponentVillageBeeHouse; -import forestry.core.config.Constants; -import forestry.core.config.ForestryBlock; import forestry.core.utils.Log; import forestry.plugins.PluginApiculture; @@ -49,11 +48,20 @@ public class VillageHandlerApiculture implements IVillageCreationHandler, IVilla @SuppressWarnings("unchecked") @Override public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) { - recipeList.add(new MerchantRecipe(new ItemStack(PluginApiculture.items.beePrincessGE, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.emerald, 1))); - recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), PluginApiculture.items.beeComb.getRandomComb(1, random, false))); - recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, OreDictionary.WILDCARD_VALUE), ForestryBlock.apiculture.getItemStack(1, Constants.DEFINITION_APIARY_META))); - recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), PluginApiculture.items.frameProven.getItemStack(6))); - recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), new ItemStack(PluginApiculture.items.beePrincessGE, 1, OreDictionary.WILDCARD_VALUE), BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE))); + ItemStack wildcardPrincess = new ItemStack(PluginApiculture.items.beePrincessGE, 1, OreDictionary.WILDCARD_VALUE); + recipeList.add(new MerchantRecipe(wildcardPrincess, new ItemStack(Items.emerald, 1))); + + ItemStack randomComb = PluginApiculture.items.beeComb.getRandomComb(1, random, false); + recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), randomComb)); + + ItemStack apiary = PluginApiculture.blocks.apiculture.get(BlockApiculture.Type.APIARY, 1); + recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, OreDictionary.WILDCARD_VALUE), apiary)); + + ItemStack provenFrames = PluginApiculture.items.frameProven.getItemStack(6); + recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), provenFrames)); + + ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE); + recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), wildcardPrincess, monasticDrone)); } @Override diff --git a/src/main/java/forestry/apiculture/blocks/BlockAlveary.java b/src/main/java/forestry/apiculture/blocks/BlockAlveary.java index 4d4632024..027c6b8fb 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockAlveary.java +++ b/src/main/java/forestry/apiculture/blocks/BlockAlveary.java @@ -40,11 +40,24 @@ import forestry.core.blocks.BlockStructure; import forestry.core.render.TextureManager; public class BlockAlveary extends BlockStructure { + public enum Type { + PLAIN, + ENTRANCE, + SWARMER, + FAN, + HEATER, + HYGRO, + STABILIZER, + SIEVE; + + public static final Type[] VALUES = values(); + } public BlockAlveary() { super(new MaterialBeehive(false)); setHardness(1.0f); setCreativeTab(Tabs.tabApiculture); + setHarvestLevel("axe", 0); } @SuppressWarnings({"rawtypes", "unchecked"}) @@ -85,19 +98,25 @@ public class BlockAlveary extends BlockStructure { /* TILE ENTITY CREATION */ @Override public TileEntity createTileEntity(World world, int metadata) { - switch (metadata) { - case TileAlveary.SWARMER_META: + if (metadata < 0 || metadata > Type.VALUES.length) { + return null; + } + + Type type = Type.VALUES[metadata]; + switch (type) { + case SWARMER: return new TileAlvearySwarmer(); - case TileAlveary.FAN_META: + case FAN: return new TileAlvearyFan(); - case TileAlveary.HEATER_META: + case HEATER: return new TileAlvearyHeater(); - case TileAlveary.HYGRO_META: + case HYGRO: return new TileAlvearyHygroregulator(); - case TileAlveary.STABILIZER_META: + case STABILIZER: return new TileAlvearyStabiliser(); - case TileAlveary.SIEVE_META: + case SIEVE: return new TileAlvearySieve(); + case PLAIN: default: return new TileAlvearyPlain(); } @@ -151,27 +170,29 @@ public class BlockAlveary extends BlockStructure { @Override public IIcon getIcon(int side, int metadata) { if ((metadata <= 1 - || metadata == TileAlveary.SIEVE_META || metadata == TileAlveary.SWARMER_META || metadata == TileAlveary.STABILIZER_META) + || metadata == Type.SIEVE.ordinal() || metadata == Type.SWARMER.ordinal() || metadata == Type.STABILIZER.ordinal()) && (side == 1 || side == 0)) { return icons[BOTTOM]; } - switch (metadata) { - case TileAlveary.PLAIN_META: + Type type = Type.VALUES[metadata]; + + switch (type) { + case PLAIN: return icons[PLAIN]; - case TileAlveary.ENTRANCE_META: + case ENTRANCE: return icons[ENTRANCE]; - case TileAlveary.SWARMER_META: + case SWARMER: return icons[ALVEARY_SWARMER_OFF]; - case TileAlveary.FAN_META: + case FAN: return icons[ALVEARY_FAN_OFF]; - case TileAlveary.HEATER_META: + case HEATER: return icons[ALVEARY_HEATER_OFF]; - case TileAlveary.HYGRO_META: + case HYGRO: return icons[ALVEARY_HYGRO]; - case TileAlveary.STABILIZER_META: + case STABILIZER: return icons[STABILISER]; - case TileAlveary.SIEVE_META: + case SIEVE: return icons[SIEVE]; default: return null; @@ -263,4 +284,8 @@ public class BlockAlveary extends BlockStructure { tileAlveary.getMultiblockLogic().getController().reassemble(); } } + + public ItemStack get(Type type, int amount) { + return new ItemStack(this, amount, type.ordinal()); + } } diff --git a/src/main/java/forestry/apiculture/blocks/BlockApiculture.java b/src/main/java/forestry/apiculture/blocks/BlockApiculture.java new file mode 100644 index 000000000..b960dd374 --- /dev/null +++ b/src/main/java/forestry/apiculture/blocks/BlockApiculture.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * 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.apiculture.blocks; + +import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; + +import forestry.api.core.Tabs; +import forestry.core.blocks.BlockBase; + +public class BlockApiculture extends BlockBase { + public enum Type { + APIARY, + APIARIST_CHEST_LEGACY, + BEEHOUSE; + } + + public BlockApiculture(Material material) { + super(material); + setCreativeTab(Tabs.tabApiculture); + setHarvestLevel("axe", 0); + } + + public ItemStack get(Type type, int amount) { + return new ItemStack(this, amount, type.ordinal()); + } +} diff --git a/src/main/java/forestry/apiculture/blocks/BlockBeehives.java b/src/main/java/forestry/apiculture/blocks/BlockBeehives.java index 3e4f03306..4b6f3f676 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockBeehives.java +++ b/src/main/java/forestry/apiculture/blocks/BlockBeehives.java @@ -41,6 +41,11 @@ import forestry.core.utils.ItemStackUtil; import forestry.plugins.PluginApiculture; public class BlockBeehives extends BlockContainer { + public enum Type { + LEGACY, + FOREST, + MEADOWS; + } public BlockBeehives() { super(new MaterialBeehive(true)); diff --git a/src/main/java/forestry/apiculture/blocks/BlockCandle.java b/src/main/java/forestry/apiculture/blocks/BlockCandle.java index fd234d37a..5d8cf0317 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockCandle.java +++ b/src/main/java/forestry/apiculture/blocks/BlockCandle.java @@ -326,4 +326,11 @@ public class BlockCandle extends BlockTorch { } } + public ItemStack getUnlitCandle(int amount) { + return new ItemStack(this, amount, 0); + } + + public ItemStack getLitCandle(int amount) { + return new ItemStack(this, amount, 1); + } } diff --git a/src/main/java/forestry/apiculture/blocks/BlockRegistryApiculture.java b/src/main/java/forestry/apiculture/blocks/BlockRegistryApiculture.java new file mode 100644 index 000000000..3238e2256 --- /dev/null +++ b/src/main/java/forestry/apiculture/blocks/BlockRegistryApiculture.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * 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.apiculture.blocks; + +import net.minecraft.block.material.Material; + +import forestry.api.core.Tabs; +import forestry.apiculture.items.ItemBlockCandle; +import forestry.core.blocks.BlockBase; +import forestry.core.blocks.BlockRegistry; +import forestry.core.items.ItemBlockForestry; + +public class BlockRegistryApiculture extends BlockRegistry { + public final BlockApiculture apiculture; + public final BlockBase apicultureChest; + public final BlockBeehives beehives; + public final BlockCandle candle; + public final BlockStump stump; + public final BlockAlveary alveary; + + public BlockRegistryApiculture() { + apiculture = registerBlock(new BlockApiculture(Material.iron), ItemBlockForestry.class, "apiculture"); + + apicultureChest = registerBlock(new BlockBase(Material.iron, true), ItemBlockForestry.class, "apicultureChest"); + apicultureChest.setCreativeTab(Tabs.tabApiculture); + apicultureChest.setHarvestLevel("axe", 0); + + beehives = registerBlock(new BlockBeehives(), ItemBlockForestry.class, "beehives"); + + candle = registerBlock(new BlockCandle(), ItemBlockCandle.class, "candle"); + stump = registerBlock(new BlockStump(), ItemBlockForestry.class, "stump"); + + alveary = registerBlock(new BlockAlveary(), ItemBlockForestry.class, "alveary"); + } +} diff --git a/src/main/java/forestry/apiculture/blocks/BlockStump.java b/src/main/java/forestry/apiculture/blocks/BlockStump.java index 0391e5b56..c552f3617 100644 --- a/src/main/java/forestry/apiculture/blocks/BlockStump.java +++ b/src/main/java/forestry/apiculture/blocks/BlockStump.java @@ -29,10 +29,10 @@ import cpw.mods.fml.relauncher.SideOnly; import forestry.api.core.Tabs; import forestry.apiculture.tiles.TileCandle; import forestry.core.config.Constants; -import forestry.core.config.ForestryBlock; import forestry.core.render.TextureManager; import forestry.core.utils.ItemStackUtil; import forestry.core.utils.StringUtil; +import forestry.plugins.PluginApiculture; public class BlockStump extends BlockTorch { @@ -63,7 +63,7 @@ public class BlockStump extends BlockTorch { (held.getItem() == Items.flint_and_steel || held.getItem() == Items.flint || ItemStackUtil.equals(Blocks.torch, held))) { - world.setBlock(x, y, z, ForestryBlock.candle.block(), world.getBlockMetadata(x, y, z) | 0x08, Constants.FLAG_BLOCK_SYNCH); + world.setBlock(x, y, z, PluginApiculture.blocks.candle, world.getBlockMetadata(x, y, z) | 0x08, Constants.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/entities/EntityMinecartApiary.java b/src/main/java/forestry/apiculture/entities/EntityMinecartApiary.java index 832cbe66c..a316c8bea 100644 --- a/src/main/java/forestry/apiculture/entities/EntityMinecartApiary.java +++ b/src/main/java/forestry/apiculture/entities/EntityMinecartApiary.java @@ -26,11 +26,10 @@ import forestry.api.apiculture.IHiveFrame; import forestry.apiculture.ApiaryBeeListener; import forestry.apiculture.ApiaryBeeModifier; import forestry.apiculture.IApiary; +import forestry.apiculture.blocks.BlockApiculture; import forestry.apiculture.inventory.IApiaryInventory; import forestry.apiculture.inventory.InventoryApiary; import forestry.core.config.Config; -import forestry.core.config.Constants; -import forestry.core.config.ForestryBlock; import forestry.core.inventory.IInventoryAdapter; import forestry.core.network.GuiId; import forestry.plugins.PluginApiculture; @@ -76,12 +75,12 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement @Override public Block func_145820_n() { - return ForestryBlock.apiculture.block(); + return PluginApiculture.blocks.apiculture; } @Override public int getDisplayTileData() { - return Constants.DEFINITION_APIARY_META; + return BlockApiculture.Type.APIARY.ordinal(); } @Override diff --git a/src/main/java/forestry/apiculture/entities/EntityMinecartBeehouse.java b/src/main/java/forestry/apiculture/entities/EntityMinecartBeehouse.java index 4c8354fea..aaf394f63 100644 --- a/src/main/java/forestry/apiculture/entities/EntityMinecartBeehouse.java +++ b/src/main/java/forestry/apiculture/entities/EntityMinecartBeehouse.java @@ -23,9 +23,8 @@ import forestry.api.apiculture.IBeeListener; import forestry.api.apiculture.IBeeModifier; import forestry.apiculture.BeehouseBeeModifier; import forestry.apiculture.InventoryBeeHousing; +import forestry.apiculture.blocks.BlockApiculture; import forestry.core.config.Config; -import forestry.core.config.Constants; -import forestry.core.config.ForestryBlock; import forestry.core.inventory.IInventoryAdapter; import forestry.core.network.GuiId; import forestry.plugins.PluginApiculture; @@ -58,12 +57,12 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase { @Override public Block func_145820_n() { - return ForestryBlock.apiculture.block(); + return PluginApiculture.blocks.apiculture; } @Override public int getDisplayTileData() { - return Constants.DEFINITION_BEEHOUSE_META; + return BlockApiculture.Type.BEEHOUSE.ordinal(); } @Override diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlveary.java b/src/main/java/forestry/apiculture/multiblock/TileAlveary.java index f9777911b..b4628708a 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlveary.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlveary.java @@ -31,15 +31,6 @@ import forestry.core.access.IRestrictedAccess; import forestry.core.multiblock.MultiblockTileEntityForestry; public abstract class TileAlveary extends MultiblockTileEntityForestry implements IBeeHousing, IRestrictedAccess, IAlvearyComponent { - public static final int PLAIN_META = 0; - public static final int ENTRANCE_META = 1; - public static final int SWARMER_META = 2; - public static final int FAN_META = 3; - public static final int HEATER_META = 4; - public static final int HYGRO_META = 5; - public static final int STABILIZER_META = 6; - public static final int SIEVE_META = 7; - protected TileAlveary() { super(new MultiblockLogicAlveary()); } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearyHygroregulator.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearyHygroregulator.java index 6abdc6f01..be5a0980a 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearyHygroregulator.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearyHygroregulator.java @@ -43,7 +43,7 @@ public class TileAlvearyHygroregulator extends TileAlvearyWithGui implements IIn private int transferTime; public TileAlvearyHygroregulator() { - super(TileAlveary.HYGRO_META, GuiId.HygroregulatorGUI); + super(BlockAlveary.Type.HYGRO, GuiId.HygroregulatorGUI); this.inventory = new InventoryHygroregulator(this); diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearyPlain.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearyPlain.java index 33e0c6ae9..471a7783e 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearyPlain.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearyPlain.java @@ -25,6 +25,7 @@ import cpw.mods.fml.common.Optional; import forestry.api.core.ForestryAPI; import forestry.api.multiblock.IMultiblockController; +import forestry.apiculture.blocks.BlockAlveary; import forestry.apiculture.trigger.ApicultureTriggers; import forestry.core.config.Config; import forestry.core.gui.IHintSource; @@ -52,7 +53,7 @@ public class TileAlvearyPlain extends TileAlveary implements IClimatised, IHintS // set alveary entrance block meta if (yCoord == maxCoord.posY) { if ((xCoord > minCoord.posX && xCoord < maxCoord.posX) || (zCoord > minCoord.posZ && zCoord < maxCoord.posZ)) { - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, TileAlveary.ENTRANCE_META, 2); + this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, BlockAlveary.Type.ENTRANCE.ordinal(), 2); } } } @@ -64,7 +65,7 @@ public class TileAlvearyPlain extends TileAlveary implements IClimatised, IHintS if (!worldObj.isRemote) { // set alveary entrance block meta back to normal - this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, TileAlveary.PLAIN_META, 2); + this.worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, BlockAlveary.Type.PLAIN.ordinal(), 2); } } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearySieve.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearySieve.java index 8c0cc8d99..6aabb94ec 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearySieve.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearySieve.java @@ -31,7 +31,7 @@ public class TileAlvearySieve extends TileAlvearyWithGui implements IAlvearyComp private final InventoryAlvearySieve inventory; public TileAlvearySieve() { - super(TileAlveary.SIEVE_META, GuiId.AlvearySieveGUI); + super(BlockAlveary.Type.SIEVE, GuiId.AlvearySieveGUI); this.inventory = new InventoryAlvearySieve(this); this.beeListener = new AlvearySieveBeeListener(inventory); } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java index 04bd914e5..897b87312 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearySwarmer.java @@ -44,7 +44,7 @@ public class TileAlvearySwarmer extends TileAlvearyWithGui implements ISidedInve private boolean active; public TileAlvearySwarmer() { - super(TileAlveary.SWARMER_META, GuiId.AlvearySwarmerGUI); + super(BlockAlveary.Type.SWARMER, GuiId.AlvearySwarmerGUI); this.inventory = new InventorySwarmer(this); } diff --git a/src/main/java/forestry/apiculture/multiblock/TileAlvearyWithGui.java b/src/main/java/forestry/apiculture/multiblock/TileAlvearyWithGui.java index cbac9f97f..24c3133ee 100644 --- a/src/main/java/forestry/apiculture/multiblock/TileAlvearyWithGui.java +++ b/src/main/java/forestry/apiculture/multiblock/TileAlvearyWithGui.java @@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import forestry.api.core.ForestryAPI; +import forestry.apiculture.blocks.BlockAlveary; import forestry.core.access.AccessHandler; import forestry.core.access.EnumAccess; import forestry.core.access.IAccessHandler; @@ -27,9 +28,9 @@ public abstract class TileAlvearyWithGui extends TileAlveary implements ITitled, private final String unlocalizedTitle; private final GuiId guiId; - protected TileAlvearyWithGui(int meta, GuiId guiId) { + protected TileAlvearyWithGui(BlockAlveary.Type type, GuiId guiId) { this.accessHandler = new AccessHandler(this); - this.unlocalizedTitle = "tile.for.alveary." + meta + ".name"; + this.unlocalizedTitle = "tile.for.alveary." + type.ordinal() + ".name"; this.guiId = guiId; } diff --git a/src/main/java/forestry/apiculture/tiles/TileApiaristChest.java b/src/main/java/forestry/apiculture/tiles/TileApiaristChest.java index 91274dc14..0a96edc07 100644 --- a/src/main/java/forestry/apiculture/tiles/TileApiaristChest.java +++ b/src/main/java/forestry/apiculture/tiles/TileApiaristChest.java @@ -16,11 +16,11 @@ import net.minecraft.item.ItemStack; import forestry.api.apiculture.BeeManager; import forestry.core.config.Constants; -import forestry.core.config.ForestryBlock; import forestry.core.inventory.InventoryPlain; import forestry.core.network.GuiId; import forestry.core.tiles.TileNaturalistChest; import forestry.core.tiles.TileUtil; +import forestry.plugins.PluginApiculture; public class TileApiaristChest extends TileNaturalistChest { @@ -34,7 +34,7 @@ public class TileApiaristChest extends TileNaturalistChest { protected void updateServerSide() { if (worldObj != null && !checkedForLegacyBlock) { Block block = worldObj.getBlock(xCoord, yCoord, zCoord); - if (ForestryBlock.apiculture.isBlockEqual(block)) { + if (PluginApiculture.blocks.apiculture == block) { migrateFromLegacyBlock(); } @@ -52,7 +52,7 @@ public class TileApiaristChest extends TileNaturalistChest { } worldObj.setBlockToAir(xCoord, yCoord, zCoord); - worldObj.setBlock(xCoord, yCoord, zCoord, ForestryBlock.apicultureChest.block(), Constants.DEFINITION_APIARISTCHEST_META, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); + worldObj.setBlock(xCoord, yCoord, zCoord, PluginApiculture.blocks.apicultureChest, 0, Constants.FLAG_BLOCK_SYNCH_AND_UPDATE); TileApiaristChest tile = TileUtil.getTile(worldObj, xCoord, yCoord, zCoord, TileApiaristChest.class); for (int i = 0; i < getSizeInventory(); i++) { diff --git a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java index 2cc1132ca..c2a640eae 100755 --- a/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java +++ b/src/main/java/forestry/apiculture/worldgen/ComponentVillageBeeHouse.java @@ -17,7 +17,6 @@ import java.util.Random; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -39,6 +38,7 @@ import forestry.api.core.EnumHumidity; import forestry.api.core.EnumTemperature; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IFlower; +import forestry.apiculture.blocks.BlockApiculture; import forestry.apiculture.inventory.InventoryApiary; import forestry.apiculture.tiles.TileApiary; import forestry.arboriculture.worldgen.BlockTypeLog; @@ -47,7 +47,7 @@ import forestry.arboriculture.worldgen.BlockTypeWood; import forestry.arboriculture.worldgen.BlockTypeWoodStairs; import forestry.core.blocks.BlockCore; import forestry.core.config.Constants; -import forestry.core.config.ForestryBlock; +import forestry.core.tiles.TileUtil; import forestry.core.worldgen.BlockType; import forestry.core.worldgen.BlockTypeTileForestry; import forestry.core.worldgen.IBlockType; @@ -285,20 +285,22 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 { int yCoord = getYWithOffset(y); int zCoord = getZWithOffset(x, z); - if (!box.isVecInside(xCoord, yCoord, zCoord) || ForestryBlock.apiculture.isBlockEqual(world, xCoord, yCoord, zCoord) - || !world.blockExists(xCoord, yCoord - 1, zCoord)) { + if (!box.isVecInside(xCoord, yCoord, zCoord)) { return; } - world.setBlock(xCoord, yCoord, zCoord, ForestryBlock.apiculture.block(), Constants.DEFINITION_APIARY_META, Constants.FLAG_BLOCK_SYNCH); - ForestryBlock.apiculture.block().onBlockAdded(world, xCoord, yCoord, zCoord); - - TileEntity tile = world.getTileEntity(xCoord, yCoord, zCoord); - if (!(tile instanceof TileApiary)) { + Block block = world.getBlock(xCoord, yCoord, zCoord); + if (PluginApiculture.blocks.apiculture == block || !world.blockExists(xCoord, yCoord - 1, zCoord)) { return; } - TileApiary apiary = (TileApiary) tile; + world.setBlock(xCoord, yCoord, zCoord, PluginApiculture.blocks.apiculture, BlockApiculture.Type.APIARY.ordinal(), Constants.FLAG_BLOCK_SYNCH); + PluginApiculture.blocks.apiculture.onBlockAdded(world, xCoord, yCoord, zCoord); + + TileApiary apiary = TileUtil.getTile(world, xCoord, yCoord, zCoord, TileApiary.class); + if (apiary == null) { + return; + } ItemStack randomVillagePrincess = getRandomVillageBeeStack(world, xCoord, yCoord, zCoord, EnumBeeType.PRINCESS); apiary.getBeeInventory().setQueen(randomVillagePrincess); diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDescription.java b/src/main/java/forestry/apiculture/worldgen/HiveDescription.java index 82e89750c..57b9355d5 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveDescription.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDescription.java @@ -27,7 +27,7 @@ import forestry.api.core.EnumTemperature; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.EnumTolerance; import forestry.apiculture.genetics.BeeDefinition; -import forestry.core.config.ForestryBlock; +import forestry.plugins.PluginApiculture; public enum HiveDescription implements IHiveDescription { @@ -70,7 +70,7 @@ public enum HiveDescription implements IHiveDescription { @Override public Block getBlock() { - return ForestryBlock.beehives.block(); + return PluginApiculture.blocks.beehives; } @Override diff --git a/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java b/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java index 1d4b3cb9b..08fc5e643 100644 --- a/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java +++ b/src/main/java/forestry/apiculture/worldgen/HiveDescriptionSwarmer.java @@ -22,7 +22,7 @@ import forestry.api.apiculture.hives.IHiveGen; import forestry.api.core.EnumHumidity; import forestry.api.core.EnumTemperature; import forestry.apiculture.tiles.TileSwarm; -import forestry.core.config.ForestryBlock; +import forestry.plugins.PluginApiculture; public class HiveDescriptionSwarmer implements IHiveDescription { @@ -39,7 +39,7 @@ public class HiveDescriptionSwarmer implements IHiveDescription { @Override public Block getBlock() { - return ForestryBlock.beehives.block(); + return PluginApiculture.blocks.beehives; } @Override @@ -74,5 +74,4 @@ public class HiveDescriptionSwarmer implements IHiveDescription { ((TileSwarm) tile).setContained(bees); } } - } diff --git a/src/main/java/forestry/core/config/Constants.java b/src/main/java/forestry/core/config/Constants.java index a93aac80d..f699e3769 100644 --- a/src/main/java/forestry/core/config/Constants.java +++ b/src/main/java/forestry/core/config/Constants.java @@ -51,12 +51,6 @@ public class Constants implements IForestryConstants { public static final String CHEST_GEN_HOOK_NATURALIST_CHEST = "naturalistChest"; // Definition IDs - public static final int DEFINITION_APIARY_META = 0; - public static final int DEFINITION_APIARISTCHEST_LEGACY_META = 1; - public static final int DEFINITION_BEEHOUSE_META = 2; - - public static final int DEFINITION_APIARISTCHEST_META = 0; - public static final int DEFINITION_ENGINE_ELECTRIC_META = 0; public static final int DEFINITION_ENGINE_PEAT_META = 1; public static final int DEFINITION_ENGINE_BIOGAS_META = 2; @@ -82,8 +76,6 @@ public class Constants implements IForestryConstants { public static final int DEFINITION_LEPICHEST_META = 0; - public static final int DEFINITION_ARBCHEST_META = 0; - // Item Ids public static final int SLOTS_BACKPACK_DEFAULT = 15; diff --git a/src/main/java/forestry/core/config/ForestryBlock.java b/src/main/java/forestry/core/config/ForestryBlock.java index 01d2a5eb3..29b248ba1 100755 --- a/src/main/java/forestry/core/config/ForestryBlock.java +++ b/src/main/java/forestry/core/config/ForestryBlock.java @@ -34,17 +34,8 @@ import forestry.plugins.PluginManager.Stage; * @author SirSengir */ public enum ForestryBlock { - /** - * 0 - Legacy 1 - Forest Hive 2 - Meadows Hive - */ - beehives, mushroom, - candle, - stump, - alveary, farm, - apiculture, - apicultureChest, mail, engine, factoryTESR, diff --git a/src/main/java/forestry/core/tiles/MachineDefinition.java b/src/main/java/forestry/core/tiles/MachineDefinition.java index 8868c6910..dde741348 100644 --- a/src/main/java/forestry/core/tiles/MachineDefinition.java +++ b/src/main/java/forestry/core/tiles/MachineDefinition.java @@ -10,8 +10,6 @@ ******************************************************************************/ package forestry.core.tiles; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Locale; @@ -20,8 +18,6 @@ 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.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; @@ -54,21 +50,16 @@ public class MachineDefinition { private float minX, minY, minZ, maxX, maxY, maxZ; - /* CRAFTING */ - public final List recipes = new ArrayList<>(); - - public MachineDefinition(int meta, String teIdent, Class teClass, IRecipe... recipes) { - this(meta, teIdent, teClass, null, recipes); + public MachineDefinition(int meta, String teIdent, Class teClass) { + this(meta, teIdent, teClass, null); } - public MachineDefinition(int meta, String teIdent, Class teClass, IBlockRenderer renderer, IRecipe... recipes) { + public MachineDefinition(int meta, String teIdent, Class teClass, IBlockRenderer renderer) { this.meta = meta; this.teIdent = teIdent; this.teClass = teClass; this.renderer = renderer; - this.recipes.addAll(Arrays.asList(recipes)); - this.faceMap = new int[8]; for (int i = 0; i < 8; i++) { faceMap[i] = 0; @@ -111,20 +102,10 @@ public class MachineDefinition { public void register() { registerTileEntity(); - registerCrafting(); if (renderer != null) { Proxies.render.registerTESR(this); } } - - @SuppressWarnings("unchecked") - private void registerCrafting() { - for (IRecipe recipe : recipes) { - if (recipe != null) { - CraftingManager.getInstance().getRecipeList().add(recipe); - } - } - } public AxisAlignedBB getBoundingBox(int x, int y, int z) { return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ); diff --git a/src/main/java/forestry/energy/tiles/EngineDefinition.java b/src/main/java/forestry/energy/tiles/EngineDefinition.java index 9ad7c25ae..e22f9e802 100644 --- a/src/main/java/forestry/energy/tiles/EngineDefinition.java +++ b/src/main/java/forestry/energy/tiles/EngineDefinition.java @@ -10,7 +10,6 @@ ******************************************************************************/ package forestry.energy.tiles; -import net.minecraft.item.crafting.IRecipe; import net.minecraft.world.IBlockAccess; import forestry.core.render.IBlockRenderer; @@ -21,8 +20,8 @@ import forestry.core.tiles.TileUtil; public class EngineDefinition extends MachineDefinition { - public EngineDefinition(int meta, String teIdent, Class teClass, IBlockRenderer renderer, IRecipe... recipes) { - super(meta, teIdent, teClass, renderer, recipes); + public EngineDefinition(int meta, String teIdent, Class teClass, IBlockRenderer renderer) { + super(meta, teIdent, teClass, renderer); } @Override diff --git a/src/main/java/forestry/plugins/PluginApiculture.java b/src/main/java/forestry/plugins/PluginApiculture.java index eabdd89e2..8cf22cb48 100644 --- a/src/main/java/forestry/plugins/PluginApiculture.java +++ b/src/main/java/forestry/plugins/PluginApiculture.java @@ -21,7 +21,6 @@ import java.util.Random; import java.util.Set; import net.minecraft.block.Block; -import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -55,7 +54,6 @@ import forestry.api.apiculture.FlowerManager; import forestry.api.apiculture.IBeekeepingMode; import forestry.api.apiculture.hives.HiveManager; import forestry.api.core.ForestryAPI; -import forestry.api.core.Tabs; import forestry.api.genetics.AlleleManager; import forestry.api.genetics.IClassification; import forestry.api.genetics.IClassification.EnumClassLevel; @@ -69,9 +67,9 @@ import forestry.apiculture.GuiHandlerApiculture; import forestry.apiculture.SaveEventHandlerApiculture; import forestry.apiculture.VillageHandlerApiculture; import forestry.apiculture.blocks.BlockAlveary; -import forestry.apiculture.blocks.BlockBeehives; +import forestry.apiculture.blocks.BlockApiculture; import forestry.apiculture.blocks.BlockCandle; -import forestry.apiculture.blocks.BlockStump; +import forestry.apiculture.blocks.BlockRegistryApiculture; import forestry.apiculture.commands.CommandBee; import forestry.apiculture.entities.EntityMinecartApiary; import forestry.apiculture.entities.EntityMinecartBeehouse; @@ -88,9 +86,7 @@ import forestry.apiculture.genetics.alleles.AlleleEffect; import forestry.apiculture.items.EnumHoneyComb; import forestry.apiculture.items.EnumPollenCluster; import forestry.apiculture.items.EnumPropolis; -import forestry.apiculture.items.ItemBlockCandle; import forestry.apiculture.items.ItemRegistryApiculture; -import forestry.apiculture.multiblock.TileAlveary; import forestry.apiculture.multiblock.TileAlvearyFan; import forestry.apiculture.multiblock.TileAlvearyHeater; import forestry.apiculture.multiblock.TileAlvearyHygroregulator; @@ -112,20 +108,16 @@ import forestry.apiculture.worldgen.HiveGenHelper; import forestry.apiculture.worldgen.HiveRegistry; import forestry.core.GuiHandlerBase; import forestry.core.ISaveEventHandler; -import forestry.core.blocks.BlockBase; import forestry.core.blocks.BlockCore; import forestry.core.config.Config; import forestry.core.config.Constants; -import forestry.core.config.ForestryBlock; import forestry.core.config.LocalizedConfiguration; import forestry.core.entities.EntityFXSnow; import forestry.core.fluids.Fluids; import forestry.core.items.EnumElectronTube; -import forestry.core.items.ItemBlockForestry; import forestry.core.network.IPacketRegistry; import forestry.core.proxy.Proxies; import forestry.core.recipes.RecipeUtil; -import forestry.core.recipes.ShapedRecipeCustom; import forestry.core.tiles.MachineDefinition; import forestry.core.utils.EntityUtil; import forestry.core.utils.Log; @@ -145,6 +137,7 @@ public class PluginApiculture extends ForestryPlugin { public static boolean fancyRenderedBees = false; public static ItemRegistryApiculture items; + public static BlockRegistryApiculture blocks; public static HiveRegistry hiveRegistry; @@ -188,24 +181,7 @@ public class PluginApiculture extends ForestryPlugin { @Override protected void registerItemsAndBlocks() { items = new ItemRegistryApiculture(); - - ForestryBlock.apiculture.registerBlock(new BlockBase(Material.iron), ItemBlockForestry.class, "apiculture"); - ForestryBlock.apiculture.block().setCreativeTab(Tabs.tabApiculture); - ForestryBlock.apiculture.block().setHarvestLevel("axe", 0); - - ForestryBlock.apicultureChest.registerBlock(new BlockBase(Material.iron, true), ItemBlockForestry.class, "apicultureChest"); - ForestryBlock.apicultureChest.block().setCreativeTab(Tabs.tabApiculture); - ForestryBlock.apicultureChest.block().setHarvestLevel("axe", 0); - - ForestryBlock.beehives.registerBlock(new BlockBeehives(), ItemBlockForestry.class, "beehives"); - - // Candles - ForestryBlock.candle.registerBlock(new BlockCandle(), ItemBlockCandle.class, "candle"); - ForestryBlock.stump.registerBlock(new BlockStump(), ItemBlockForestry.class, "stump"); - - // Alveary and Components - ForestryBlock.alveary.registerBlock(new BlockAlveary(), ItemBlockForestry.class, "alveary"); - ForestryBlock.alveary.block().setHarvestLevel("axe", 0); + blocks = new BlockRegistryApiculture(); } @Override @@ -214,37 +190,21 @@ public class PluginApiculture extends ForestryPlugin { MinecraftForge.EVENT_BUS.register(this); - definitionApiary = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_APIARY_META, "forestry.Apiary", TileApiary.class, - ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apiculture.getItemStack(1, Constants.DEFINITION_APIARY_META), - "XXX", - "#C#", - "###", - 'X', "slabWood", - '#', "plankWood", - 'C', PluginCore.items.impregnatedCasing)) - .setFaces(0, 1, 2, 2, 4, 4, 0, 7)); + definitionApiary = new MachineDefinition(BlockApiculture.Type.APIARY.ordinal(), "forestry.Apiary", TileApiary.class) + .setFaces(0, 1, 2, 2, 4, 4, 0, 7); + blocks.apiculture.addDefinition(definitionApiary); - definitionChestLegacy = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_APIARISTCHEST_LEGACY_META, "forestry.ApiaristChest", TileApiaristChest.class).setLegacy()); + definitionChestLegacy = new MachineDefinition(BlockApiculture.Type.APIARIST_CHEST_LEGACY.ordinal(), "forestry.ApiaristChest", TileApiaristChest.class) + .setLegacy(); + blocks.apiculture.addDefinition(definitionChestLegacy); - definitionChest = ((BlockBase) ForestryBlock.apicultureChest.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_APIARISTCHEST_META, "forestry.ApiaristChestNew", TileApiaristChest.class, Proxies.render.getRenderChest("apiaristchest"), - ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apicultureChest.getItemStack(1, Constants.DEFINITION_APIARISTCHEST_META), - " # ", - "XYX", - "XXX", - '#', "blockGlass", - 'X', "beeComb", - 'Y', "chestWood")) - .setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F)); + definitionBeehouse = new MachineDefinition(BlockApiculture.Type.BEEHOUSE.ordinal(), "forestry.Beehouse", TileBeehouse.class) + .setFaces(0, 1, 2, 2, 4, 4, 0, 7); + blocks.apiculture.addDefinition(definitionBeehouse); - definitionBeehouse = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_BEEHOUSE_META, "forestry.Beehouse", TileBeehouse.class, - ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apiculture.getItemStack(1, Constants.DEFINITION_BEEHOUSE_META), - "XXX", - "#C#", - "###", - 'X', "slabWood", - '#', "plankWood", - 'C', "beeComb")) - .setFaces(0, 1, 2, 2, 4, 4, 0, 7)); + definitionChest = new MachineDefinition(0, "forestry.ApiaristChestNew", TileApiaristChest.class, Proxies.render.getRenderChest("apiaristchest")) + .setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + blocks.apicultureChest.addDefinition(definitionChest); // Add triggers if (PluginManager.Module.BUILDCRAFT_STATEMENTS.isEnabled()) { @@ -365,6 +325,11 @@ public class PluginApiculture extends ForestryPlugin { } proxy.initializeRendering(); + + definitionApiary.register(); + definitionBeehouse.register(); + definitionChestLegacy.register(); + definitionChest.register(); } @Override @@ -522,12 +487,12 @@ public class PluginApiculture extends ForestryPlugin { RecipeUtil.addRecipe(items.minecartBeehouse.getBeeHouseMinecart(), "B", "C", - 'B', ForestryBlock.apiculture.getItemStack(1, Constants.DEFINITION_BEEHOUSE_META), + 'B', blocks.apiculture.get(BlockApiculture.Type.BEEHOUSE, 1), 'C', Items.minecart); RecipeUtil.addRecipe(items.minecartBeehouse.getApiaryMinecart(), "B", "C", - 'B', ForestryBlock.apiculture.getItemStack(1, Constants.DEFINITION_APIARY_META), + 'B', blocks.apiculture.get(BlockApiculture.Type.APIARY, 1), 'C', Items.minecart); // FOOD STUFF @@ -578,57 +543,57 @@ public class PluginApiculture extends ForestryPlugin { '#', PluginCore.items.beeswax); // / ALVEARY - RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.PLAIN_META), + RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.PLAIN, 1), "###", "#X#", "###", 'X', PluginCore.items.impregnatedCasing, '#', PluginCore.items.craftingMaterial.getScentedPaneling()); // SWARMER - RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.SWARMER_META), + RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.SWARMER, 1), "#G#", " X ", "#G#", '#', PluginCore.items.tubes.get(EnumElectronTube.DIAMOND, 1), - 'X', ForestryBlock.alveary, + 'X', blocks.alveary, 'G', "ingotGold"); // FAN - RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.FAN_META), + RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.FAN, 1), "I I", " X ", "I#I", '#', PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1), - 'X', ForestryBlock.alveary, + 'X', blocks.alveary, 'I', "ingotIron"); // HEATER - RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.HEATER_META), + RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.HEATER, 1), "#I#", " X ", "YYY", '#', PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1), - 'X', ForestryBlock.alveary, + 'X', blocks.alveary, 'I', "ingotIron", 'Y', "stone"); // HYGROREGULATOR - RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.HYGRO_META), + RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.HYGRO, 1), "GIG", "GXG", "GIG", - 'X', ForestryBlock.alveary, + 'X', blocks.alveary, 'I', "ingotIron", 'G', "blockGlass"); // STABILISER - RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.STABILIZER_META), + RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.STABILIZER, 1), "G G", "GXG", "G G", - 'X', ForestryBlock.alveary, + 'X', blocks.alveary, 'G', "gemQuartz"); // SIEVE - RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.SIEVE_META), + RecipeUtil.addRecipe(blocks.alveary.get(BlockAlveary.Type.SIEVE, 1), "III", " X ", "WWW", - 'X', ForestryBlock.alveary, + 'X', blocks.alveary, 'I', "ingotIron", 'W', PluginCore.items.craftingMaterial.getWovenSilk()); @@ -657,18 +622,18 @@ public class PluginApiculture extends ForestryPlugin { 'W', PluginCore.items.beeswax, 'P', items.pollenCluster.get(EnumPollenCluster.NORMAL, 1)); - RecipeManagers.carpenterManager.addRecipe(30, Fluids.WATER.getFluid(600), null, ForestryBlock.candle.getItemStack(24), + RecipeManagers.carpenterManager.addRecipe(30, Fluids.WATER.getFluid(600), null, blocks.candle.getUnlitCandle(24), " X ", "###", "###", '#', PluginCore.items.beeswax, 'X', Items.string); - RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(200), null, ForestryBlock.candle.getItemStack(6), + RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(200), null, blocks.candle.getUnlitCandle(6), "#X#", '#', PluginCore.items.beeswax, 'X', PluginCore.items.craftingMaterial.getSilkWisp()); - RecipeUtil.addShapelessRecipe(ForestryBlock.candle.getItemStack(), ForestryBlock.candle.getItemStack()); - RecipeUtil.addShapelessRecipe(ForestryBlock.candle.getItemStack(1, 1), ForestryBlock.candle.getItemStack(1, 1)); + RecipeUtil.addShapelessRecipe(blocks.candle.getUnlitCandle(1), blocks.candle.getUnlitCandle(1)); + RecipeUtil.addShapelessRecipe(blocks.candle.getLitCandle(1), blocks.candle.getLitCandle(1)); // / CENTRIFUGE // Honey combs @@ -769,18 +734,37 @@ public class PluginApiculture extends ForestryPlugin { } // ANALYZER - PluginCore.definitionAnalyzer.recipes.add(ShapedRecipeCustom.createShapedRecipe(PluginCore.blocks.core.get(BlockCore.Type.ANALYZER, 1), + RecipeUtil.addRecipe(PluginCore.blocks.core.get(BlockCore.Type.ANALYZER, 1), "XTX", " Y ", "X X", 'Y', PluginCore.items.sturdyCasing, 'T', items.beealyzer, - 'X', "ingotBronze")); + 'X', "ingotBronze"); - definitionApiary.register(); - definitionBeehouse.register(); - definitionChestLegacy.register(); - definitionChest.register(); + RecipeUtil.addRecipe(blocks.apiculture.get(BlockApiculture.Type.APIARY, 1), + "XXX", + "#C#", + "###", + 'X', "slabWood", + '#', "plankWood", + 'C', PluginCore.items.impregnatedCasing); + + RecipeUtil.addRecipe(new ItemStack(blocks.apicultureChest), + " # ", + "XYX", + "XXX", + '#', "blockGlass", + 'X', "beeComb", + 'Y', "chestWood"); + + RecipeUtil.addRecipe(blocks.apiculture.get(BlockApiculture.Type.BEEHOUSE, 1), + "XXX", + "#C#", + "###", + 'X', "slabWood", + '#', "plankWood", + 'C', "beeComb"); } private static void registerBeehiveDrops() { @@ -836,7 +820,7 @@ public class PluginApiculture extends ForestryPlugin { ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(BeeDefinition.STEADFAST.getMemberStack(EnumBeeType.DRONE), 1, 1, rarity)); - ItemStack stack = ForestryBlock.candle.getItemStack(); + ItemStack stack = blocks.candle.getUnlitCandle(1); NBTTagCompound tag = new NBTTagCompound(); tag.setInteger(BlockCandle.colourTagName, 0xffffff); stack.setTagCompound(tag); diff --git a/src/main/java/forestry/plugins/PluginArboriculture.java b/src/main/java/forestry/plugins/PluginArboriculture.java index 6b3111346..186a7c2bc 100644 --- a/src/main/java/forestry/plugins/PluginArboriculture.java +++ b/src/main/java/forestry/plugins/PluginArboriculture.java @@ -138,16 +138,10 @@ public class PluginArboriculture extends ForestryPlugin { WoodItemAccess.registerStairs(blocks.stairsFireproof, woodType, true); } - definitionChest = blocks.arboriculture.addDefinition(new MachineDefinition(BlockArboriculture.Type.ARBCHEST.ordinal(), - "forestry.ArbChest", TileArboristChest.class, Proxies.render.getRenderChest("arbchest"), - ShapedRecipeCustom.createShapedRecipe(blocks.arboriculture.get(BlockArboriculture.Type.ARBCHEST, 1), - " # ", - "XYX", - "XXX", - '#', "blockGlass", - 'X', "treeSapling", - 'Y', "chestWood")) - .setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F)); + definitionChest = new MachineDefinition(BlockArboriculture.Type.ARBCHEST.ordinal(), + "forestry.ArbChest", TileArboristChest.class, Proxies.render.getRenderChest("arbchest")) + .setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + blocks.arboriculture.addDefinition(definitionChest); // Init rendering proxy.initializeRendering(); @@ -326,13 +320,21 @@ public class PluginArboriculture extends ForestryPlugin { '#', "stickWood"); // ANALYZER - PluginCore.definitionAnalyzer.recipes.add(ShapedRecipeCustom.createShapedRecipe(PluginCore.blocks.core.get(BlockCore.Type.ANALYZER, 1), + RecipeUtil.addRecipe(PluginCore.blocks.core.get(BlockCore.Type.ANALYZER, 1), "XTX", " Y ", "X X", 'Y', PluginCore.items.sturdyCasing, 'T', items.treealyzer, - 'X', "ingotBronze")); + 'X', "ingotBronze"); + + RecipeUtil.addRecipe(blocks.arboriculture.get(BlockArboriculture.Type.ARBCHEST, 1), + " # ", + "XYX", + "XXX", + '#', "blockGlass", + 'X', "treeSapling", + 'Y', "chestWood"); } private static void createAlleles() { diff --git a/src/main/java/forestry/plugins/PluginEnergy.java b/src/main/java/forestry/plugins/PluginEnergy.java index be3335d5c..01a47d039 100755 --- a/src/main/java/forestry/plugins/PluginEnergy.java +++ b/src/main/java/forestry/plugins/PluginEnergy.java @@ -22,7 +22,7 @@ import forestry.core.blocks.BlockBase; import forestry.core.config.Constants; import forestry.core.config.ForestryBlock; import forestry.core.items.ItemBlockForestry; -import forestry.core.recipes.ShapedRecipeCustom; +import forestry.core.recipes.RecipeUtil; import forestry.core.tiles.MachineDefinition; import forestry.energy.GuiHandlerEnergy; import forestry.energy.blocks.BlockEngine; @@ -53,42 +53,11 @@ public class PluginEnergy extends ForestryPlugin { super.preInit(); definitionEnginePeat = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new EngineDefinition(Constants.DEFINITION_ENGINE_PEAT_META, "forestry.EngineCopper", TileEnginePeat.class, - PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_copper_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_PEAT_META), - "###", - " X ", - "YVY", - '#', "ingotCopper", - 'X', "blockGlass", - 'Y', "gearCopper", - 'V', Blocks.piston))); + PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_copper_"))); definitionEngineBiogas = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new EngineDefinition(Constants.DEFINITION_ENGINE_BIOGAS_META, "forestry.EngineBronze", TileEngineBiogas.class, - PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_bronze_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_BIOGAS_META), - "###", - " X ", - "YVY", - '#', "ingotBronze", - 'X', "blockGlass", - 'Y', "gearBronze", - 'V', Blocks.piston))); - - ShapedRecipeCustom clockworkRecipe = null; - if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) { - clockworkRecipe = ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_CLOCKWORK_META), - "###", - " X ", - "ZVY", - '#', "plankWood", - 'X', "blockGlass", - 'Y', Items.clock, - 'Z', "gearCopper", - 'V', Blocks.piston); - } - + PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_bronze_"))); definitionEngineClockwork = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new EngineDefinition(Constants.DEFINITION_ENGINE_CLOCKWORK_META, "forestry.EngineClockwork", TileEngineClockwork.class, - PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_clock_"), clockworkRecipe)); + PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_clock_"))); } @Override @@ -100,6 +69,41 @@ public class PluginEnergy extends ForestryPlugin { definitionEngineClockwork.register(); } + @Override + protected void registerRecipes() { + super.registerRecipes(); + + RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_PEAT_META), + "###", + " X ", + "YVY", + '#', "ingotCopper", + 'X', "blockGlass", + 'Y', "gearCopper", + 'V', Blocks.piston); + + RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_BIOGAS_META), + "###", + " X ", + "YVY", + '#', "ingotBronze", + 'X', "blockGlass", + 'Y', "gearBronze", + 'V', Blocks.piston); + + if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) { + RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_CLOCKWORK_META), + "###", + " X ", + "ZVY", + '#', "plankWood", + 'X', "blockGlass", + 'Y', Items.clock, + 'Z', "gearCopper", + 'V', Blocks.piston); + } + } + @Override public GuiHandlerBase getGuiHandler() { return new GuiHandlerEnergy(); diff --git a/src/main/java/forestry/plugins/PluginFactory.java b/src/main/java/forestry/plugins/PluginFactory.java index c5176dd7e..6e3efa32d 100644 --- a/src/main/java/forestry/plugins/PluginFactory.java +++ b/src/main/java/forestry/plugins/PluginFactory.java @@ -52,7 +52,6 @@ import forestry.core.items.ItemRegistryCore; import forestry.core.network.IPacketRegistry; import forestry.core.proxy.Proxies; import forestry.core.recipes.RecipeUtil; -import forestry.core.recipes.ShapedRecipeCustom; import forestry.core.recipes.craftguide.CraftGuideIntegration; import forestry.core.tiles.MachineDefinition; import forestry.core.utils.Log; @@ -212,117 +211,38 @@ public class PluginFactory extends ForestryPlugin { BlockBase factoryTESR = ((BlockBase) ForestryBlock.factoryTESR.block()); definitionBottler = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_BOTTLER_META, "forestry.Bottler", TileBottler.class, - Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/bottler_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_BOTTLER_META), - "X#X", - "#Y#", - "X#X", - '#', "blockGlass", - 'X', PluginFluids.items.canEmpty, - 'Y', coreItems.sturdyCasing))); + Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/bottler_"))); definitionCarpenter = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_CARPENTER_META, "forestry.Carpenter", TileCarpenter.class, - Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/carpenter_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_CARPENTER_META), - "X#X", - "XYX", - "X#X", - '#', "blockGlass", - 'X', "ingotBronze", - 'Y', coreItems.sturdyCasing))); + Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/carpenter_"))); definitionCentrifuge = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_CENTRIFUGE_META, "forestry.Centrifuge", TileCentrifuge.class, - Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/centrifuge_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_CENTRIFUGE_META), - "X#X", - "XYX", - "X#X", - '#', "blockGlass", - 'X', "ingotCopper", - 'Y', coreItems.sturdyCasing))); + Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/centrifuge_"))); definitionFermenter = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_FERMENTER_META, "forestry.Fermenter", TileFermenter.class, - Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/fermenter_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_FERMENTER_META), - "X#X", - "#Y#", - "X#X", - '#', "blockGlass", - 'X', "gearBronze", - 'Y', coreItems.sturdyCasing))); + Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/fermenter_"))); definitionMoistener = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_MOISTENER_META, "forestry.Moistener", TileMoistener.class, - Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/moistener_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_MOISTENER_META), - "X#X", - "#Y#", - "X#X", - '#', "blockGlass", - 'X', "gearCopper", - 'Y', coreItems.sturdyCasing))); + Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/moistener_"))); definitionSqueezer = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_SQUEEZER_META, "forestry.Squeezer", TileSqueezer.class, - Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/squeezer_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_SQUEEZER_META), - "X#X", - "XYX", - "X#X", - '#', "blockGlass", - 'X', "ingotTin", - 'Y', coreItems.sturdyCasing))); + Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/squeezer_"))); definitionStill = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_STILL_META, "forestry.Still", TileStill.class, - Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/still_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_STILL_META), - "X#X", - "#Y#", - "X#X", - '#', "blockGlass", - 'X', "dustRedstone", - 'Y', coreItems.sturdyCasing))); + Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/still_"))); definitionRainmaker = factoryTESR.addDefinition(new MachineDefinition(Constants.DEFINITION_RAINMAKER_META, "forestry.Rainmaker", TileMillRainmaker.class, - Proxies.render.getRenderMill(Constants.TEXTURE_PATH_BLOCKS + "/rainmaker_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_RAINMAKER_META), - "X#X", - "#Y#", - "X#X", - '#', "blockGlass", - 'X', "gearTin", - 'Y', coreItems.hardenedCasing))); + Proxies.render.getRenderMill(Constants.TEXTURE_PATH_BLOCKS + "/rainmaker_"))); BlockBase factoryPlain = ((BlockBase) ForestryBlock.factoryPlain.block()); - definitionFabricator = factoryPlain.addDefinition(new MachineDefinition(Constants.DEFINITION_FABRICATOR_META, "forestry.Fabricator", TileFabricator.class, - ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.factoryPlain.getItemStack(1, Constants.DEFINITION_FABRICATOR_META), - "X#X", - "#Y#", - "XZX", - '#', "blockGlass", - 'X', "ingotGold", - 'Y', coreItems.sturdyCasing, - 'Z', "chestWood")) + definitionFabricator = factoryPlain.addDefinition(new MachineDefinition(Constants.DEFINITION_FABRICATOR_META, "forestry.Fabricator", TileFabricator.class) .setFaces(0, 1, 2, 3, 4, 4)); - definitionRaintank = factoryPlain.addDefinition(new MachineDefinition(Constants.DEFINITION_RAINTANK_META, "forestry.Raintank", TileRaintank.class, - ShapedRecipeCustom.createShapedRecipe(ForestryBlock.factoryPlain.getItemStack(1, Constants.DEFINITION_RAINTANK_META), - "X#X", - "XYX", - "X#X", - '#', "blockGlass", - 'X', "ingotIron", - 'Y', coreItems.sturdyCasing)) + definitionRaintank = factoryPlain.addDefinition(new MachineDefinition(Constants.DEFINITION_RAINTANK_META, "forestry.Raintank", TileRaintank.class) .setFaces(0, 1, 0, 0, 0, 0)); - definitionWorktable = factoryPlain.addDefinition(new MachineDefinition(Constants.DEFINITION_WORKTABLE_META, "forestry.Worktable", TileWorktable.class, - ShapedRecipeCustom.createShapedRecipe(ForestryBlock.factoryPlain.getItemStack(1, Constants.DEFINITION_WORKTABLE_META), - "B", - "W", - "C", - 'B', Items.book, - 'W', "craftingTableWood", - 'C', "chestWood")) + definitionWorktable = factoryPlain.addDefinition(new MachineDefinition(Constants.DEFINITION_WORKTABLE_META, "forestry.Worktable", TileWorktable.class) .setFaces(0, 1, 2, 3, 4, 4)); ICircuitLayout layoutMachineUpgrade = new CircuitLayout("machine.upgrade", CircuitSocketType.MACHINE); @@ -578,6 +498,95 @@ public class PluginFactory extends ForestryPlugin { ChipsetManager.solderManager.addRecipe(layout, PluginCore.items.tubes.get(EnumElectronTube.EMERALD, 1), Circuit.machineSpeedUpgrade1); ChipsetManager.solderManager.addRecipe(layout, PluginCore.items.tubes.get(EnumElectronTube.BLAZE, 1), Circuit.machineSpeedUpgrade2); ChipsetManager.solderManager.addRecipe(layout, PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1), Circuit.machineEfficiencyUpgrade1); + + RecipeUtil.addRecipe(ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_BOTTLER_META), + "X#X", + "#Y#", + "X#X", + '#', "blockGlass", + 'X', PluginFluids.items.canEmpty, + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_CARPENTER_META), + "X#X", + "XYX", + "X#X", + '#', "blockGlass", + 'X', "ingotBronze", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_CENTRIFUGE_META), + "X#X", + "XYX", + "X#X", + '#', "blockGlass", + 'X', "ingotCopper", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_FERMENTER_META), + "X#X", + "#Y#", + "X#X", + '#', "blockGlass", + 'X', "gearBronze", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_MOISTENER_META), + "X#X", + "#Y#", + "X#X", + '#', "blockGlass", + 'X', "gearCopper", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_SQUEEZER_META), + "X#X", + "XYX", + "X#X", + '#', "blockGlass", + 'X', "ingotTin", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_STILL_META), + "X#X", + "#Y#", + "X#X", + '#', "blockGlass", + 'X', "dustRedstone", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryTESR.getItemStack(1, Constants.DEFINITION_RAINMAKER_META), + "X#X", + "#Y#", + "X#X", + '#', "blockGlass", + 'X', "gearTin", + 'Y', PluginCore.items.hardenedCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryPlain.getItemStack(1, Constants.DEFINITION_FABRICATOR_META), + "X#X", + "#Y#", + "XZX", + '#', "blockGlass", + 'X', "ingotGold", + 'Y', PluginCore.items.sturdyCasing, + 'Z', "chestWood"); + + RecipeUtil.addRecipe(ForestryBlock.factoryPlain.getItemStack(1, Constants.DEFINITION_RAINTANK_META), + "X#X", + "XYX", + "X#X", + '#', "blockGlass", + 'X', "ingotIron", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.factoryPlain.getItemStack(1, Constants.DEFINITION_WORKTABLE_META), + "B", + "W", + "C", + 'B', Items.book, + 'W', "craftingTableWood", + 'C', "chestWood"); } @Override diff --git a/src/main/java/forestry/plugins/PluginLepidopterology.java b/src/main/java/forestry/plugins/PluginLepidopterology.java index 53afed492..a28d4ccd7 100755 --- a/src/main/java/forestry/plugins/PluginLepidopterology.java +++ b/src/main/java/forestry/plugins/PluginLepidopterology.java @@ -36,7 +36,7 @@ import forestry.core.config.LocalizedConfiguration; import forestry.core.fluids.Fluids; import forestry.core.items.ItemBlockForestry; import forestry.core.proxy.Proxies; -import forestry.core.recipes.ShapedRecipeCustom; +import forestry.core.recipes.RecipeUtil; import forestry.core.tiles.MachineDefinition; import forestry.core.utils.EntityUtil; import forestry.lepidopterology.ButterflySpawner; @@ -111,15 +111,7 @@ public class PluginLepidopterology extends ForestryPlugin { ButterflyDefinition.initButterflies(); BlockBase lepidopterology = ((BlockBase) ForestryBlock.lepidopterology.block()); - MachineDefinition definitionChest = lepidopterology.addDefinition(new MachineDefinition(Constants.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class, Proxies.render.getRenderChest("lepichest"), - ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.lepidopterology.getItemStack(1, Constants.DEFINITION_LEPICHEST_META), - " # ", - "XYX", - "XXX", - '#', "blockGlass", - 'X', new ItemStack(items.butterflyGE, 1, OreDictionary.WILDCARD_VALUE), - 'Y', "chestWood")) + MachineDefinition definitionChest = lepidopterology.addDefinition(new MachineDefinition(Constants.DEFINITION_LEPICHEST_META, "forestry.LepiChest", TileLepidopteristChest.class, Proxies.render.getRenderChest("lepichest")) .setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F)); definitionChest.register(); @@ -146,6 +138,14 @@ public class PluginLepidopterology extends ForestryPlugin { RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.getFluid(2000), null, items.flutterlyzer.getItemStack(), "X#X", "X#X", "RDR", '#', "paneGlass", 'X', "ingotBronze", 'R', "dustRedstone", 'D', "gemDiamond"); + + RecipeUtil.addRecipe(ForestryBlock.lepidopterology.getItemStack(1, Constants.DEFINITION_LEPICHEST_META), + " # ", + "XYX", + "XXX", + '#', "blockGlass", + 'X', new ItemStack(items.butterflyGE, 1, OreDictionary.WILDCARD_VALUE), + 'Y', "chestWood"); } @Override diff --git a/src/main/java/forestry/plugins/PluginMail.java b/src/main/java/forestry/plugins/PluginMail.java index fc940cd4d..13df24462 100755 --- a/src/main/java/forestry/plugins/PluginMail.java +++ b/src/main/java/forestry/plugins/PluginMail.java @@ -34,7 +34,6 @@ import forestry.core.items.EnumElectronTube; import forestry.core.items.ItemBlockForestry; import forestry.core.network.IPacketRegistry; import forestry.core.recipes.RecipeUtil; -import forestry.core.recipes.ShapedRecipeCustom; import forestry.core.tiles.MachineDefinition; import forestry.mail.GuiHandlerMail; import forestry.mail.PostRegistry; @@ -85,30 +84,19 @@ public class PluginMail extends ForestryPlugin { FMLCommonHandler.instance().bus().register(new TickHandlerMailClient()); } - ShapedRecipeCustom recipe = ShapedRecipeCustom.createShapedRecipe(ForestryBlock.mail.getItemStack(1, Constants.DEFINITION_MAILBOX_META), - " # ", "#Y#", "XXX", - '#', "ingotTin", - 'X', "chestWood", - 'Y', PluginCore.items.sturdyCasing); - BlockBase mail = ((BlockBase) ForestryBlock.mail.block()); - definitionMailbox = mail.addDefinition(new MachineDefinition(Constants.DEFINITION_MAILBOX_META, "forestry.Mailbox", TileMailbox.class, recipe).setFaces(0, 1, 2, 2, 2, 2, 0, 7)); + definitionMailbox = new MachineDefinition(Constants.DEFINITION_MAILBOX_META, "forestry.Mailbox", TileMailbox.class) + .setFaces(0, 1, 2, 2, 2, 2, 0, 7); + mail.addDefinition(definitionMailbox); - recipe = ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.mail.getItemStack(1, Constants.DEFINITION_TRADESTATION_META), - "Z#Z", - "#Y#", - "XWX", - '#', PluginCore.items.tubes.get(EnumElectronTube.BRONZE, 1), - 'X', "chestWood", - 'Y', PluginCore.items.sturdyCasing, - 'Z', PluginCore.items.tubes.get(EnumElectronTube.IRON, 1), - 'W', PluginCore.items.circuitboards.getCircuitboard(EnumCircuitBoardType.REFINED)); - definitionTradestation = mail.addDefinition(new MachineDefinition(Constants.DEFINITION_TRADESTATION_META, "forestry.Tradestation", TileTrader.class, recipe).setFaces(0, 1, 2, 3, 4, 4, 0, 7)); + definitionTradestation = new MachineDefinition(Constants.DEFINITION_TRADESTATION_META, "forestry.Tradestation", TileTrader.class) + .setFaces(0, 1, 2, 3, 4, 4, 0, 7); + mail.addDefinition(definitionTradestation); - definitionPhilatelist = mail.addDefinition(new MachineDefinition(Constants.DEFINITION_PHILATELIST_META, "forestry.Philatelist", TilePhilatelist.class) - .setFaces(0, 1, 2, 3, 2, 2, 0, 7)); + definitionPhilatelist = new MachineDefinition(Constants.DEFINITION_PHILATELIST_META, "forestry.Philatelist", TilePhilatelist.class) + .setFaces(0, 1, 2, 3, 2, 2, 0, 7); + mail.addDefinition(definitionPhilatelist); } @Override @@ -176,6 +164,24 @@ public class PluginMail extends ForestryPlugin { RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(250), null, items.letters.getItemStack(), "###", "###", '#', PluginCore.items.woodPulp); RecipeUtil.addShapelessRecipe(items.catalogue.getItemStack(), new ItemStack(items.stamps, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Items.book)); + + RecipeUtil.addRecipe(ForestryBlock.mail.getItemStack(1, Constants.DEFINITION_MAILBOX_META), + " # ", + "#Y#", + "XXX", + '#', "ingotTin", + 'X', "chestWood", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.mail.getItemStack(1, Constants.DEFINITION_TRADESTATION_META), + "Z#Z", + "#Y#", + "XWX", + '#', PluginCore.items.tubes.get(EnumElectronTube.BRONZE, 1), + 'X', "chestWood", + 'Y', PluginCore.items.sturdyCasing, + 'Z', PluginCore.items.tubes.get(EnumElectronTube.IRON, 1), + 'W', PluginCore.items.circuitboards.getCircuitboard(EnumCircuitBoardType.REFINED)); } @Override diff --git a/src/main/java/forestry/plugins/PluginStorage.java b/src/main/java/forestry/plugins/PluginStorage.java index 6c8f4935c..40befdeec 100755 --- a/src/main/java/forestry/plugins/PluginStorage.java +++ b/src/main/java/forestry/plugins/PluginStorage.java @@ -55,6 +55,7 @@ import forestry.api.recipes.RecipeManagers; import forestry.api.storage.BackpackManager; import forestry.api.storage.IBackpackDefinition; import forestry.api.storage.StorageManager; +import forestry.apiculture.blocks.BlockRegistryApiculture; import forestry.core.GuiHandlerBase; import forestry.core.IPickupHandler; import forestry.core.IResupplyHandler; @@ -371,9 +372,10 @@ public class PluginStorage extends ForestryPlugin { new ItemStack(Items.item_frame) )); - if (PluginManager.Module.APICULTURE.isEnabled()) { - builder.addValidItem(ForestryBlock.candle.getWildcard()); - builder.addValidItem(ForestryBlock.stump.getWildcard()); + BlockRegistryApiculture beeBlocks = PluginApiculture.blocks; + if (beeBlocks != null) { + builder.addValidItem(new ItemStack(beeBlocks.candle, 1, OreDictionary.WILDCARD_VALUE)); + builder.addValidItem(new ItemStack(beeBlocks.stump, 1, OreDictionary.WILDCARD_VALUE)); } } @@ -495,9 +497,9 @@ public class PluginStorage extends ForestryPlugin { @Override protected void registerRecipes() { - if (items.apiaristBackpack != null) { - ItemStack chest = ForestryBlock.apicultureChest.getItemStack(1, Constants.DEFINITION_APIARISTCHEST_META); - addBackpackRecipe(items.apiaristBackpack, "stickWood", chest); + BlockRegistryApiculture beeBlocks = PluginApiculture.blocks; + if (items.apiaristBackpack != null && beeBlocks != null) { + addBackpackRecipe(items.apiaristBackpack, "stickWood", beeBlocks.apicultureChest); } if (items.lepidopteristBackpack != null) { diff --git a/src/main/java/forestry/plugins/compat/PluginIC2.java b/src/main/java/forestry/plugins/compat/PluginIC2.java index 4d7ce99dc..f41f21e35 100644 --- a/src/main/java/forestry/plugins/compat/PluginIC2.java +++ b/src/main/java/forestry/plugins/compat/PluginIC2.java @@ -46,7 +46,6 @@ import forestry.core.fluids.Fluids; import forestry.core.items.EnumElectronTube; import forestry.core.proxy.Proxies; import forestry.core.recipes.RecipeUtil; -import forestry.core.recipes.ShapedRecipeCustom; import forestry.core.tiles.MachineDefinition; import forestry.core.utils.ItemStackUtil; import forestry.core.utils.Log; @@ -129,25 +128,10 @@ public class PluginIC2 extends ForestryPlugin { super.preInit(); definitionEngineElectric = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new EngineDefinition(Constants.DEFINITION_ENGINE_ELECTRIC_META, "forestry.EngineTin", TileEngineElectric.class, - PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_tin_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_ELECTRIC_META), - "###", - " X ", - "YVY", - '#', "ingotTin", - 'X', "blockGlass", - 'Y', "gearTin", - 'V', Blocks.piston))); + PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + "/engine_tin_"))); definitionGenerator = ((BlockBase) ForestryBlock.engine.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_GENERATOR_META, "forestry.Generator", TileGenerator.class, - Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/generator_"), ShapedRecipeCustom.createShapedRecipe( - ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_GENERATOR_META), - "X#X", - "XYX", - "X#X", - '#', "blockGlass", - 'X', "ingotGold", - 'Y', PluginCore.items.sturdyCasing))); + Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/generator_"))); emptyCell = IC2Items.getItem("cell"); if (emptyCell != null) { @@ -326,6 +310,22 @@ public class PluginIC2 extends ForestryPlugin { ICircuitLayout layoutManual = ChipsetManager.circuitRegistry.getLayout("forestry.farms.manual"); ChipsetManager.solderManager.addRecipe(layoutManual, PluginCore.items.tubes.get(EnumElectronTube.RUBBER, 1), Circuit.farmRubberManual); } - } + RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_GENERATOR_META), + "X#X", + "XYX", + "X#X", + '#', "blockGlass", + 'X', "ingotGold", + 'Y', PluginCore.items.sturdyCasing); + + RecipeUtil.addRecipe(ForestryBlock.engine.getItemStack(1, Constants.DEFINITION_ENGINE_ELECTRIC_META), + "###", + " X ", + "YVY", + '#', "ingotTin", + 'X', "blockGlass", + 'Y', "gearTin", + 'V', Blocks.piston); + } }