{"action":"created","comment":{"url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments/111920199","pull_request_review_id":33194344,"id":111920199,"diff_hunk":"@@ -294,603 +363,1248 @@ public static boolean hasToolLevel(final String tool, final ItemStack stack, fin\n     /**\n      * Verifies if an item has an appropriated grade.\n      *\n-     * @param item     the type of tool needed\n-     * @param level    the type of tool needed\n-     * @param hutLevel the worker's hut level\n+     * @param itemStack    the type of tool needed\n+     * @param toolLevel    the type of tool needed\n+     * @param minimalLevel the worker's hut level\n      * @return true if tool is acceptable\n      */\n-    public static boolean verifyToolLevel(final ItemStack item, int level, final int hutLevel)\n+    public static boolean verifyToolLevel(@NotNull final ItemStack itemStack, int toolLevel, final int minimalLevel)\n     {\n-        if (item == null || hutLevel > FREE_TOOL_CHOICE_LEVEL)\n+        if (isItemStackEmpty(itemStack) || minimalLevel > FREE_TOOL_CHOICE_LEVEL || minimalLevel >= toolLevel)\n         {\n             return true;\n         }\n-        else if (item.isItemEnchanted() && hutLevel <= EFFECT_TOOL_CHOICE_LEVEL)\n+        else if (itemStack.isItemEnchanted() && minimalLevel <= EFFECT_TOOL_CHOICE_LEVEL)\n         {\n             return false;\n         }\n-        else if (hutLevel >= level)\n-        {\n-            return true;\n-        }\n \n         return false;\n     }\n \n     /**\n-     * Looks for a pickaxe to mine a block of {@code minLevel}.\n+     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#addItemStackToInventory(ItemStack)}.\n      *\n-     * @param entity   inventory to check in.\n-     * @param minlevel the needed pickaxe level\n-     * @return true if a pickaxe was found\n+     * @param itemHandler {@link IItemHandler} to add itemstack to.\n+     * @param itemStack   ItemStack to add.\n+     * @return True if successful, otherwise false.\n      */\n-    public static boolean isPickaxeInTileEntity(TileEntityChest entity, final int minlevel)\n+    public static boolean addItemStackToItemHandler(@NotNull final IItemHandler itemHandler, @Nullable ItemStack itemStack)\n     {\n-        return InventoryFunctions.matchFirstInInventoryWithInventory(\n-          entity,\n-          stack -> stack != null && Utils.checkIfPickaxeQualifies(\n-            minlevel,\n-            Utils.getMiningLevel(stack, Utils.PICKAXE)\n-          ),\n-          InventoryFunctions::doNothing\n-        );\n+        if (!isItemStackEmpty(itemStack))\n+        {\n+            int slot;\n+\n+            if (itemStack.isItemDamaged())\n+            {\n+                slot = getFirstOpenSlotFromItemHandler(itemHandler);\n+\n+                if (slot >= 0)\n+                {\n+                    itemHandler.insertItem(slot, itemStack, false);\n+                    return true;\n+                }\n+                else\n+                {\n+                    return false;\n+                }\n+            }\n+            else\n+            {\n+                ItemStack resultStack = itemStack;\n+                slot = itemHandler.getSlots() == 0 ? -1 : 0;\n+                while (!isItemStackEmpty(resultStack) && slot != -1 && slot != itemHandler.getSlots())\n+                {\n+                    resultStack = itemHandler.insertItem(slot, resultStack, false);\n+                    if (!isItemStackEmpty(resultStack))\n+                    {\n+                        slot++;\n+                    }\n+                }\n+\n+\n+                return isItemStackEmpty(resultStack);\n+            }\n+        }\n+        else\n+        {\n+            return false;\n+        }\n     }\n \n     /**\n-     * Looks for a pickaxe to mine a block of {@code minLevel}.\n+     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#addItemStackToInventory(ItemStack)}.\n      *\n-     * @param entity   inventory to check in.\n-     * @param minlevel the needed pickaxe level\n-     * @param maxLevel the tools max level.\n-     * @return true if a pickaxe was found\n+     * @param itemHandler              {@link IItemHandler} to add itemstack\n+     *                                 to.\n+     * @param itemStack                ItemStack to add.\n+     * @param itemStackToKeepPredicate The {@link Predicate} that determines\n+     *                                 which ItemStacks to keep in the\n+     *                                 inventory. Return false to replace.\n+     * @return itemStack which has been replaced, null if none has been\n+     * replaced.\n      */\n-    public static boolean isPickaxeInTileEntity(IInventory entity, final int minlevel, final int maxLevel)\n+    @Nullable\n+    public static ItemStack forceItemStackToItemHandler(\n+                                                         @NotNull final IItemHandler itemHandler,\n+                                                         @NotNull final ItemStack itemStack,\n+                                                         @NotNull final Predicate<ItemStack> itemStackToKeepPredicate)\n     {\n-        return InventoryFunctions.matchFirstInInventoryWithInventory(\n-          entity,\n-          stack -> stack != null && stack != ItemStack.EMPTY && Utils.checkIfPickaxeQualifies(\n-            minlevel,\n-            Utils.getMiningLevel(stack, Utils.PICKAXE)) && InventoryUtils.hasToolLevel(Utils.PICKAXE, stack, maxLevel\n-          ),\n-          InventoryFunctions::doNothing\n-        );\n+        if (!InventoryUtils.addItemStackToItemHandler(itemHandler, itemStack))\n+        {\n+            for (int i = 0; i < itemHandler.getSlots(); i++)\n+            {\n+                final ItemStack localStack = itemHandler.getStackInSlot(i);\n+                if (isItemStackEmpty(localStack) || !itemStackToKeepPredicate.test(localStack))\n+                {\n+                    final ItemStack removedStack = itemHandler.extractItem(i, Integer.MAX_VALUE, false);\n+                    if (isItemStackEmpty(itemHandler.insertItem(i, itemStack, true)))\n+                    {\n+                        itemHandler.insertItem(i, itemStack, false);\n+                        return removedStack.copy();\n+                    }\n+                }\n+            }\n+        }\n+        return InventoryUtils.EMPTY;\n     }\n \n     /**\n-     * Looks for a pickaxe to mine a block of {@code minLevel}.\n+     * Returns the amount of item stacks in an inventory. This equals {@link\n+     * #getItemHandlerAsList(IItemHandler)}<code>.length();</code>.\n      *\n-     * @param entity   inventory to check in.\n-     * @param minlevel the needed pickaxe level\n-     * @return true if a pickaxe was found\n+     * @param itemHandler {@link IItemHandler} to count item stacks of.\n+     * @return Amount of item stacks in the {@link IItemHandler}.\n      */\n-    public static boolean isPickaxeInTileEntity(InventoryCitizen entity, final int minlevel)\n+    public static int getAmountOfStacksInItemHandler(@NotNull final IItemHandler itemHandler)\n     {\n-        return InventoryFunctions.matchFirstInInventoryWithInventory(\n-          entity,\n-          stack -> Utils.checkIfPickaxeQualifies(\n-            minlevel,\n-            Utils.getMiningLevel(stack, Utils.PICKAXE)\n-          ),\n-          InventoryFunctions::doNothing\n-        );\n+        return getItemHandlerAsList(itemHandler).size();\n     }\n \n     /**\n-     * Checks if the inventory contains the following tool.\n+     * Returns an {@link IItemHandler} as list of item stacks.\n      *\n-     * @param inventoryCitizen the inventory citizen.\n-     * @param tool             the tool.\n-     * @return true if found the tool.\n+     * @param itemHandler Inventory to convert.\n+     * @return List of item stacks.\n      */\n-    public static boolean isToolInTileEntity(InventoryCitizen inventoryCitizen, final String tool)\n+    @NotNull\n+    public static List<ItemStack> getItemHandlerAsList(@NotNull final IItemHandler itemHandler)\n     {\n-        return InventoryFunctions.matchFirstInInventoryWithInventory(\n-          inventoryCitizen,\n-          stack -> Utils.isTool(stack, tool),\n-          InventoryFunctions::doNothing\n-        );\n+        return filterItemHandler(itemHandler, (ItemStack stack) -> true);\n     }\n \n     /**\n-     * {@link #takeStackInSlot(IInventory, IInventory, int, int, boolean)}.\n-     * Default:\n-     * amount: 1\n-     * takeAll: true\n+     * Filters a list of items, matches the stack using {@link\n+     * #compareItems(ItemStack, Item, int)}, in an {@link ICapabilityProvider}.\n+     * Uses the MetaData and {@link #getItemFromBlock(Block)} as parameters for\n+     * the Predicate.\n      *\n-     * @param sendingInv   Inventory of sender\n-     * @param receivingInv Inventory of receiver\n-     * @param slotID       Slot ID to take from\n-     * @return True if item is swapped, otherwise false\n+     * @param provider Provider to filter in\n+     * @param block    Block to filter\n+     * @param metaData the damage value.\n+     * @return List of item stacks\n      */\n-    public static boolean takeStackInSlot(final IInventory sendingInv, final IInventory receivingInv, final int slotID)\n+    @NotNull\n+    public static List<ItemStack> filterProvider(@NotNull final ICapabilityProvider provider, final Block block, int metaData)\n     {\n-        return takeStackInSlot(sendingInv, receivingInv, slotID, sendingInv.getStackInSlot(slotID).getCount(), true);\n+        return filterProvider(provider, (ItemStack stack) -> compareItems(stack, getItemFromBlock(block), metaData));\n     }\n \n     /**\n-     * Gives an item from an slot index from an inventory and puts it in a receiving inventory.\n-     * If <code>takeAll</code> is true, the entire slot will we transferred.\n-     * This only applied when at least <code>amount</code> can be taken.\n+     * Filters a list of items, that match the given predicate, in an {@link\n+     * ICapabilityProvider}.\n      *\n-     * @param sendingInv   Inventory of sender\n-     * @param receivingInv Inventory of receiver\n-     * @param slotID       Slot ID to take from\n-     * @param amount       Amount to swap\n-     * @param takeAll      Whether or not the entire stack of the sender should be emptied if possible\n-     *                     Only applies when <code>amount</code> is sufficient\n-     * @return True if item is swapped, otherwise false\n+     * @param provider                    The ICapabilityProvider to get items\n+     *                                    from.\n+     * @param itemStackSelectionPredicate The predicate to match the stack to.\n+     * @return List of item stacks that match the given predicate.\n      */\n-    public static boolean takeStackInSlot(\n-                                           @Nullable final IInventory sendingInv, @Nullable final IInventory receivingInv,\n-                                           final int slotID, final int amount, final boolean takeAll)\n+    @NotNull\n+    public static List<ItemStack> filterProvider(@NotNull final ICapabilityProvider provider, @NotNull Predicate<ItemStack> itemStackSelectionPredicate)\n     {\n-        if (receivingInv != null && sendingInv != null && slotID >= 0 && amount >= 0)\n-        {\n-            // gets itemstack in slot, and decreases stacksize\n-            @Nullable ItemStack stack = sendingInv.decrStackSize(slotID, amount);\n-            // stack is null if no itemstack was in slot\n-            if (stack != null && stack != ItemStack.EMPTY)\n-            {\n-                // puts stack in receiving inventory\n-                stack = setStack(receivingInv, stack);\n-                // checks for leftovers\n-                if (stack == null && stack != ItemStack.EMPTY)\n-                {\n-                    if (takeAll)\n-                    {\n-                        // gets itemstack in slot\n-                        stack = sendingInv.getStackInSlot(slotID);\n-                        // checks if itemstack is still in slot\n-                        if (stack != null && stack != ItemStack.EMPTY)\n-                        {\n-                            stack = sendingInv.decrStackSize(slotID, stack.getCount());\n-                            stack = setStack(receivingInv, stack);\n-                            setStack(sendingInv, stack);\n-                        }\n-                    }\n-\n-                    // puts leftovers back in sending inventory\n-                    return true;\n-                }\n-                setStack(sendingInv, stack);\n-                return false;\n-            }\n-        }\n-        return false;\n+        return getFromProviderForAllSides(provider, itemStackSelectionPredicate);\n     }\n \n     /**\n-     * Tries to put an item into Inventory.\n+     * Method to process the given predicate for all {@link EnumFacing} of a\n+     * {@link ICapabilityProvider}, including the internal one (passing null as\n+     * argument).\n      *\n-     * @param inventory the inventory to set the stack in.\n-     * @param stack     Item stack with items to be transferred\n-     * @return returns null if successful, or stack of remaining items\n+     * @param provider  The provider to process all the\n+     * @param predicate The predicate to match the ItemStacks in the {@link\n+     *                  IItemHandler} for each side with.\n+     * @return A combined {@link List<ItemStack>} as if the given predicate was\n+     * called on all ItemStacks in all IItemHandlers of the given provider.\n      */\n-    @Nullable\n-    public static ItemStack setStack(@NotNull final IInventory inventory, @Nullable final ItemStack stack)\n+    @NotNull\n+    private static List<ItemStack> getFromProviderForAllSides(@NotNull final ICapabilityProvider provider, @NotNull Predicate<ItemStack> predicate)\n     {\n-        if (stack !=null && stack.getCount() > stack.getMaxStackSize())\n-        {\n-            Log.getLogger().warn(\"InventoryUtils.setStack: stack size bigger than the max stack size. Please contact a minecolonnies developer.\");\n-        }\n+        final ArrayList<ItemStack> combinedList = new ArrayList<>();\n \n-        if (stack != null && stack != ItemStack.EMPTY)\n+        for (IItemHandler handler : getItemHandlersFromProvider(provider))\n         {\n-            @Nullable ItemStack returnStack = stack.copy();\n-            int slot;\n-            while ((slot = containsPartialStack(inventory, stack)) != -1 && returnStack != null && returnStack != ItemStack.EMPTY)\n-            {\n-                final ItemStack current = inventory.getStackInSlot(slot);\n-                final int spaceLeft = current.getMaxStackSize() - current.getCount();\n-                if (spaceLeft > 0)\n-                {\n-                    @NotNull final ItemStack toBeAdded = returnStack.splitStack(Math.min(returnStack.getCount(), spaceLeft));\n-                    if (returnStack.getCount() == 0)\n-                    {\n-                        returnStack = ItemStack.EMPTY;\n-                    }\n-                    current.setCount(current.getCount() + toBeAdded.getCount());\n-                    inventory.setInventorySlotContents(slot, current);\n-                }\n-            }\n-\n-            while ((slot = getOpenSlot(inventory)) != -1 && returnStack != null && returnStack != ItemStack.EMPTY)\n-            {\n-                inventory.setInventorySlotContents(slot, returnStack);\n-                if (returnStack.getCount() > inventory.getInventoryStackLimit())\n-                {\n-                    returnStack.setCount(returnStack.getCount() - inventory.getInventoryStackLimit());\n-                }\n-                else\n-                {\n-                    returnStack = ItemStack.EMPTY;\n-                }\n-            }\n-            return returnStack;\n+            combinedList.addAll(filterItemHandler(handler, predicate));\n         }\n-        return ItemStack.EMPTY;\n+        return combinedList;\n     }\n \n     /**\n-     * {@link #setStack(IInventory, ItemStack)}.\n-     * Tries to put an itemStack into Inventory, unlike setStack, allow to use a ItemStack bigger than the maximum stack size allowed for the item\n+     * Method to get all the IItemHandlers from a given Provider.\n      *\n-     * @param inventory the inventory to set the stack in.\n-     * @param stack     Item stack with items to be transferred, the stack can be bigger than allowed\n-     * @return returns null if successful, or stack of remaining items, BE AWARE that the remaining stack can be bigger than the maximum stack size\n+     * @param provider The provider to get the IItemHandlers from.\n+     * @return A list with all the unique IItemHandlers a provider has.\n      */\n-    @Nullable\n-    public static ItemStack setOverSizedStack(@NotNull final IInventory inventory, @Nullable final ItemStack stack)\n+    @NotNull\n+    public static List<IItemHandler> getItemHandlersFromProvider(@NotNull ICapabilityProvider provider)\n     {\n-        int stackSize = stack.getCount();\n-        while (stackSize > 0)\n+        final ArrayList<IItemHandler> handlerList = Arrays.stream(EnumFacing.VALUES)\n+                                                      .filter(facing -> provider.hasCapability(ITEM_HANDLER_CAPABILITY, facing))\n+                                                      .map(facing -> provider.getCapability(ITEM_HANDLER_CAPABILITY, facing))\n+                                                      .distinct()\n+                                                      .collect(Collectors.toCollection(ArrayList::new));\n+\n+        if (provider.hasCapability(ITEM_HANDLER_CAPABILITY, null))\n         {\n-            final int itemCount = Math.min(stackSize, stack.getMaxStackSize());\n-            final ItemStack items = new ItemStack(stack.getItem(), itemCount, stack.getItemDamage());\n-            stackSize-=itemCount;\n-            final ItemStack remainingItems = setStack(inventory,items);\n-            stackSize+=remainingItems.getCount();\n-            if (items.getCount()==remainingItems.getCount())\n+            final IItemHandler nullHandler = provider.getCapability(ITEM_HANDLER_CAPABILITY, null);\n+            if (!handlerList.contains(nullHandler))\n             {\n-                break; \n+                handlerList.add(nullHandler);\n             }\n         }\n-        return new ItemStack(stack.getItem(), stackSize, stack.getItemDamage());\n \n+        return handlerList;\n     }\n \n     /**\n-     * Returns a slot number if a chest contains given ItemStack item that is not fully stacked.\n+     * Filters a list of items, matches the stack using {@link\n+     * #compareItems(ItemStack, Item, int)}, with targetItem and itemDamage as\n+     * parameters, in an {@link ICapabilityProvider}.\n      *\n-     * @param inventory the inventory to check.\n-     * @param stack     the stack to check for.\n-     * @return returns slot number if found, -1 when not found.\n+     * @param provider   Provider to get items from\n+     * @param targetItem Item to look for\n+     * @param itemDamage the damage value.\n+     * @return List of item stacks with the given item in inventory\n      */\n-    public static int containsPartialStack(@NotNull final IInventory inventory, final ItemStack stack)\n+    @NotNull\n+    public static List<ItemStack> filterProvider(@NotNull final ICapabilityProvider provider, @Nullable final Item targetItem, int itemDamage)\n     {\n-        for (int i = 0; i < inventory.getSizeInventory(); i++)\n-        {\n-            final ItemStack testStack = inventory.getStackInSlot(i);\n-            if (testStack != null && testStack != ItemStack.EMPTY && testStack.isItemEqual(stack) && testStack.getCount() != testStack.getMaxStackSize())\n-            {\n-                return i;\n-            }\n-        }\n-        return -1;\n+        return filterProvider(provider, (ItemStack stack) -> compareItems(stack, targetItem, itemDamage));\n     }\n \n     /**\n-     * {@link #takeStackInSlot(IInventory, IInventory, int, int, boolean)}.\n-     * Default:\n-     * takeAll: false\n+     * Returns the index of the first occurrence of the block in the {@link\n+     * ICapabilityProvider}.\n      *\n-     * @param sendingInv   Inventory of sender\n-     * @param receivingInv Inventory of receiver\n-     * @param slotID       Slot ID to take from\n-     * @param amount       Amount to swap\n-     * @return True if item is swapped, otherwise false\n+     * @param provider   {@link ICapabilityProvider} to check.\n+     * @param block      Block to find.\n+     * @param itemDamage the damage value.\n+     * @return Index of the first occurrence.\n      */\n-    public static boolean takeStackInSlot(final IInventory sendingInv, final IInventory receivingInv, final int slotID, final int amount)\n+    public static int findFirstSlotInProviderWith(@NotNull final ICapabilityProvider provider, final Block block, int itemDamage)\n     {\n-        return takeStackInSlot(sendingInv, receivingInv, slotID, amount, false);\n+        return findFirstSlotInProviderWith(provider, getItemFromBlock(block), itemDamage);\n     }\n \n     /**\n-     * Returns all <code>ItemStack</code>s in an inventory.\n-     * Stores this in an array.\n+     * Returns the index of the first occurrence of the Item with the given\n+     * ItemDamage in the {@link ICapabilityProvider}.\n      *\n-     * @param inventory Inventory to return all item stacks from.\n-     * @return Array of item stacks.\n+     * @param provider   {@link ICapabilityProvider} to check\n+     * @param targetItem Item to find.\n+     * @param itemDamage The damage value to match on the stack.\n+     * @return Index of the first occurrence\n      */\n-    @NotNull\n-    public static ItemStack[] getAllItemStacks(@NotNull final IInventory inventory)\n+    public static int findFirstSlotInProviderWith(@NotNull final ICapabilityProvider provider, final Item targetItem, int itemDamage)\n     {\n-        @NotNull final ItemStack[] itemStack = new ItemStack[inventory.getSizeInventory()];\n-        for (int i = 0; i < inventory.getSizeInventory(); i++)\n-        {\n-            itemStack[i] = inventory.getStackInSlot(i);\n-        }\n-        return itemStack;\n+        return findFirstSlotInProviderWith(provider, (ItemStack stack) -> compareItems(stack, targetItem, itemDamage));\n     }\n \n     /**\n-     * Returns the amount of item stacks in an inventory.\n-     * This equals {@link #getAllItemStacks(IInventory)}<code>.length();</code>.\n+     * Returns the index of the first occurrence of an ItemStack that matches\n+     * the given predicate in the {@link ICapabilityProvider}.\n      *\n-     * @param inventory Inventory to count item stacks of.\n-     * @return Amount of item stacks in inventory.\n+     * @param provider                    Provider to check\n+     * @param itemStackSelectionPredicate The predicate to match.\n+     * @return Index of the first occurrence\n      */\n-    public static int getAmountOfStacks(@NotNull final IInventory inventory)\n+    public static int findFirstSlotInProviderWith(@NotNull final ICapabilityProvider provider, Predicate<ItemStack> itemStackSelectionPredicate)\n     {\n-        int count = 0;\n-        for (int i = 0; i < inventory.getSizeInventory(); i++)\n+        for (IItemHandler handler : getItemHandlersFromProvider(provider))\n         {\n-            final ItemStack is = inventory.getStackInSlot(i);\n-\n-            if (is != null && is != ItemStack.EMPTY)\n+            int foundSlot = findFirstSlotInItemHandlerWith(handler, itemStackSelectionPredicate);\n+            //TODO: When contract is hardened later: Replace this -1 check with a try-catch block.\n+            if (foundSlot > -1)\n             {\n-                count++;\n+                return foundSlot;\n             }\n         }\n-        return count;\n+\n+        return -1;\n+        //TODO: Later harden contract to remove compare on slot := -1\n+        //throw new IllegalStateException(\"Item \"+targetItem.getUnlocalizedName() + \" not found in ItemHandler!\");\n     }\n \n     /**\n-     * Clears an entire inventory.\n+     * Returns the amount of occurrences in the {@link ICapabilityProvider}.\n      *\n-     * @param inventory Inventory to clear.\n+     * @param provider   {@link ICapabilityProvider} to scan.\n+     * @param block      The block to count\n+     * @param itemDamage the damage value\n+     * @return Amount of occurrences of stacks that match the given block and\n+     * ItemDamage\n      */\n-    public static void clear(@NotNull final IInventory inventory)\n+    public static int getItemCountInProvider(@NotNull final ICapabilityProvider provider, @NotNull final Block block, int itemDamage)\n     {\n-        for (int slot = 0; slot < inventory.getSizeInventory(); slot++)\n-        {\n-            inventory.setInventorySlotContents(slot, ItemStack.EMPTY);\n-        }\n+        return getItemCountInProvider(provider, getItemFromBlock(block), itemDamage);\n     }\n \n     /**\n-     * Returns a slot number if an inventory contains given tool type.\n+     * Returns the amount of occurrences in the {@link ICapabilityProvider}.\n      *\n-     * @param inventory the inventory to get the slot from.\n-     * @param tool      the tool type to look for.\n-     * @return slot number if found, -1 if not found.\n+     * @param provider   {@link ICapabilityProvider} to scan.\n+     * @param targetItem Item to count\n+     * @param itemDamage the item damage value.\n+     * @return Amount of occurrences of stacks that match the given item and\n+     * ItemDamage\n      */\n-    public static int getFirstSlotContainingTool(@NotNull final IInventory inventory, @NotNull final String tool)\n+    public static int getItemCountInProvider(@NotNull final ICapabilityProvider provider, @NotNull final Item targetItem, int itemDamage)\n     {\n-        for (int i = 0; i < inventory.getSizeInventory(); i++)\n-        {\n-            final ItemStack item = inventory.getStackInSlot(i);\n-            //Only classic fishingRod recognized as a fishingTool\n-            if (item != null && (item.getItem().getToolClasses(item).contains(tool) || (\"hoe\".equals(tool) && item.getUnlocalizedName().contains(\"hoe\"))\n-                                   || (\"rod\".equals(tool) && item.getUnlocalizedName().contains(\"fishingRod\"))))\n-            {\n-                return i;\n-            }\n-        }\n-        return -1;\n+        return getItemCountInProvider(provider, (ItemStack stack) -> compareItems(stack, targetItem, itemDamage));\n     }\n \n     /**\n-     * Verifies if there is one tool with an acceptable level\n-     * in a worker's inventory.\n+     * Returns the amount of occurrences in the {@link ICapabilityProvider}.\n      *\n-     * @param tool      the type of tool needed\n-     * @param inventory the worker's inventory\n-     * @param hutLevel  the worker's hut level\n-     * @return true if tool is acceptable\n+     * @param provider                    {@link ICapabilityProvider} to scan.\n+     * @param itemStackSelectionPredicate The predicate used to select the\n+     *                                    stacks to count.\n+     * @return Amount of occurrences of stacks that match the given predicate.\n      */\n-    public static boolean hasToolLevel(final String tool, @NotNull final IInventory inventory, final int hutLevel)\n+    public static int getItemCountInProvider(@NotNull final ICapabilityProvider provider, @NotNull final Predicate<ItemStack> itemStackSelectionPredicate)\n     {\n-        for (int i = 0; i < inventory.getSizeInventory(); i++)\n-        {\n-            final ItemStack item = inventory.getStackInSlot(i);\n-            final int level = Utils.getMiningLevel(item, tool);\n+        return getItemHandlersFromProvider(provider).stream()\n+                 .mapToInt(handler -> filterItemHandler(handler, itemStackSelectionPredicate).stream().mapToInt(InventoryUtils::getItemStackSize).sum())\n+                 .sum();\n+    }\n \n-            if (Utils.isTool(item, tool) && verifyToolLevel(item, level, hutLevel))\n-            {\n-                return true;\n-            }\n-        }\n-        return false;\n+    /**\n+     * Checks if a player has a block in the {@link ICapabilityProvider}.\n+     * Checked by {@link #getItemCountInProvider(ICapabilityProvider, Block,\n+     * int)} &gt; 0;\n+     *\n+     * @param Provider   {@link ICapabilityProvider} to scan\n+     * @param block      Block to count\n+     * @param itemDamage the damage value.\n+     * @return True when in {@link ICapabilityProvider}, otherwise false\n+     */\n+    public static boolean hasItemInProvider(@NotNull final ICapabilityProvider Provider, @NotNull final Block block, int itemDamage)\n+    {\n+        return hasItemInProvider(Provider, getItemFromBlock(block), itemDamage);\n     }\n \n     /**\n-     * Assigns a string containing the grade of the toolGrade.\n+     * Checks if a player has an item in the {@link ICapabilityProvider}.\n+     * Checked by {@link #getItemCountInProvider(ICapabilityProvider, Item,\n+     * int)} &gt; 0;\n      *\n-     * @param toolGrade the number of the grade of a tool\n-     * @return a string corresponding to the tool\n+     * @param Provider   {@link ICapabilityProvider} to scan\n+     * @param item       Item to count\n+     * @param itemDamage the damage value of the item.\n+     * @return True when in {@link ICapabilityProvider}, otherwise false\n      */\n-    public static String swapToolGrade(final int toolGrade)\n+    public static boolean hasItemInProvider(@NotNull final ICapabilityProvider Provider, @NotNull final Item item, int itemDamage)\n     {\n-        switch (toolGrade)\n-        {\n-            case 0:\n-                return \"Wood or Gold\";\n-            case 1:\n-                return \"Stone\";\n-            case 2:\n-                return \"Iron\";\n-            case 3:\n-                return \"Diamond\";\n-            default:\n-                return \"Better than Diamond\";\n-        }\n+        return hasItemInProvider(Provider, (ItemStack stack) -> compareItems(stack, item, itemDamage));\n     }\n \n     /**\n-     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#addItemStackToInventory(ItemStack)}.\n+     * Checks if a player has an item in the {@link ICapabilityProvider}.\n+     * Checked by {@link InventoryUtils#getItemCountInProvider(ICapabilityProvider,\n+     * Predicate)} &gt; 0;\n      *\n-     * @param inventory Inventory to add itemstack to.\n-     * @param itemStack ItemStack to add.\n-     * @param building  the building.\n-     * @return itemStack which has been replaced.\n+     * @param Provider                    {@link ICapabilityProvider} to scan\n+     * @param itemStackSelectionPredicate The predicate to match the ItemStack\n+     *                                    to.\n+     * @return True when in {@link ICapabilityProvider}, otherwise false\n      */\n-    @Nullable\n-    public static ItemStack forceItemStackToInventory(@NotNull final IInventory inventory, @NotNull final ItemStack itemStack, @NotNull final AbstractBuilding building)\n+    public static boolean hasItemInProvider(@NotNull final ICapabilityProvider Provider, @NotNull final Predicate<ItemStack> itemStackSelectionPredicate)\n     {\n-        if (!addItemStackToInventory(inventory, itemStack))\n-        {\n-            final List<ItemStorage> localAlreadyKept = new ArrayList<>();\n-            for (int i = 0; i < inventory.getSizeInventory(); i++)\n-            {\n-                final ItemStack localStack = inventory.getStackInSlot(i);\n-                if (!EntityAIWorkDeliveryman.workerRequiresItem(building, localStack, localAlreadyKept))\n-                {\n-                    final ItemStack removedStack = inventory.removeStackFromSlot(i);\n-                    inventory.setInventorySlotContents(i, itemStack.copy());\n-                    return removedStack.copy();\n-                }\n-            }\n-        }\n-        return null;\n+        return getItemCountInProvider(Provider, itemStackSelectionPredicate) > 0;\n     }\n \n     /**\n-     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#addItemStackToInventory(ItemStack)}.\n+     * Returns if the {@link ICapabilityProvider} is full.\n      *\n-     * @param inventory Inventory to add itemstack to.\n-     * @param itemStack ItemStack to add.\n-     * @return True if successful, otherwise false.\n+     * @param provider The {@link ICapabilityProvider}.\n+     * @return True if the {@link ICapabilityProvider} is full, false when not.\n      */\n-    public static boolean addItemStackToInventory(@NotNull final IInventory inventory, @Nullable final ItemStack itemStack)\n+    public static boolean isProviderFull(@NotNull final ICapabilityProvider provider)\n     {\n-        if (itemStack != null && itemStack.getCount() != 0 && itemStack.getItem() != null)\n-        {\n-            int stackSize;\n+        return getFirstOpenSlotFromProvider(provider) == -1;\n+    }\n \n-            if (itemStack.isItemDamaged())\n-            {\n-                stackSize = getOpenSlot(inventory);\n+    /**\n+     * Returns the first open slot in the {@link ICapabilityProvider}.\n+     *\n+     * @param provider The {@link ICapabilityProvider} to check.\n+     * @return slot index or -1 if none found.\n+     */\n+    public static int getFirstOpenSlotFromProvider(@NotNull final ICapabilityProvider provider)\n+    {\n+        return getItemHandlersFromProvider(provider).stream().mapToInt(InventoryUtils::getFirstOpenSlotFromItemHandler).filter(slotIndex -> slotIndex > -1).findFirst().orElse(-1);\n+    }\n \n-                if (stackSize >= 0)\n-                {\n-                    final ItemStack copy = itemStack.copy();\n-                    copy.setAnimationsToGo(5);\n-                    inventory.setInventorySlotContents(stackSize, copy);\n+    /**\n+     * Checks if the {@link ICapabilityProvider} contains the following toolName\n+     * with the given minimal Level.\n+     *\n+     * @param provider     The {@link ICapabilityProvider} to scan.\n+     * @param toolTypeName The toolTypeName of the tool to find.\n+     * @param minimalLevel The minimal level to find.\n+     * @return True if a Tool with the given toolTypeName was found in the given\n+     * {@link ICapabilityProvider}, false when not.\n+     */\n+    public static boolean isToolInProvider(@NotNull final ICapabilityProvider provider, @NotNull final String toolTypeName, int minimalLevel)\n+    {\n+        return hasItemInProvider(provider, (ItemStack stack) -> Utils.isTool(stack, toolTypeName) && InventoryUtils.hasToolLevel(stack, toolTypeName, minimalLevel));\n+    }\n \n-                    itemStack.setCount(0);\n-                    return true;\n+    /**\n+     * Looks for a {@link ItemPickaxe} to mine a block of {@code requiredLevel},\n+     * in the given {@link ICapabilityProvider}.\n+     *\n+     * @param provider      {@link ICapabilityProvider} to check in.\n+     * @param requiredLevel The minimal required {@link ItemPickaxe} level\n+     * @return True if the {@link ICapabilityProvider} contains a {@link\n+     * ItemPickaxe} with the given minimal required level.\n+     */\n+    public static boolean isPickaxeInProvider(ICapabilityProvider provider, final int requiredLevel)\n+    {\n+        return hasItemInProvider(provider, (ItemStack stack) -> Utils.checkIfPickaxeQualifies(requiredLevel, Utils.getMiningLevel(stack, Utils.PICKAXE)));\n+    }\n+\n+    /**\n+     * Looks for a {@link ItemPickaxe} to mine a block of {@code requiredLevel},\n+     * in the given {@link ICapabilityProvider}. The {@link ItemPickaxe} tool\n+     * level cannot exceed the given {@code maximalLevel}.\n+     *\n+     * @param provider      {@link ICapabilityProvider} to check in.\n+     * @param requiredLevel The minimal required {@link ItemPickaxe} level\n+     * @param maximalLevel  The maximal tool level of the {@link ItemPickaxe}\n+     * @return True if the {@link ICapabilityProvider} contains a {@link\n+     * ItemPickaxe} with the given minimal required level.\n+     */\n+    public static boolean isPickaxeInProvider(ICapabilityProvider provider, final int requiredLevel, final int maximalLevel)\n+    {\n+        return hasItemInProvider(provider, (ItemStack stack) -> Utils.checkIfPickaxeQualifies(requiredLevel, Utils.getMiningLevel(stack, Utils.PICKAXE))\n+                                                                  && InventoryUtils.hasToolLevel(stack, Utils.PICKAXE, maximalLevel));\n+    }\n+\n+    /**\n+     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#addItemStackToInventory(ItemStack)}.\n+     *\n+     * @param provider  {@link ICapabilityProvider} to add itemstack to.\n+     * @param itemStack ItemStack to add.\n+     * @return True if successful, otherwise false.\n+     */\n+    public static boolean addItemStackToProvider(@NotNull final ICapabilityProvider provider, @Nullable ItemStack itemStack)\n+    {\n+        return getItemHandlersFromProvider(provider).stream().anyMatch(handler -> addItemStackToItemHandler(handler, itemStack));\n+    }\n+\n+    /**\n+     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#addItemStackToInventory(ItemStack)}.\n+     *\n+     * @param provider  {@link ICapabilityProvider} to add itemstack to.\n+     * @param itemStack ItemStack to add.\n+     * @return True if successful, otherwise false.\n+     */\n+    public static ItemStack addItemStackToProviderWithResult(@NotNull final ICapabilityProvider provider, @Nullable ItemStack itemStack)\n+    {\n+        ItemStack activeStack = itemStack;\n+\n+        if (isItemStackEmpty(activeStack))\n+        {\n+            return EMPTY;\n+        }\n+\n+        for (IItemHandler handler : getItemHandlersFromProvider(provider))\n+        {\n+            activeStack = addItemStackToItemHandlerWithResult(handler, activeStack);\n+        }\n+\n+        return activeStack;\n+    }\n+\n+    /**\n+     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#addItemStackToInventory(ItemStack)}.\n+     *\n+     * @param itemHandler {@link IItemHandler} to add itemstack to.\n+     * @param itemStack   ItemStack to add.\n+     * @return True if successful, otherwise false.\n+     */\n+    public static ItemStack addItemStackToItemHandlerWithResult(@NotNull final IItemHandler itemHandler, @Nullable ItemStack itemStack)\n+    {\n+        if (!isItemStackEmpty(itemStack))\n+        {\n+            int slot;\n+\n+            if (itemStack.isItemDamaged())\n+            {\n+                slot = getFirstOpenSlotFromItemHandler(itemHandler);\n+\n+                if (slot >= 0)\n+                {\n+                    itemHandler.insertItem(slot, itemStack, false);\n+                    return EMPTY;\n                 }\n                 else\n                 {\n-                    return false;\n+                    return itemStack;\n                 }\n             }\n             else\n             {\n-                do\n+                ItemStack resultStack = itemStack;\n+                slot = itemHandler.getSlots() == 0 ? -1 : 0;\n+                while (!isItemStackEmpty(resultStack) && slot != -1 && slot != itemHandler.getSlots())\n                 {\n-                    stackSize = itemStack.getCount();\n-                    itemStack.setCount(storePartialItemStack(inventory, itemStack));\n+                    resultStack = itemHandler.insertItem(slot, resultStack, false);\n+                    if (!isItemStackEmpty(resultStack))\n+                    {\n+                        slot++;\n+                    }\n                 }\n-                while (itemStack.getCount() > 0 && itemStack.getCount() < stackSize);\n-\n \n-                return itemStack.getCount() < stackSize;\n+                return resultStack;\n             }\n         }\n         else\n         {\n+            return itemStack;\n+        }\n+    }\n+\n+    /**\n+     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#addItemStackToInventory(ItemStack)}.\n+     *\n+     * @param provider                 {@link ICapabilityProvider} to add\n+     *                                 itemstack to.\n+     * @param itemStack                ItemStack to add.\n+     * @param itemStackToKeepPredicate The {@link Predicate} that determines\n+     *                                 which ItemStacks to keep in the\n+     *                                 inventory. Return false to replace.\n+     * @return itemStack which has been replaced.\n+     */\n+    @Nullable\n+    public static ItemStack forceItemStackToProvider(\n+                                                      @NotNull final ICapabilityProvider provider,\n+                                                      @NotNull final ItemStack itemStack,\n+                                                      @NotNull final Predicate<ItemStack> itemStackToKeepPredicate)\n+    {\n+        if (!addItemStackToProvider(provider, itemStack))\n+        {\n+            return getItemHandlersFromProvider(provider).stream()\n+                     .map(handler -> forceItemStackToItemHandler(handler, itemStack, itemStackToKeepPredicate))\n+                     .filter(Objects::nonNull)\n+                     .findFirst()\n+                     .orElse(EMPTY);\n+        }\n+\n+        return EMPTY;\n+    }\n+\n+    /**\n+     * Returns the amount of item stacks in an inventory. This equals {@link\n+     * #getProviderAsList(ICapabilityProvider)}<code>.length();</code>.\n+     *\n+     * @param provider {@link ICapabilityProvider} to count item stacks of.\n+     * @return Amount of item stacks in the {@link ICapabilityProvider}.\n+     */\n+    public static int getAmountOfStacksInProvider(@NotNull final ICapabilityProvider provider)\n+    {\n+        return getProviderAsList(provider).size();\n+    }\n+\n+    /**\n+     * Returns an {@link ICapabilityProvider} as list of item stacks.\n+     *\n+     * @param provider provider to convert.\n+     * @return List of item stacks.\n+     */\n+    @NotNull\n+    public static List<ItemStack> getProviderAsList(@NotNull final ICapabilityProvider provider)\n+    {\n+        return filterProvider(provider, (ItemStack stack) -> true);\n+    }\n+\n+    /**\n+     * Method used to check if a {@link ICapabilityProvider} has any {@link\n+     * IItemHandler}\n+     *\n+     * @param provider The provider to check.\n+     * @return True when the provider has any {@link IItemHandler}, false when\n+     * not.\n+     */\n+    @NotNull\n+    public static boolean hasProviderIItemHandler(@NotNull ICapabilityProvider provider)\n+    {\n+        return !getItemHandlersFromProvider(provider).isEmpty();\n+    }\n+\n+    /**\n+     * Method used to check if this provider is sided.\n+     *\n+     * @param provider The provider to check for.\n+     * @return True when the provider has multiple distinct IItemHandler of\n+     * different sides (sidedness {@link TileEntityFurnace#hasCapability(Capability,\n+     * EnumFacing)}), false when not {@link TileEntityChest#hasCapability(Capability,\n+     * EnumFacing)}\n+     */\n+    @NotNull\n+    public static boolean isProviderSided(@NotNull ICapabilityProvider provider)\n+    {\n+        return getItemHandlersFromProvider(provider).size() > 1;\n+    }\n+\n+    /**\n+     * Returns an {@link IItemHandler} as list of item stacks.\n+     *\n+     * @param provider The {@link ICapabilityProvider} that holds the {@link\n+     *                 IItemHandler} for the given {@link EnumFacing}\n+     * @param facing   The facing to get the {@link IItemHandler} from. Can be\n+     *                 null for the internal one {@link ICapabilityProvider#hasCapability(Capability,\n+     *                 EnumFacing)}\n+     * @return List of item stacks.\n+     */\n+    @NotNull\n+    public static List<ItemStack> getInventoryAsListFromProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing)\n+    {\n+        return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing), (ItemStack stack) -> true);\n+    }\n+\n+    /**\n+     * Filters a list of items, matches the stack using {@link\n+     * #compareItems(ItemStack, Item, int)}, in an {@link IItemHandler}. Uses\n+     * the MetaData and {@link #getItemFromBlock(Block)} as parameters for the\n+     * Predicate.\n+     *\n+     * @param provider The {@link ICapabilityProvider} that holds the {@link\n+     *                 IItemHandler} for the given {@link EnumFacing}\n+     * @param facing   The facing to get the {@link IItemHandler} from. Can be\n+     *                 null for the internal one {@link ICapabilityProvider#hasCapability(Capability,\n+     *                 EnumFacing)}\n+     * @param block    Block to filter\n+     * @param metaData the damage value.\n+     * @return List of item stacks\n+     */\n+    @NotNull\n+    public static List<ItemStack> filterItemHandlerFromProviderForSide(\n+                                                                        @NotNull final ICapabilityProvider provider,\n+                                                                        @Nullable EnumFacing facing,\n+                                                                        @NotNull final Block block,\n+                                                                        int metaData)\n+    {\n+        return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing), (ItemStack stack) -> compareItems(stack, getItemFromBlock(block), metaData));\n+    }\n+\n+    /**\n+     * Filters a list of items, matches the stack using {@link\n+     * #compareItems(ItemStack, Item, int)}, with targetItem and itemDamage as\n+     * parameters, in an {@link IItemHandler}.\n+     *\n+     * @param provider   The {@link ICapabilityProvider} that holds the {@link\n+     *                   IItemHandler} for the given {@link EnumFacing}\n+     * @param facing     The facing to get the {@link IItemHandler} from. Can be\n+     *                   null for the internal one {@link ICapabilityProvider#hasCapability(Capability,\n+     *                   EnumFacing)}\n+     * @param targetItem Item to look for\n+     * @param itemDamage the damage value.\n+     * @return List of item stacks with the given item in inventory\n+     */\n+    @NotNull\n+    public static List<ItemStack> filterItemHandlerFromProviderForSide(\n+                                                                        @NotNull final ICapabilityProvider provider,\n+                                                                        @Nullable EnumFacing facing,\n+                                                                        @NotNull final Item targetItem,\n+                                                                        int itemDamage)\n+    {\n+        return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing), (ItemStack stack) -> compareItems(stack, targetItem, itemDamage));\n+    }\n+\n+    /**\n+     * Filters a list of items, that match the given predicate, in an {@link\n+     * IItemHandler}.\n+     *\n+     * @param provider                    The {@link ICapabilityProvider} that\n+     *                                    holds the {@link IItemHandler} for the\n+     *                                    given {@link EnumFacing}\n+     * @param facing                      The facing to get the {@link\n+     *                                    IItemHandler} from. Can be null for\n+     *                                    the internal one {@link ICapabilityProvider#hasCapability(Capability,\n+     *                                    EnumFacing)}\n+     * @param itemStackSelectionPredicate The predicate to match the stack to.\n+     * @return List of item stacks that match the given predicate.\n+     */\n+    @NotNull\n+    public static List<ItemStack> filterItemHandlerFromProviderForSide(\n+                                                                        @NotNull final ICapabilityProvider provider,\n+                                                                        @Nullable EnumFacing facing,\n+                                                                        @NotNull final Predicate<ItemStack> itemStackSelectionPredicate)\n+    {\n+        if (!provider.hasCapability(ITEM_HANDLER_CAPABILITY, facing))\n+        {\n+            return Collections.EMPTY_LIST;\n+        }\n+\n+        return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing), itemStackSelectionPredicate);\n+    }\n+\n+    /**\n+     * Returns the index of the first occurrence of the block in the {@link\n+     * ICapabilityProvider} for a given {@link EnumFacing}.\n+     *\n+     * @param provider   {@link ICapabilityProvider} to check.\n+     * @param facing     The facing to check for.\n+     * @param block      Block to find.\n+     * @param itemDamage the damage value.\n+     * @return Index of the first occurrence.\n+     */\n+    public static int findFirstSlotInProviderForSideWith(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing, @NotNull final Block block, int itemDamage)\n+    {\n+        return findFirstSlotInProviderForSideWith(provider, facing, getItemFromBlock(block), itemDamage);\n+    }\n+\n+    /**\n+     * Returns the index of the first occurrence of the Item with the given\n+     * ItemDamage in the {@link ICapabilityProvider} for a given {@link\n+     * EnumFacing}.\n+     *\n+     * @param provider   {@link ICapabilityProvider} to check\n+     * @param facing     The facing to check for.\n+     * @param targetItem Item to find.\n+     * @param itemDamage The damage value to match on the stack.\n+     * @return Index of the first occurrence\n+     */\n+    public static int findFirstSlotInProviderForSideWith(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing, @NotNull final Item targetItem, int itemDamage)\n+    {\n+        return findFirstSlotInProviderForSideWith(provider, facing, (ItemStack stack) -> compareItems(stack, targetItem, itemDamage));\n+    }\n+\n+    /**\n+     * Returns the index of the first occurrence of an ItemStack that matches\n+     * the given predicate in the {@link ICapabilityProvider} for a given {@link\n+     * EnumFacing}.\n+     *\n+     * @param provider                    Provider to check\n+     * @param facing                      The facing to check for.\n+     * @param itemStackSelectionPredicate The predicate to match.\n+     * @return Index of the first occurrence\n+     */\n+    public static int findFirstSlotInProviderForSideWith(\n+                                                          @NotNull final ICapabilityProvider provider,\n+                                                          @Nullable EnumFacing facing,\n+                                                          @NotNull final Predicate<ItemStack> itemStackSelectionPredicate)\n+    {\n+        if (!provider.hasCapability(ITEM_HANDLER_CAPABILITY, facing))\n+        {\n+            return -1;\n+            //TODO: Later harden contract to remove compare on slot := -1\n+            //throw new IllegalStateException(\"Item \"+targetItem.getUnlocalizedName() + \" not found in ItemHandler!\");\n+        }\n+\n+        return findFirstSlotInItemHandlerWith(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing), itemStackSelectionPredicate);\n+    }\n+\n+    /**\n+     * Returns the amount of occurrences in the {@link ICapabilityProvider} for\n+     * a given {@link EnumFacing}.\n+     *\n+     * @param provider   {@link ICapabilityProvider} to scan.\n+     * @param facing     The facing to count in.\n+     * @param block      The block to count\n+     * @param itemDamage the damage value\n+     * @return Amount of occurrences of stacks that match the given block and\n+     * ItemDamage\n+     */\n+    public static int getItemCountInProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing, @NotNull final Block block, int itemDamage)\n+    {\n+        return getItemCountInProviderForSide(provider, facing, getItemFromBlock(block), itemDamage);\n+    }\n+\n+    /**\n+     * Returns the amount of occurrences in the {@link ICapabilityProvider} for\n+     * a given {@link EnumFacing}.\n+     *\n+     * @param provider   {@link ICapabilityProvider} to scan.\n+     * @param facing     The facing to count in.\n+     * @param targetItem Item to count\n+     * @param itemDamage the item damage value.\n+     * @return Amount of occurrences of stacks that match the given item and\n+     * ItemDamage\n+     */\n+    public static int getItemCountInProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing, @NotNull final Item targetItem, int itemDamage)\n+    {\n+        return getItemCountInProviderForSide(provider, facing, (ItemStack stack) -> compareItems(stack, targetItem, itemDamage));\n+    }\n+\n+    /**\n+     * Returns the amount of occurrences in the {@link ICapabilityProvider} for\n+     * a given {@link EnumFacing}.\n+     *\n+     * @param provider                    {@link ICapabilityProvider} to scan.\n+     * @param facing                      The facing to count in.\n+     * @param itemStackSelectionPredicate The predicate used to select the\n+     *                                    stacks to count.\n+     * @return Amount of occurrences of stacks that match the given predicate.\n+     */\n+    public static int getItemCountInProviderForSide(\n+                                                     @NotNull final ICapabilityProvider provider,\n+                                                     @Nullable EnumFacing facing,\n+                                                     @NotNull final Predicate<ItemStack> itemStackSelectionPredicate)\n+    {\n+        if (!provider.hasCapability(ITEM_HANDLER_CAPABILITY, facing))\n+        {\n+            return 0;\n+        }\n+\n+        return filterItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing), itemStackSelectionPredicate).stream().mapToInt(InventoryUtils::getItemStackSize).sum();\n+    }\n+\n+    /**\n+     * Checks if a player has a block in the {@link ICapabilityProvider}, for a\n+     * given {@link EnumFacing}. Checked by {@link #getItemCountInProvider(ICapabilityProvider,\n+     * Block, int)} &gt; 0;\n+     *\n+     * @param provider   {@link ICapabilityProvider} to scan\n+     * @param facing     The side to check for.\n+     * @param block      Block to count\n+     * @param itemDamage the damage value.\n+     * @return True when in {@link ICapabilityProvider}, otherwise false\n+     */\n+    public static boolean hasItemInProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing, @NotNull final Block block, int itemDamage)\n+    {\n+        return hasItemInProviderForSide(provider, facing, getItemFromBlock(block), itemDamage);\n+    }\n+\n+    /**\n+     * Checks if a player has an item in the {@link ICapabilityProvider}, for a\n+     * given {@link EnumFacing}. Checked by {@link #getItemCountInProvider(ICapabilityProvider,\n+     * Item, int)} &gt; 0;\n+     *\n+     * @param provider   {@link ICapabilityProvider} to scan\n+     * @param facing     The side to check for.\n+     * @param item       Item to count\n+     * @param itemDamage the damage value of the item.\n+     * @return True when in {@link ICapabilityProvider}, otherwise false\n+     */\n+    public static boolean hasItemInProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing, @NotNull final Item item, int itemDamage)\n+    {\n+        return hasItemInProviderForSide(provider, facing, (ItemStack stack) -> compareItems(stack, item, itemDamage));\n+    }\n+\n+    /**\n+     * Checks if a player has an item in the {@link ICapabilityProvider}, for a\n+     * given {@link EnumFacing}. Checked by {@link InventoryUtils#getItemCountInProvider(ICapabilityProvider,\n+     * Predicate)} &gt; 0;\n+     *\n+     * @param provider                    {@link ICapabilityProvider} to scan\n+     * @param facing                      The side to check for.\n+     * @param itemStackSelectionPredicate The predicate to match the ItemStack\n+     *                                    to.\n+     * @return True when in {@link ICapabilityProvider}, otherwise false\n+     */\n+    public static boolean hasItemInProviderForSide(\n+                                                    @NotNull final ICapabilityProvider provider,\n+                                                    @Nullable EnumFacing facing,\n+                                                    @NotNull final Predicate<ItemStack> itemStackSelectionPredicate)\n+    {\n+        if (!provider.hasCapability(ITEM_HANDLER_CAPABILITY, facing))\n+        {\n             return false;\n         }\n+\n+        return getItemCountInItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing), itemStackSelectionPredicate) > 0;\n     }\n \n     /**\n-     * Adapted from {@link net.minecraft.entity.player.InventoryPlayer#storePartialItemStack(ItemStack)}.\n-     * <p>\n-     * This function stores as many items of an ItemStack as possible in a matching slot and returns the quantity of\n-     * left over items.\n+     * Returns if the {@link ICapabilityProvider} is full, for a given {@link\n+     * EnumFacing}.\n      *\n-     * @param inventory Inventory to add stack to.\n-     * @param itemStack Item stack to store in inventory.\n-     * @return Leftover items in itemstack.\n+     * @param provider The {@link ICapabilityProvider}.\n+     * @param facing   The side to check for.\n+     * @return True if the {@link ICapabilityProvider} is full, false when not.\n      */\n-    private static int storePartialItemStack(@NotNull final IInventory inventory, @NotNull final ItemStack itemStack)\n+    public static boolean isProviderFull(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing)\n     {\n-        final Item item = itemStack.getItem();\n-        int stackSize = itemStack.getCount();\n-        int slot;\n+        return getFirstOpenSlotFromProviderForSide(provider, facing) == -1;\n+    }\n \n-        if (itemStack.getMaxStackSize() == 1)\n+    /**\n+     * Returns the first open slot in the {@link ICapabilityProvider}, for a\n+     * given {@link EnumFacing}.\n+     *\n+     * @param provider The {@link ICapabilityProvider} to check.\n+     * @param facing   The side to check for.\n+     * @return slot index or -1 if none found.\n+     */\n+    public static int getFirstOpenSlotFromProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing)\n+    {\n+        if (!provider.hasCapability(ITEM_HANDLER_CAPABILITY, facing))\n         {\n-            slot = getOpenSlot(inventory);\n+            return -1;\n+        }\n \n-            if (slot < 0)\n-            {\n-                return stackSize;\n-            }\n-            else\n-            {\n-                final ItemStack stack = inventory.getStackInSlot(slot);\n-                if (stack == null || stack == ItemStack.EMPTY || stack.getCount() == 0)\n-                {\n-                    inventory.setInventorySlotContents(slot, itemStack.copy());\n-                }\n+        return getFirstOpenSlotFromItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing));\n+    }\n \n-                return 0;\n-            }\n+    /**\n+     * Checks if the {@link ICapabilityProvider} contains the following toolName\n+     * with the given minimal Level, for a given {@link EnumFacing}.\n+     *\n+     * @param provider     The {@link ICapabilityProvider} to scan.\n+     * @param facing       The side to check for.\n+     * @param toolTypeName The toolTypeName of the tool to find.\n+     * @param minimalLevel The minimal level to find.\n+     * @return True if a Tool with the given toolTypeName was found in the given\n+     * {@link ICapabilityProvider}, false when not.\n+     */\n+    public static boolean isToolInProviderForSide(@NotNull final ICapabilityProvider provider, @Nullable EnumFacing facing, @NotNull final String toolTypeName, int minimalLevel)\n+    {\n+        if (!provider.hasCapability(ITEM_HANDLER_CAPABILITY, facing))\n+        {\n+            return false;\n         }\n-        else\n+\n+        return isToolInItemHandler(provider.getCapability(ITEM_HANDLER_CAPABILITY, facing), toolTypeName, minimalLevel);\n+    }\n+\n+    /**\n+     * Checks if the {@link IItemHandler} contains the following toolName with\n+     * the given minimal Level.\n+     *\n+     * @param itemHandler  The {@link IItemHandler} to scan.\n+     * @param toolTypeName The toolTypeName of the tool to find.\n+     * @param minimalLevel The minimal level to find.\n+     * @return True if a Tool with the given toolTypeName was found in the given\n+     * {@link IItemHandler}, false when not.\n+     */\n+    public static boolean isToolInItemHandler(@NotNull final IItemHandler itemHandler, @NotNull final String toolTypeName, int minimalLevel)\n+    {\n+        return hasItemInItemHandler(itemHandler, (ItemStack stack) -> Utils.isTool(stack, toolTypeName) && InventoryUtils.hasToolLevel(stack, toolTypeName, minimalLevel));\n+    }\n+\n+    /**\n+     * Clears an entire {@link IItemHandler}.\n+     *\n+     * @param itemHandler {@link IItemHandler} to clear.\n+     */\n+    public static void clearItemHandler(@NotNull final IItemHandler itemHandler)\n+    {\n+        for (int slotIndex = 0; slotIndex < itemHandler.getSlots(); slotIndex++)\n         {\n-            slot = findSlotForItemStack(inventory, itemStack);\n+            itemHandler.extractItem(slotIndex, Integer.MAX_VALUE, false);\n+        }\n+    }\n+\n+    /**\n+     * Returns a slot number if an {@link IItemHandler} contains given tool\n+     * type.\n+     *\n+     * @param itemHandler the {@link IItemHandler} to get the slot from.\n+     * @param tool        the tool type to look for.\n+     * @return slot number if found, -1 if not found.\n+     */\n+    public static int getFirstSlotOfItemHandlerContainingTool(@NotNull final IItemHandler itemHandler, @NotNull final String tool)\n+    {\n+        return findFirstSlotInItemHandlerWith(itemHandler,\n+          (ItemStack stack) -> (!isItemStackEmpty(stack) && (stack.getItem().getToolClasses(stack).contains(tool) || (\"hoe\".equals(tool) && stack.getUnlocalizedName()\n+                                                                                                                                              .contains(\"hoe\"))\n+                                                               || (\"rod\".equals(tool) && stack.getUnlocalizedName().contains(\"fishingRod\")))));\n+    }\n+\n+    /**\n+     * Verifies if there is one tool with an acceptable level\n+     * in a worker's inventory.\n+     *\n+     * @param toolTypeName  the type of tool needed\n+     * @param itemHandler   the worker's inventory\n+     * @param requiredLevel the worker's hut level\n+     * @return true if tool is acceptable\n+     */\n+    public static boolean hasItemHandlerToolWithLevel(@NotNull final IItemHandler itemHandler, final String toolTypeName, final int requiredLevel)\n+    {\n+        return findFirstSlotInItemHandlerWith(itemHandler,\n+          (ItemStack stack) -> (!isItemStackEmpty(stack) && (Utils.isTool(stack, toolTypeName) && verifyToolLevel(stack,\n+            Utils.getMiningLevel(stack, toolTypeName),\n+            requiredLevel)))) > -1;\n+    }\n \n-            if (slot < 0)\n+    /**\n+     * Method to swap the ItemStacks from the given source {@link IItemHandler}\n+     * to the given target {@link ICapabilityProvider}.\n+     *\n+     * @param sourceHandler  The {@link IItemHandler} that works as Source.\n+     * @param sourceIndex    The index of the slot that is being extracted\n+     *                       from.\n+     * @param targetProvider The {@link ICapabilityProvider} that works as\n+     *                       Target.\n+     * @return True when the swap was successful, false when not.\n+     */\n+    public static boolean transferItemStackIntoNextFreeSlotInProvider(\n+                                                                       @NotNull final IItemHandler sourceHandler,\n+                                                                       @NotNull int sourceIndex,\n+                                                                       @NotNull ICapabilityProvider targetProvider)\n+    {\n+        for (IItemHandler handler : getItemHandlersFromProvider(targetProvider))\n+        {\n+            if (transferItemStackIntoNextFreeSlotInItemHandlers(sourceHandler, sourceIndex, handler))\n             {\n-                slot = getOpenSlot(inventory);\n+                return true;\n             }\n+        }\n \n-            if (slot < 0)\n+        return false;\n+    }\n+\n+    /**\n+     * Method to swap the ItemStacks from the given source {@link IItemHandler}\n+     * to the given target {@link IItemHandler}.\n+     *\n+     * @param sourceHandler The {@link IItemHandler} that works as Source.\n+     * @param sourceIndex   The index of the slot that is being extracted from.\n+     * @param targetHandler The {@link IItemHandler} that works as Target.\n+     * @return True when the swap was successful, false when not.\n+     */\n+    public static boolean transferItemStackIntoNextFreeSlotInItemHandlers(@NotNull final IItemHandler sourceHandler, @NotNull int sourceIndex, @NotNull IItemHandler targetHandler)\n+    {\n+        ItemStack sourceStack = sourceHandler.extractItem(sourceIndex, Integer.MAX_VALUE, true);\n+        final ItemStack originalStack = sourceStack.copy();\n+\n+        for (int i = 0; i < targetHandler.getSlots(); i++)\n+        {\n+            sourceStack = targetHandler.insertItem(i, sourceStack, false);\n+            if (isItemStackEmpty(sourceStack))\n             {\n-                return stackSize;\n+                sourceHandler.extractItem(sourceIndex, Integer.MAX_VALUE, false);\n+                return true;\n             }\n-            else\n+        }\n+\n+        if (!ItemStack.areItemStacksEqual(sourceStack, originalStack) && compareItemStacksIgnoreStackSize(sourceStack, originalStack))\n+        {\n+            int usedAmount = getItemStackSize(sourceStack) - getItemStackSize(originalStack);\n+            sourceHandler.extractItem(sourceIndex, usedAmount, false);\n+            return true;\n+        }\n+\n+        return false;\n+    }\n+\n+    /**\n+     * Method to compare to stacks, ignoring their stacksize.\n+     *\n+     * @param itemStack1 The left stack to compare.\n+     * @param itemStack2 The ri","path":"src/main/java/com/minecolonies/coremod/util/InventoryUtils.java","position":null,"original_position":1915,"commit_id":"b335177c72aea3a7148717a76f2bcfea721ff5b9","original_commit_id":"b335177c72aea3a7148717a76f2bcfea721ff5b9","user":{"login":"MinecoloniesSonar","id":19393044,"avatar_url":"https://avatars0.githubusercontent.com/u/19393044?v=3","gravatar_id":"","url":"https://api.github.com/users/MinecoloniesSonar","html_url":"https://github.com/MinecoloniesSonar","followers_url":"https://api.github.com/users/MinecoloniesSonar/followers","following_url":"https://api.github.com/users/MinecoloniesSonar/following{/other_user}","gists_url":"https://api.github.com/users/MinecoloniesSonar/gists{/gist_id}","starred_url":"https://api.github.com/users/MinecoloniesSonar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MinecoloniesSonar/subscriptions","organizations_url":"https://api.github.com/users/MinecoloniesSonar/orgs","repos_url":"https://api.github.com/users/MinecoloniesSonar/repos","events_url":"https://api.github.com/users/MinecoloniesSonar/events{/privacy}","received_events_url":"https://api.github.com/users/MinecoloniesSonar/received_events","type":"User","site_admin":false},"body":"![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR') Merge this if statement with the enclosing one. [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonar.minecolonies.com/coding_rules#rule_key=squid%3AS1066)\n![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR') NullPointerException might be thrown as 'itemStack2' is nullable here [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonar.minecolonies.com/coding_rules#rule_key=squid%3AS2259)\n![MAJOR](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/severity-major.png 'Severity: MAJOR') NullPointerException might be thrown as 'itemStack1' is nullable here [![rule](https://raw.githubusercontent.com/SonarCommunity/sonar-github/master/images/rule.png)](https://sonar.minecolonies.com/coding_rules#rule_key=squid%3AS2259)\n","created_at":"2017-04-18T10:26:04Z","updated_at":"2017-04-18T10:26:04Z","html_url":"https://github.com/Minecolonies/minecolonies/pull/818#discussion_r111920199","pull_request_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/818","_links":{"self":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments/111920199"},"html":{"href":"https://github.com/Minecolonies/minecolonies/pull/818#discussion_r111920199"},"pull_request":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/818"}}},"pull_request":{"url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/818","id":116064542,"html_url":"https://github.com/Minecolonies/minecolonies/pull/818","diff_url":"https://github.com/Minecolonies/minecolonies/pull/818.diff","patch_url":"https://github.com/Minecolonies/minecolonies/pull/818.patch","issue_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/818","number":818,"state":"open","locked":false,"title":"Port/1.11/cap inventory interaction","user":{"login":"OrionDevelopment","id":5585406,"avatar_url":"https://avatars1.githubusercontent.com/u/5585406?v=3","gravatar_id":"","url":"https://api.github.com/users/OrionDevelopment","html_url":"https://github.com/OrionDevelopment","followers_url":"https://api.github.com/users/OrionDevelopment/followers","following_url":"https://api.github.com/users/OrionDevelopment/following{/other_user}","gists_url":"https://api.github.com/users/OrionDevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/OrionDevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrionDevelopment/subscriptions","organizations_url":"https://api.github.com/users/OrionDevelopment/orgs","repos_url":"https://api.github.com/users/OrionDevelopment/repos","events_url":"https://api.github.com/users/OrionDevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/OrionDevelopment/received_events","type":"User","site_admin":false},"body":"# Changes proposed in this pull request:\r\n- Updated the Cap interaction system to 1.11\r\n- Added TeamCity integration to all 1.11 Branches\r\n- Formatting\r\n\r\nReview please\r\n","created_at":"2017-04-16T17:07:31Z","updated_at":"2017-04-18T10:26:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2145240c83d1e7ed29fd3675bca572975dc839d8","assignee":{"login":"OrionDevelopment","id":5585406,"avatar_url":"https://avatars1.githubusercontent.com/u/5585406?v=3","gravatar_id":"","url":"https://api.github.com/users/OrionDevelopment","html_url":"https://github.com/OrionDevelopment","followers_url":"https://api.github.com/users/OrionDevelopment/followers","following_url":"https://api.github.com/users/OrionDevelopment/following{/other_user}","gists_url":"https://api.github.com/users/OrionDevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/OrionDevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrionDevelopment/subscriptions","organizations_url":"https://api.github.com/users/OrionDevelopment/orgs","repos_url":"https://api.github.com/users/OrionDevelopment/repos","events_url":"https://api.github.com/users/OrionDevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/OrionDevelopment/received_events","type":"User","site_admin":false},"assignees":[{"login":"OrionDevelopment","id":5585406,"avatar_url":"https://avatars1.githubusercontent.com/u/5585406?v=3","gravatar_id":"","url":"https://api.github.com/users/OrionDevelopment","html_url":"https://github.com/OrionDevelopment","followers_url":"https://api.github.com/users/OrionDevelopment/followers","following_url":"https://api.github.com/users/OrionDevelopment/following{/other_user}","gists_url":"https://api.github.com/users/OrionDevelopment/gists{/gist_id}","starred_url":"https://api.github.com/users/OrionDevelopment/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OrionDevelopment/subscriptions","organizations_url":"https://api.github.com/users/OrionDevelopment/orgs","repos_url":"https://api.github.com/users/OrionDevelopment/repos","events_url":"https://api.github.com/users/OrionDevelopment/events{/privacy}","received_events_url":"https://api.github.com/users/OrionDevelopment/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/818/commits","review_comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/818/comments","review_comment_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/818/comments","statuses_url":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/b335177c72aea3a7148717a76f2bcfea721ff5b9","head":{"label":"Minecolonies:port/1.11/Cap-Inventory-Interaction","ref":"port/1.11/Cap-Inventory-Interaction","sha":"b335177c72aea3a7148717a76f2bcfea721ff5b9","user":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars0.githubusercontent.com/u/5167336?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecolonies","html_url":"https://github.com/Minecolonies","followers_url":"https://api.github.com/users/Minecolonies/followers","following_url":"https://api.github.com/users/Minecolonies/following{/other_user}","gists_url":"https://api.github.com/users/Minecolonies/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecolonies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecolonies/subscriptions","organizations_url":"https://api.github.com/users/Minecolonies/orgs","repos_url":"https://api.github.com/users/Minecolonies/repos","events_url":"https://api.github.com/users/Minecolonies/events{/privacy}","received_events_url":"https://api.github.com/users/Minecolonies/received_events","type":"Organization","site_admin":false},"repo":{"id":65616760,"name":"minecolonies","full_name":"Minecolonies/minecolonies","owner":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars0.githubusercontent.com/u/5167336?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecolonies","html_url":"https://github.com/Minecolonies","followers_url":"https://api.github.com/users/Minecolonies/followers","following_url":"https://api.github.com/users/Minecolonies/following{/other_user}","gists_url":"https://api.github.com/users/Minecolonies/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecolonies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecolonies/subscriptions","organizations_url":"https://api.github.com/users/Minecolonies/orgs","repos_url":"https://api.github.com/users/Minecolonies/repos","events_url":"https://api.github.com/users/Minecolonies/events{/privacy}","received_events_url":"https://api.github.com/users/Minecolonies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Minecolonies/minecolonies","description":"Minecolonies minecraft mod","fork":false,"url":"https://api.github.com/repos/Minecolonies/minecolonies","forks_url":"https://api.github.com/repos/Minecolonies/minecolonies/forks","keys_url":"https://api.github.com/repos/Minecolonies/minecolonies/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Minecolonies/minecolonies/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Minecolonies/minecolonies/teams","hooks_url":"https://api.github.com/repos/Minecolonies/minecolonies/hooks","issue_events_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/events{/number}","events_url":"https://api.github.com/repos/Minecolonies/minecolonies/events","assignees_url":"https://api.github.com/repos/Minecolonies/minecolonies/assignees{/user}","branches_url":"https://api.github.com/repos/Minecolonies/minecolonies/branches{/branch}","tags_url":"https://api.github.com/repos/Minecolonies/minecolonies/tags","blobs_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/refs{/sha}","trees_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/{sha}","languages_url":"https://api.github.com/repos/Minecolonies/minecolonies/languages","stargazers_url":"https://api.github.com/repos/Minecolonies/minecolonies/stargazers","contributors_url":"https://api.github.com/repos/Minecolonies/minecolonies/contributors","subscribers_url":"https://api.github.com/repos/Minecolonies/minecolonies/subscribers","subscription_url":"https://api.github.com/repos/Minecolonies/minecolonies/subscription","commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/commits{/sha}","git_commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/commits{/sha}","comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/comments{/number}","issue_comment_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/comments{/number}","contents_url":"https://api.github.com/repos/Minecolonies/minecolonies/contents/{+path}","compare_url":"https://api.github.com/repos/Minecolonies/minecolonies/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Minecolonies/minecolonies/merges","archive_url":"https://api.github.com/repos/Minecolonies/minecolonies/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Minecolonies/minecolonies/downloads","issues_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues{/number}","pulls_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls{/number}","milestones_url":"https://api.github.com/repos/Minecolonies/minecolonies/milestones{/number}","notifications_url":"https://api.github.com/repos/Minecolonies/minecolonies/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Minecolonies/minecolonies/labels{/name}","releases_url":"https://api.github.com/repos/Minecolonies/minecolonies/releases{/id}","deployments_url":"https://api.github.com/repos/Minecolonies/minecolonies/deployments","created_at":"2016-08-13T12:45:38Z","updated_at":"2017-04-16T18:23:41Z","pushed_at":"2017-04-18T10:19:20Z","git_url":"git://github.com/Minecolonies/minecolonies.git","ssh_url":"git@github.com:Minecolonies/minecolonies.git","clone_url":"https://github.com/Minecolonies/minecolonies.git","svn_url":"https://github.com/Minecolonies/minecolonies","homepage":"http://minecolonies.com/","size":14372,"stargazers_count":30,"watchers_count":30,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":127,"forks":33,"open_issues":127,"watchers":30,"default_branch":"develop"}},"base":{"label":"Minecolonies:version/1.11","ref":"version/1.11","sha":"0780a4c2031fd17c6618180b196dfe3d97ee16a2","user":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars0.githubusercontent.com/u/5167336?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecolonies","html_url":"https://github.com/Minecolonies","followers_url":"https://api.github.com/users/Minecolonies/followers","following_url":"https://api.github.com/users/Minecolonies/following{/other_user}","gists_url":"https://api.github.com/users/Minecolonies/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecolonies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecolonies/subscriptions","organizations_url":"https://api.github.com/users/Minecolonies/orgs","repos_url":"https://api.github.com/users/Minecolonies/repos","events_url":"https://api.github.com/users/Minecolonies/events{/privacy}","received_events_url":"https://api.github.com/users/Minecolonies/received_events","type":"Organization","site_admin":false},"repo":{"id":65616760,"name":"minecolonies","full_name":"Minecolonies/minecolonies","owner":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars0.githubusercontent.com/u/5167336?v=3","gravatar_id":"","url":"https://api.github.com/users/Minecolonies","html_url":"https://github.com/Minecolonies","followers_url":"https://api.github.com/users/Minecolonies/followers","following_url":"https://api.github.com/users/Minecolonies/following{/other_user}","gists_url":"https://api.github.com/users/Minecolonies/gists{/gist_id}","starred_url":"https://api.github.com/users/Minecolonies/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Minecolonies/subscriptions","organizations_url":"https://api.github.com/users/Minecolonies/orgs","repos_url":"https://api.github.com/users/Minecolonies/repos","events_url":"https://api.github.com/users/Minecolonies/events{/privacy}","received_events_url":"https://api.github.com/users/Minecolonies/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Minecolonies/minecolonies","description":"Minecolonies minecraft mod","fork":false,"url":"https://api.github.com/repos/Minecolonies/minecolonies","forks_url":"https://api.github.com/repos/Minecolonies/minecolonies/forks","keys_url":"https://api.github.com/repos/Minecolonies/minecolonies/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Minecolonies/minecolonies/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Minecolonies/minecolonies/teams","hooks_url":"https://api.github.com/repos/Minecolonies/minecolonies/hooks","issue_events_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/events{/number}","events_url":"https://api.github.com/repos/Minecolonies/minecolonies/events","assignees_url":"https://api.github.com/repos/Minecolonies/minecolonies/assignees{/user}","branches_url":"https://api.github.com/repos/Minecolonies/minecolonies/branches{/branch}","tags_url":"https://api.github.com/repos/Minecolonies/minecolonies/tags","blobs_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/refs{/sha}","trees_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/{sha}","languages_url":"https://api.github.com/repos/Minecolonies/minecolonies/languages","stargazers_url":"https://api.github.com/repos/Minecolonies/minecolonies/stargazers","contributors_url":"https://api.github.com/repos/Minecolonies/minecolonies/contributors","subscribers_url":"https://api.github.com/repos/Minecolonies/minecolonies/subscribers","subscription_url":"https://api.github.com/repos/Minecolonies/minecolonies/subscription","commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/commits{/sha}","git_commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/git/commits{/sha}","comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/comments{/number}","issue_comment_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/comments{/number}","contents_url":"https://api.github.com/repos/Minecolonies/minecolonies/contents/{+path}","compare_url":"https://api.github.com/repos/Minecolonies/minecolonies/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Minecolonies/minecolonies/merges","archive_url":"https://api.github.com/repos/Minecolonies/minecolonies/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Minecolonies/minecolonies/downloads","issues_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues{/number}","pulls_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls{/number}","milestones_url":"https://api.github.com/repos/Minecolonies/minecolonies/milestones{/number}","notifications_url":"https://api.github.com/repos/Minecolonies/minecolonies/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Minecolonies/minecolonies/labels{/name}","releases_url":"https://api.github.com/repos/Minecolonies/minecolonies/releases{/id}","deployments_url":"https://api.github.com/repos/Minecolonies/minecolonies/deployments","created_at":"2016-08-13T12:45:38Z","updated_at":"2017-04-16T18:23:41Z","pushed_at":"2017-04-18T10:19:20Z","git_url":"git://github.com/Minecolonies/minecolonies.git","ssh_url":"git@github.com:Minecolonies/minecolonies.git","clone_url":"https://github.com/Minecolonies/minecolonies.git","svn_url":"https://github.com/Minecolonies/minecolonies","homepage":"http://minecolonies.com/","size":14372,"stargazers_count":30,"watchers_count":30,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":127,"forks":33,"open_issues":127,"watchers":30,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/818"},"html":{"href":"https://github.com/Minecolonies/minecolonies/pull/818"},"issue":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/issues/818"},"comments":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/issues/818/comments"},"review_comments":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/818/comments"},"review_comment":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/818/commits"},"statuses":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/b335177c72aea3a7148717a76f2bcfea721ff5b9"}}}}
{"actor":{"display_login":"MinecoloniesSonar"}}