diff --git a/src/main/java/forestry/farming/logic/FarmableStacked.java b/src/main/java/forestry/farming/logic/FarmableStacked.java index e5b58733a..b2a2c8a17 100755 --- a/src/main/java/forestry/farming/logic/FarmableStacked.java +++ b/src/main/java/forestry/farming/logic/FarmableStacked.java @@ -25,10 +25,12 @@ public class FarmableStacked implements IFarmable { private final Block block; private final int matureHeight; + private final int matureMeta; - public FarmableStacked(Block block, int matureHeight) { + public FarmableStacked(Block block, int matureHeight, int matureMeta) { this.block = block; this.matureHeight = matureHeight; + this.matureMeta = matureMeta; } @Override @@ -41,8 +43,7 @@ public class FarmableStacked implements IFarmable { if (world.getBlock(x, y + (matureHeight - 1), z) != block) { return null; } - - return new CropBlock(world, block, 0, new Vect(x, y + (matureHeight - 1), z)); + return new CropBlock(world, block, matureMeta, new Vect(x, y + (matureHeight - 1), z)); } @Override diff --git a/src/main/java/forestry/plugins/PluginFarming.java b/src/main/java/forestry/plugins/PluginFarming.java index 8e23c6f47..d6ca8c3de 100644 --- a/src/main/java/forestry/plugins/PluginFarming.java +++ b/src/main/java/forestry/plugins/PluginFarming.java @@ -114,10 +114,10 @@ public class PluginFarming extends ForestryPlugin { Farmables.farmables.get("farmInfernal").add(new FarmableGenericCrop(new ItemStack(Items.nether_wart), Blocks.nether_wart, 3)); Farmables.farmables.put("farmPoales", new ArrayList()); - Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.reeds, 3)); + Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.reeds, 3, 0)); Farmables.farmables.put("farmSucculentes", new ArrayList()); - Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.cactus, 3)); + Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.cactus, 3, 0)); Farmables.farmables.put("farmVegetables", new ArrayList()); Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.potato), Blocks.potatoes, 7)); diff --git a/src/main/java/forestry/plugins/PluginManager.java b/src/main/java/forestry/plugins/PluginManager.java index 748ae39ec..7c12b968e 100755 --- a/src/main/java/forestry/plugins/PluginManager.java +++ b/src/main/java/forestry/plugins/PluginManager.java @@ -94,6 +94,7 @@ public class PluginManager { HARVESTCRAFT(new PluginHarvestCraft()), MAGICALCROPS(new PluginMagicalCrops()), NATURA(new PluginNatura()), + PLANTMEGAPACK(new PluginPlantMegaPack()), UNDERGROUND_BIOMES(new PluginUndergroundBiomes()); private final ForestryPlugin instance; diff --git a/src/main/java/forestry/plugins/PluginPlantMegaPack.java b/src/main/java/forestry/plugins/PluginPlantMegaPack.java new file mode 100644 index 000000000..b15619f0f --- /dev/null +++ b/src/main/java/forestry/plugins/PluginPlantMegaPack.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * 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.plugins; + +import com.google.common.collect.ImmutableList; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; + +import cpw.mods.fml.common.registry.GameRegistry; + +import forestry.api.farming.Farmables; +import forestry.core.GameMode; +import forestry.core.config.Defaults; +import forestry.core.fluids.Fluids; +import forestry.core.proxy.Proxies; +import forestry.core.utils.RecipeUtil; +import forestry.farming.logic.FarmableStacked; + +@Plugin(pluginID = "PlantMegaPack", name = "PlantMegaPack", author = "Nirek", url = Defaults.URL, unlocalizedDescription = "for.plugin.plantmegapack.description") +public class PluginPlantMegaPack extends ForestryPlugin { + + private static final String PlantMP = "plantmegapack"; + + @Override + public boolean isAvailable() { + return Proxies.common.isModLoaded(PlantMP); + } + + @Override + public String getFailMessage() { + return "Plant Mega Pack not found"; + } + + @Override + protected void registerRecipes() { + + ImmutableList reedLikePlant = ImmutableList.of( + "bambooAsper", + "bambooFargesiaRobusta", + "bambooGiantTimber", + "bambooGolden", + "bambooMoso", + "bambooShortTassled", + "bambooTimorBlack", + "bambooTropicalBlue", + "bambooWetForest" + ); + + ImmutableList waterPlant = ImmutableList.of( + "waterKelpGiantGRN", + "waterKelpGiantYEL" + ); + + for (String reedLike : reedLikePlant) { + Block reedBlock = GameRegistry.findBlock(PlantMP, reedLike); + ItemStack reedStack = GameRegistry.findItemStack(PlantMP, reedLike, 1); + if (reedBlock != null && reedStack != null) { + RecipeUtil.injectLeveledRecipe(reedStack, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS); + Farmables.farmables.get("farmPoales").add(new FarmableStacked(reedBlock, 14, 4)); + } + } + for (String wPlant : waterPlant) { + ItemStack waterPlantStack = GameRegistry.findItemStack(PlantMP, wPlant, 1); + if (waterPlantStack != null) { + RecipeUtil.injectLeveledRecipe(waterPlantStack, GameMode.getGameMode().getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS); + } + } + } +}