// Path: src/main/java/brightspark/sparkshammers/hammerCrafting/HammerCraftingManager.java
// public class HammerCraftingManager
// {
//     public static IForgeRegistry<HammerShapedOreRecipe> REGISTRY;
// 
//     /**
//      * Returns the static instance of this class
//      */
//     public static void setRegistry(IForgeRegistry<HammerShapedOreRecipe> registry)
//     {
//         REGISTRY = registry;
//     }
// 
//     public static List<HammerShapedOreRecipe> getRecipes()
//     {
//         return REGISTRY.getValues();
//     }
// 
//     private HammerCraftingManager() {}
// 
//     public static ItemStack findMatchingRecipe(InventoryCrafting invCrafting)
//     {
//         for(HammerShapedOreRecipe recipe : REGISTRY)
//             if(recipe.matches(invCrafting))
//                 return recipe.getRecipeOutput();
// 
//         return ItemStack.EMPTY;
//     }
// 
//     public static NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
//     {
//         for (HammerShapedOreRecipe recipe : REGISTRY)
//             if (recipe.matches(inv))
//                 return recipe.getRemainingItems(inv);
//         return ForgeHooks.defaultRecipeGetRemainingItems(inv);
//     }
// 
//     /**
//      * Returns the list of all valid recipes which do not have any missing ingredients
//      * This is used by the JEI plugin
//      */
//     public static List<HammerShapedOreRecipe> getValidRecipeList()
//     {
//         List<HammerShapedOreRecipe> validRecipes = Lists.newArrayList();
//         for(HammerShapedOreRecipe recipe : REGISTRY)
//         {
//             String oreDic = ((ItemAOE) recipe.getRecipeOutput().getItem()).getDependantOreDic();
//             if(oreDic == null || !OreDictionary.getOres(oreDic).isEmpty())
//                 validRecipes.add(recipe);
//         }
//         return validRecipes;
//     }
// }
// 
// Path: src/main/java/brightspark/sparkshammers/init/SHBlocks.java
// public class SHBlocks
// {
//     public static List<Block> BLOCKS;
//     public static List<ItemBlock> ITEM_BLOCKS;
// 
//     public static BlockHammer blockHammer = new BlockHammer();
//     public static BlockHammerCraft blockHammerCraft = new BlockHammerCraft();
// 
//     public static void addBlock(Block block)
//     {
//         BLOCKS.add(block);
//         ITEM_BLOCKS.add((ItemBlock) new ItemBlock(block).setRegistryName(block.getRegistryName()));
//     }
// 
//     private static void init()
//     {
//         BLOCKS = new ArrayList<>();
//         ITEM_BLOCKS = new ArrayList<>();
// 
//         addBlock(blockHammer);
//         addBlock(blockHammerCraft);
//     }
// 
//     public static Block[] getBlocks()
//     {
//         if(BLOCKS == null) init();
//         return BLOCKS.toArray(new Block[0]);
//     }
// 
//     public static ItemBlock[] getItemBlocks()
//     {
//         if(ITEM_BLOCKS == null) init();
//         return ITEM_BLOCKS.toArray(new ItemBlock[0]);
//     }
// }


