Skip to content

Commit

Permalink
Avoid crash if JEI was installed but the drying rack or chopping bloc…
Browse files Browse the repository at this point in the history
…k were disabled. Also disable integration for the respective recipes if the blocks are disabled.
  • Loading branch information
gigaherz committed Jul 29, 2016
1 parent 01341dc commit 7ae7441
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ repositories {

apply plugin: 'net.minecraftforge.gradle.forge'

version = "1.6.2"
version = "1.6.3"
group= "gigaherz.survivalist" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "Survivalist-1.10.2"

Expand Down
35 changes: 22 additions & 13 deletions src/main/java/gigaherz/survivalist/integration/JEIPlugin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gigaherz.survivalist.integration;

import gigaherz.survivalist.ConfigManager;
import gigaherz.survivalist.Survivalist;
import gigaherz.survivalist.integration.analyzer.ChoppingCategory;
import gigaherz.survivalist.integration.analyzer.ChoppingRecipeHandler;
Expand All @@ -20,21 +21,29 @@ public class JEIPlugin implements IModPlugin
@Override
public void register(@Nonnull IModRegistry registry)
{
registry.addRecipeCategories(
new ChoppingCategory(registry.getJeiHelpers().getGuiHelper()),
new DryingCategory(registry.getJeiHelpers().getGuiHelper()));

registry.addRecipeHandlers(
new ChoppingRecipeHandler(),
new DryingRecipeHandler());

registry.addRecipeCategoryCraftingItem(new ItemStack(Survivalist.chopping_block), ChoppingCategory.UID);
registry.addRecipeCategoryCraftingItem(new ItemStack(Survivalist.rack), DryingCategory.UID);
if (ConfigManager.instance.enableDryingRack)
{
registry.addRecipeCategories(new DryingCategory(registry.getJeiHelpers().getGuiHelper()));
registry.addRecipeHandlers(new DryingRecipeHandler());
registry.addRecipes(DryingRecipeWrapper.getRecipes());
if (Survivalist.rack != null)
{
registry.addRecipeCategoryCraftingItem(new ItemStack(Survivalist.rack), DryingCategory.UID);
}
}

if (ConfigManager.instance.enableChopping)
{
registry.addRecipeCategories(new ChoppingCategory(registry.getJeiHelpers().getGuiHelper()));
registry.addRecipeHandlers(new ChoppingRecipeHandler());
registry.addRecipes(ChoppingRecipeWrapper.getRecipes());
if (Survivalist.chopping_block != null)
{
registry.addRecipeCategoryCraftingItem(new ItemStack(Survivalist.chopping_block), ChoppingCategory.UID);
}
}

//registry.getRecipeTransferRegistry().addRecipeTransferHandler(new EssentializerCategory.TransferInfo());

registry.addRecipes(ChoppingRecipeWrapper.getRecipes());
registry.addRecipes(DryingRecipeWrapper.getRecipes());
}

@Override
Expand Down

0 comments on commit 7ae7441

Please sign in to comment.