{"action":"created","comment":{"url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments/121014611","pull_request_review_id":43031315,"id":121014611,"diff_hunk":"@@ -660,6 +532,32 @@ public static int findFirstSlotInProviderNotEmptyWith(@NotNull final ICapability\n     }\n \n     /**\n+     * Returns the index of the first occurrence of an ItemStack that matches\n+     * the given predicate in the {@link IItemHandler}.\n+     * Also applies the not empty check.\n+     *\n+     * @param itemHandler                 ItemHandler to check\n+     * @param itemStackSelectionPredicate The predicate to match.\n+     * @return Index of the first occurrence\n+     */\n+    public static int findFirstSlotInItemHandlerNotEmptyWith(@NotNull final IItemHandler itemHandler, @NotNull final Predicate<ItemStack> itemStackSelectionPredicate)\n+    {\n+        @NotNull final Predicate<ItemStack> firstWorthySlotPredicate = ItemStackUtils.NOT_EMPTY_PREDICATE.and(itemStackSelectionPredicate);\n+\n+        for (int slot = 0; slot < itemHandler.getSlots(); slot++)\n+        {\n+            if (firstWorthySlotPredicate.test(itemHandler.getStackInSlot(slot)))\n+            {\n+                return slot;\n+            }\n+        }\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!\");","path":"src/main/java/com/minecolonies/coremod/util/InventoryUtils.java","position":331,"original_position":331,"commit_id":"86911342feca71de682b36aa70925831e4829215","original_commit_id":"86911342feca71de682b36aa70925831e4829215","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":"![MINOR](https://sonarsource.github.io/sonar-github/severity-minor.png 'Severity: MINOR') This block of commented-out lines of code should be removed. [![rule](https://sonarsource.github.io/sonar-github/rule.png)](https://sonar.minecolonies.com/coding_rules#rule_key=squid%3ACommentedOutCodeLine)\n","created_at":"2017-06-08T22:34:45Z","updated_at":"2017-06-08T22:34:45Z","html_url":"https://github.com/Minecolonies/minecolonies/pull/1145#discussion_r121014611","pull_request_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1145","_links":{"self":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments/121014611"},"html":{"href":"https://github.com/Minecolonies/minecolonies/pull/1145#discussion_r121014611"},"pull_request":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1145"}}},"pull_request":{"url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1145","id":124750826,"html_url":"https://github.com/Minecolonies/minecolonies/pull/1145","diff_url":"https://github.com/Minecolonies/minecolonies/pull/1145.diff","patch_url":"https://github.com/Minecolonies/minecolonies/pull/1145.patch","issue_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/1145","number":1145,"state":"open","locked":false,"title":"Compatibility/1.10 itemstack count","user":{"login":"xavierh","id":2778556,"avatar_url":"https://avatars0.githubusercontent.com/u/2778556?v=3","gravatar_id":"","url":"https://api.github.com/users/xavierh","html_url":"https://github.com/xavierh","followers_url":"https://api.github.com/users/xavierh/followers","following_url":"https://api.github.com/users/xavierh/following{/other_user}","gists_url":"https://api.github.com/users/xavierh/gists{/gist_id}","starred_url":"https://api.github.com/users/xavierh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xavierh/subscriptions","organizations_url":"https://api.github.com/users/xavierh/orgs","repos_url":"https://api.github.com/users/xavierh/repos","events_url":"https://api.github.com/users/xavierh/events{/privacy}","received_events_url":"https://api.github.com/users/xavierh/received_events","type":"User","site_admin":false},"body":"Depend of #1142 \r\nTrying to make 1.10 and 1.11 ports easier\r\n\r\n# Changes proposed in this pull request:\r\nreplace \r\n* stack == null \r\n\r\nby \r\n* ItemStackUtils.isEmpty(stack)\r\n\r\nreplace \r\n* stack = null \r\nby \r\n* stack = ItemStackUtils.EMPTY\r\n\r\nreplace stack.stackSize by \r\nItemStackUtils.setSize(stack, number)\r\nnumber = ItemStackUtils.getSize(stack)\r\nItemStackUtils.increaseOrDecreaseSize(stack, number)\r\n\r\n\r\nWork in progress\r\n","created_at":"2017-06-08T21:42:08Z","updated_at":"2017-06-08T22:34:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca3bb0245ab2d09a003c3ce4621a3ba4f55cd5b4","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1145/commits","review_comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1145/comments","review_comment_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/1145/comments","statuses_url":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/86911342feca71de682b36aa70925831e4829215","head":{"label":"Minecolonies:compatibility/1.10-itemstack-count","ref":"compatibility/1.10-itemstack-count","sha":"86911342feca71de682b36aa70925831e4829215","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-05-28T05:29:31Z","pushed_at":"2017-06-08T22:30:23Z","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":21405,"stargazers_count":40,"watchers_count":40,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":124,"forks":35,"open_issues":124,"watchers":40,"default_branch":"version/1.11"}},"base":{"label":"Minecolonies:version/1.10","ref":"version/1.10","sha":"f6268c892c3a02acfa5041a1a51fa1aeeac1a0b2","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-05-28T05:29:31Z","pushed_at":"2017-06-08T22:30:23Z","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":21405,"stargazers_count":40,"watchers_count":40,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":124,"forks":35,"open_issues":124,"watchers":40,"default_branch":"version/1.11"}},"_links":{"self":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1145"},"html":{"href":"https://github.com/Minecolonies/minecolonies/pull/1145"},"issue":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/issues/1145"},"comments":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/issues/1145/comments"},"review_comments":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1145/comments"},"review_comment":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/1145/commits"},"statuses":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/86911342feca71de682b36aa70925831e4829215"}}}}
{"actor":{"display_login":"MinecoloniesSonar"}}