import brightspark.sparkshammers.hammerCrafting.HammerCraftingManager;
import brightspark.sparkshammers.init.SHBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
        int handleYStart = gridStartY + 18 * 2;
        for(int headY = 0; headY <= 2; headY++)
        {
            for(int headX = 0; headX <= 4; headX++)
            {
                //Slot(IInventory, Slot Index, X Position, Y Position)
                if(headY == 2)
                {
                    if(headX < 4)
                        addSlotToContainer(new Slot(craftMatrix, numSlots, handleXStart, handleYStart + headX * 18));
                }
                else
                    addSlotToContainer(new Slot(craftMatrix, numSlots, gridStartX + headX * 18, gridStartY + headY * 18));
                numSlots++;
            }
        }

        bindPlayerInventory(invPlayer);
    }

    @Override
    public void onCraftMatrixChanged(IInventory inventory)
    {
        ItemStack stack = HammerCraftingManager.findMatchingRecipe(craftMatrix);
        craftResult.setInventorySlotContents(0, stack);
    }

    public boolean canInteractWith(EntityPlayer player)
    {
        //Returns true if the block is the Hammer Crafting block, and is within range
// Path: src/main/java/brightspark/sparkshammers/hammerCrafting/HammerCraftingManager.java
// public class HammerCraftingManager
// {
//     public static IForgeRegistry<HammerShapedOreRecipe> REGISTRY;
// 
//     /**
//      * Returns the static instance of this class
//      */
//     public static void setRegistry(IForgeRegistry<HammerShapedOreRecipe> registry)
//     {
//         REGISTRY = registry;
//     }
// 
//     public static List<HammerShapedOreRecipe> getRecipes()
//     {
//         return REGISTRY.getValues();
//     }
// 
//     private HammerCraftingManager() {}
// 
//     public static ItemStack findMatchingRecipe(InventoryCrafting invCrafting)
//     {
//         for(HammerShapedOreRecipe recipe : REGISTRY)
//             if(recipe.matches(invCrafting))
//                 return recipe.getRecipeOutput();
// 
//         return ItemStack.EMPTY;
//     }
// 
//     public static NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv)
//     {
//         for (HammerShapedOreRecipe recipe : REGISTRY)
//             if (recipe.matches(inv))
//                 return recipe.getRemainingItems(inv);
//         return ForgeHooks.defaultRecipeGetRemainingItems(inv);
//     }
// 
//     /**
//      * Returns the list of all valid recipes which do not have any missing ingredients
//      * This is used by the JEI plugin
//      */
//     public static List<HammerShapedOreRecipe> getValidRecipeList()
//     {
//         List<HammerShapedOreRecipe> validRecipes = Lists.newArrayList();
//         for(HammerShapedOreRecipe recipe : REGISTRY)
//         {
//             String oreDic = ((ItemAOE) recipe.getRecipeOutput().getItem()).getDependantOreDic();
//             if(oreDic == null || !OreDictionary.getOres(oreDic).isEmpty())
//                 validRecipes.add(recipe);
//         }
//         return validRecipes;
//     }
// }
// 
// Path: src/main/java/brightspark/sparkshammers/init/SHBlocks.java
// public class SHBlocks
// {
//     public static List<Block> BLOCKS;
//     public static List<ItemBlock> ITEM_BLOCKS;
// 
//     public static BlockHammer blockHammer = new BlockHammer();
//     public static BlockHammerCraft blockHammerCraft = new BlockHammerCraft();
// 
//     public static void addBlock(Block block)
//     {
//         BLOCKS.add(block);
//         ITEM_BLOCKS.add((ItemBlock) new ItemBlock(block).setRegistryName(block.getRegistryName()));
//     }
// 
//     private static void init()
//     {
//         BLOCKS = new ArrayList<>();
//         ITEM_BLOCKS = new ArrayList<>();
// 
//         addBlock(blockHammer);
//         addBlock(blockHammerCraft);
//     }
// 
//     public static Block[] getBlocks()
//     {
//         if(BLOCKS == null) init();
//         return BLOCKS.toArray(new Block[0]);
//     }
// 
//     public static ItemBlock[] getItemBlocks()
//     {
//         if(ITEM_BLOCKS == null) init();
//         return ITEM_BLOCKS.toArray(new ItemBlock[0]);
//     }
// }


// Path: src/main/java/brightspark/sparkshammers/gui/ContainerHammerCraft.java
import brightspark.sparkshammers.hammerCrafting.HammerCraftingManager;
import brightspark.sparkshammers.init.SHBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

        int handleYStart = gridStartY + 18 * 2;
        for(int headY = 0; headY <= 2; headY++)
        {
            for(int headX = 0; headX <= 4; headX++)
            {
                //Slot(IInventory, Slot Index, X Position, Y Position)
                if(headY == 2)
                {
                    if(headX < 4)
                        addSlotToContainer(new Slot(craftMatrix, numSlots, handleXStart, handleYStart + headX * 18));
                }
                else
                    addSlotToContainer(new Slot(craftMatrix, numSlots, gridStartX + headX * 18, gridStartY + headY * 18));
                numSlots++;
            }
        }

        bindPlayerInventory(invPlayer);
    }

    @Override
    public void onCraftMatrixChanged(IInventory inventory)
    {
        ItemStack stack = HammerCraftingManager.findMatchingRecipe(craftMatrix);
        craftResult.setInventorySlotContents(0, stack);
    }

    public boolean canInteractWith(EntityPlayer player)
    {
        //Returns true if the block is the Hammer Crafting block, and is within range
        return worldObj.getBlockState(pos).getBlock() == SHBlocks.blockHammerCraft && player.getDistanceSq((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D) <= 64.0D;