From 0b2589b0078bba8a603016000fe5d1566cb6a443 Mon Sep 17 00:00:00 2001 From: temp1011 <34900092+temp1011@users.noreply.github.com> Date: Sun, 11 Feb 2018 11:22:35 +0000 Subject: [PATCH] Fix crash if HarvestCraft present but Apiculture disabled --- .../forestry/plugins/PluginHarvestCraft.java | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/java/forestry/plugins/PluginHarvestCraft.java b/src/main/java/forestry/plugins/PluginHarvestCraft.java index f2329e230..b07f7faf5 100644 --- a/src/main/java/forestry/plugins/PluginHarvestCraft.java +++ b/src/main/java/forestry/plugins/PluginHarvestCraft.java @@ -32,6 +32,7 @@ import forestry.core.items.ItemRegistryCore; import forestry.core.recipes.RecipeUtil; import forestry.farming.logic.farmables.FarmableAgingCrop; import forestry.modules.ForestryModuleUids; +import forestry.modules.ModuleManager; @SuppressWarnings("unused") @ForestryModule(containerID = ForestryCompatPlugins.ID, moduleID = ForestryModuleUids.HARVESTCRAFT, name = "HarvestCraft", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.module.harvestcraft.description") @@ -340,23 +341,25 @@ public class PluginHarvestCraft extends CompatPlugin { for (String nutName : nuts) { ItemStack nut = getItemStack(nutName + "item"); - Block nutBlock = getBlock("pam" + nutName); + Block nutBlock = getBlock("pam" + nutName); if (ForestryAPI.enabledModules.contains(new ResourceLocation(Constants.MOD_ID, ForestryModuleUids.FARMING)) && nutBlock != null) { - farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(ItemStack.EMPTY, nutBlock, fruitAGE, 2, 0)); + farmRegistry.registerFarmables("farmOrchard", new FarmableAgingCrop(ItemStack.EMPTY, nutBlock, fruitAGE, 2, 0)); } if (nut != null) { RecipeManagers.squeezerManager.addRecipe(20, nut, Fluids.SEED_OIL.getFluid(15 * seedamount)); } } - - ItemStack hcHoneyItem = getItemStack("honeyitem"); - if (hcHoneyItem != null) { - RecipeManagers.squeezerManager.addRecipe(10, hcHoneyItem, Fluids.FOR_HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP)); - } - - ItemStack hcBeeswaxItem = getItemStack("beeswaxitem"); - if (hcBeeswaxItem != null) { - RecipeUtil.addRecipe("pam_wax_capsule", ModuleFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem); + + if(ModuleManager.getInstance().isModuleEnabled(Constants.MOD_ID, ForestryModuleUids.APICULTURE)) { + ItemStack hcHoneyItem = getItemStack("honeyitem"); + if (hcHoneyItem != null) { + RecipeManagers.squeezerManager.addRecipe(10, hcHoneyItem, Fluids.FOR_HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP)); + } + + ItemStack hcBeeswaxItem = getItemStack("beeswaxitem"); + if (hcBeeswaxItem != null) { + RecipeUtil.addRecipe("pam_wax_capsule", ModuleFluids.getItems().waxCapsuleEmpty.getItemStack(ForestryAPI.activeMode.getIntegerSetting("recipe.output.capsule")), "XXX ", 'X', hcBeeswaxItem); + } } }