{"action":"created","comment":{"url":"https://api.github.com/repos/cuberite/cuberite/pulls/comments/48180120","id":48180120,"diff_hunk":"@@ -0,0 +1,107 @@\n+\n+#pragma once\n+\n+#include \"ItemHandler.h\"\n+#include \"../World.h\"\n+\n+\n+\n+\n+\n+class cItemBottleHandler :\n+\tpublic cItemHandler\n+{\n+public:\n+\tcItemBottleHandler() :\n+\t\tcItemHandler(E_ITEM_GLASS_BOTTLE)\n+\t{\n+\t}\n+\n+\n+\tbool GetBlockFromTrace(cWorld * a_World, cPlayer * a_Player, Vector3i & a_BlockPos)\n+\t{\n+\t\tclass cCallbacks :\n+\t\t\tpublic cBlockTracer::cCallbacks\n+\t\t{\n+\t\tpublic:\n+\t\t\tVector3i m_Pos;\n+\t\t\tbool     m_HasHitFluid;\n+\n+\n+\t\t\tcCallbacks(void) :\n+\t\t\t\tm_HasHitFluid(false)\n+\t\t\t{\n+\t\t\t}\n+\n+\t\t\tvirtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, char a_EntryFace) override\n+\t\t\t{\n+\t\t\t\tif (IsBlockWater(a_BlockType) || IsBlockLava(a_BlockType))\n+\t\t\t\t{\n+\t\t\t\t\tif (a_BlockMeta != 0)  // GetBlockFromTrace is called for scooping up fluids; the hit block should be a source\n+\t\t\t\t\t{\n+\t\t\t\t\t\treturn false;\n+\t\t\t\t\t}\n+\t\t\t\t\tm_HasHitFluid = true;\n+\t\t\t\t\tm_Pos.Set(a_BlockX, a_BlockY, a_BlockZ);\n+\t\t\t\t\treturn true;\n+\t\t\t\t}\n+\t\t\t\treturn false;\n+\t\t\t}\n+\t\t} Callbacks;\n+\n+\t\tcLineBlockTracer Tracer(*a_World, Callbacks);\n+\t\tVector3d Start(a_Player->GetEyePosition() + a_Player->GetLookVector());\n+\t\tVector3d End(a_Player->GetEyePosition() + a_Player->GetLookVector() * 5);\n+\n+\t\tTracer.Trace(Start.x, Start.y, Start.z, End.x, End.y, End.z);\n+\n+\t\tif (!Callbacks.m_HasHitFluid)\n+\t\t{\n+\t\t\treturn false;\n+\t\t}\n+\n+\n+\t\ta_BlockPos = Callbacks.m_Pos;\n+\t\treturn true;\n+\t}\n+\n+\n+\n+\tvirtual bool OnItemUse(\n+\t\tcWorld * a_World, cPlayer * a_Player, cBlockPluginInterface & a_PluginInterface, const cItem & a_Item,\n+\t\tint a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace\n+\t\t) override\n+\t{\n+\t\tif (a_BlockFace != BLOCK_FACE_NONE)\n+\t\t{\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tVector3i BlockPos;\n+\t\tif (!GetBlockFromTrace(a_World, a_Player, BlockPos))\n+\t\t{\n+\t\t\treturn false;  // Nothing in range.\n+\t\t}\n+\n+\t\tif (a_World->GetBlockMeta(BlockPos.x, BlockPos.y, BlockPos.z) != 0)\n+\t\t{\n+\t\t\t// Not a source block\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tBLOCKTYPE Block = a_World->GetBlock(BlockPos.x, BlockPos.y, BlockPos.z);\n+\n+\t\tif (IsBlockWater(Block))","path":"src/Items/ItemBottle.h","position":94,"original_position":94,"commit_id":"0d90a9ff3f58cebca71ea6c2bce2aa3d9cdfc813","original_commit_id":"0d90a9ff3f58cebca71ea6c2bce2aa3d9cdfc813","user":{"login":"worktycho","id":2102806,"avatar_url":"https://avatars.githubusercontent.com/u/2102806?v=3","gravatar_id":"","url":"https://api.github.com/users/worktycho","html_url":"https://github.com/worktycho","followers_url":"https://api.github.com/users/worktycho/followers","following_url":"https://api.github.com/users/worktycho/following{/other_user}","gists_url":"https://api.github.com/users/worktycho/gists{/gist_id}","starred_url":"https://api.github.com/users/worktycho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/worktycho/subscriptions","organizations_url":"https://api.github.com/users/worktycho/orgs","repos_url":"https://api.github.com/users/worktycho/repos","events_url":"https://api.github.com/users/worktycho/events{/privacy}","received_events_url":"https://api.github.com/users/worktycho/received_events","type":"User","site_admin":false},"body":"This condition will only be false in rare race conditions, you can probably remove it.","created_at":"2015-12-21T19:21:34Z","updated_at":"2015-12-21T19:21:34Z","html_url":"https://github.com/cuberite/cuberite/pull/2790#discussion_r48180120","pull_request_url":"https://api.github.com/repos/cuberite/cuberite/pulls/2790","_links":{"self":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/comments/48180120"},"html":{"href":"https://github.com/cuberite/cuberite/pull/2790#discussion_r48180120"},"pull_request":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/2790"}}},"pull_request":{"url":"https://api.github.com/repos/cuberite/cuberite/pulls/2790","id":54291918,"html_url":"https://github.com/cuberite/cuberite/pull/2790","diff_url":"https://github.com/cuberite/cuberite/pull/2790.diff","patch_url":"https://github.com/cuberite/cuberite/pull/2790.patch","issue_url":"https://api.github.com/repos/cuberite/cuberite/issues/2790","number":2790,"state":"open","locked":false,"title":"Add handling of water bottle","user":{"login":"Gargaj","id":1702533,"avatar_url":"https://avatars.githubusercontent.com/u/1702533?v=3","gravatar_id":"","url":"https://api.github.com/users/Gargaj","html_url":"https://github.com/Gargaj","followers_url":"https://api.github.com/users/Gargaj/followers","following_url":"https://api.github.com/users/Gargaj/following{/other_user}","gists_url":"https://api.github.com/users/Gargaj/gists{/gist_id}","starred_url":"https://api.github.com/users/Gargaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gargaj/subscriptions","organizations_url":"https://api.github.com/users/Gargaj/orgs","repos_url":"https://api.github.com/users/Gargaj/repos","events_url":"https://api.github.com/users/Gargaj/events{/privacy}","received_events_url":"https://api.github.com/users/Gargaj/received_events","type":"User","site_admin":false},"body":"Currently using an empty bottle on a water source block creates a phantom water bottle that disappears on inventory sync.\r\n\r\nI copied the ```GetBlockFromTrace``` function from ```ItemBucket.h``` - probably should refactor it out into a ```World``` function or somewhere else.","created_at":"2015-12-21T19:15:47Z","updated_at":"2015-12-21T19:21:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f8d6f9bdbfe12b176686c70826f0ac53ea99ea2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cuberite/cuberite/pulls/2790/commits","review_comments_url":"https://api.github.com/repos/cuberite/cuberite/pulls/2790/comments","review_comment_url":"https://api.github.com/repos/cuberite/cuberite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cuberite/cuberite/issues/2790/comments","statuses_url":"https://api.github.com/repos/cuberite/cuberite/statuses/0d90a9ff3f58cebca71ea6c2bce2aa3d9cdfc813","head":{"label":"Gargaj:waterbottle","ref":"waterbottle","sha":"0d90a9ff3f58cebca71ea6c2bce2aa3d9cdfc813","user":{"login":"Gargaj","id":1702533,"avatar_url":"https://avatars.githubusercontent.com/u/1702533?v=3","gravatar_id":"","url":"https://api.github.com/users/Gargaj","html_url":"https://github.com/Gargaj","followers_url":"https://api.github.com/users/Gargaj/followers","following_url":"https://api.github.com/users/Gargaj/following{/other_user}","gists_url":"https://api.github.com/users/Gargaj/gists{/gist_id}","starred_url":"https://api.github.com/users/Gargaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gargaj/subscriptions","organizations_url":"https://api.github.com/users/Gargaj/orgs","repos_url":"https://api.github.com/users/Gargaj/repos","events_url":"https://api.github.com/users/Gargaj/events{/privacy}","received_events_url":"https://api.github.com/users/Gargaj/received_events","type":"User","site_admin":false},"repo":{"id":45553777,"name":"cuberite","full_name":"Gargaj/cuberite","owner":{"login":"Gargaj","id":1702533,"avatar_url":"https://avatars.githubusercontent.com/u/1702533?v=3","gravatar_id":"","url":"https://api.github.com/users/Gargaj","html_url":"https://github.com/Gargaj","followers_url":"https://api.github.com/users/Gargaj/followers","following_url":"https://api.github.com/users/Gargaj/following{/other_user}","gists_url":"https://api.github.com/users/Gargaj/gists{/gist_id}","starred_url":"https://api.github.com/users/Gargaj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gargaj/subscriptions","organizations_url":"https://api.github.com/users/Gargaj/orgs","repos_url":"https://api.github.com/users/Gargaj/repos","events_url":"https://api.github.com/users/Gargaj/events{/privacy}","received_events_url":"https://api.github.com/users/Gargaj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Gargaj/cuberite","description":"A performant C++ Minecraft compatible game server","fork":true,"url":"https://api.github.com/repos/Gargaj/cuberite","forks_url":"https://api.github.com/repos/Gargaj/cuberite/forks","keys_url":"https://api.github.com/repos/Gargaj/cuberite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Gargaj/cuberite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Gargaj/cuberite/teams","hooks_url":"https://api.github.com/repos/Gargaj/cuberite/hooks","issue_events_url":"https://api.github.com/repos/Gargaj/cuberite/issues/events{/number}","events_url":"https://api.github.com/repos/Gargaj/cuberite/events","assignees_url":"https://api.github.com/repos/Gargaj/cuberite/assignees{/user}","branches_url":"https://api.github.com/repos/Gargaj/cuberite/branches{/branch}","tags_url":"https://api.github.com/repos/Gargaj/cuberite/tags","blobs_url":"https://api.github.com/repos/Gargaj/cuberite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Gargaj/cuberite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Gargaj/cuberite/git/refs{/sha}","trees_url":"https://api.github.com/repos/Gargaj/cuberite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Gargaj/cuberite/statuses/{sha}","languages_url":"https://api.github.com/repos/Gargaj/cuberite/languages","stargazers_url":"https://api.github.com/repos/Gargaj/cuberite/stargazers","contributors_url":"https://api.github.com/repos/Gargaj/cuberite/contributors","subscribers_url":"https://api.github.com/repos/Gargaj/cuberite/subscribers","subscription_url":"https://api.github.com/repos/Gargaj/cuberite/subscription","commits_url":"https://api.github.com/repos/Gargaj/cuberite/commits{/sha}","git_commits_url":"https://api.github.com/repos/Gargaj/cuberite/git/commits{/sha}","comments_url":"https://api.github.com/repos/Gargaj/cuberite/comments{/number}","issue_comment_url":"https://api.github.com/repos/Gargaj/cuberite/issues/comments{/number}","contents_url":"https://api.github.com/repos/Gargaj/cuberite/contents/{+path}","compare_url":"https://api.github.com/repos/Gargaj/cuberite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Gargaj/cuberite/merges","archive_url":"https://api.github.com/repos/Gargaj/cuberite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Gargaj/cuberite/downloads","issues_url":"https://api.github.com/repos/Gargaj/cuberite/issues{/number}","pulls_url":"https://api.github.com/repos/Gargaj/cuberite/pulls{/number}","milestones_url":"https://api.github.com/repos/Gargaj/cuberite/milestones{/number}","notifications_url":"https://api.github.com/repos/Gargaj/cuberite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Gargaj/cuberite/labels{/name}","releases_url":"https://api.github.com/repos/Gargaj/cuberite/releases{/id}","created_at":"2015-11-04T16:58:55Z","updated_at":"2015-11-06T09:23:02Z","pushed_at":"2015-12-21T19:14:06Z","git_url":"git://github.com/Gargaj/cuberite.git","ssh_url":"git@github.com:Gargaj/cuberite.git","clone_url":"https://github.com/Gargaj/cuberite.git","svn_url":"https://github.com/Gargaj/cuberite","homepage":"http://cuberite.org","size":79331,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cuberite:master","ref":"master","sha":"e6d74553a2a2f01037051651f8421e02579416aa","user":{"login":"cuberite","id":8973961,"avatar_url":"https://avatars.githubusercontent.com/u/8973961?v=3","gravatar_id":"","url":"https://api.github.com/users/cuberite","html_url":"https://github.com/cuberite","followers_url":"https://api.github.com/users/cuberite/followers","following_url":"https://api.github.com/users/cuberite/following{/other_user}","gists_url":"https://api.github.com/users/cuberite/gists{/gist_id}","starred_url":"https://api.github.com/users/cuberite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuberite/subscriptions","organizations_url":"https://api.github.com/users/cuberite/orgs","repos_url":"https://api.github.com/users/cuberite/repos","events_url":"https://api.github.com/users/cuberite/events{/privacy}","received_events_url":"https://api.github.com/users/cuberite/received_events","type":"Organization","site_admin":false},"repo":{"id":11693709,"name":"cuberite","full_name":"cuberite/cuberite","owner":{"login":"cuberite","id":8973961,"avatar_url":"https://avatars.githubusercontent.com/u/8973961?v=3","gravatar_id":"","url":"https://api.github.com/users/cuberite","html_url":"https://github.com/cuberite","followers_url":"https://api.github.com/users/cuberite/followers","following_url":"https://api.github.com/users/cuberite/following{/other_user}","gists_url":"https://api.github.com/users/cuberite/gists{/gist_id}","starred_url":"https://api.github.com/users/cuberite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cuberite/subscriptions","organizations_url":"https://api.github.com/users/cuberite/orgs","repos_url":"https://api.github.com/users/cuberite/repos","events_url":"https://api.github.com/users/cuberite/events{/privacy}","received_events_url":"https://api.github.com/users/cuberite/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cuberite/cuberite","description":"A performant C++ Minecraft compatible game server","fork":false,"url":"https://api.github.com/repos/cuberite/cuberite","forks_url":"https://api.github.com/repos/cuberite/cuberite/forks","keys_url":"https://api.github.com/repos/cuberite/cuberite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cuberite/cuberite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cuberite/cuberite/teams","hooks_url":"https://api.github.com/repos/cuberite/cuberite/hooks","issue_events_url":"https://api.github.com/repos/cuberite/cuberite/issues/events{/number}","events_url":"https://api.github.com/repos/cuberite/cuberite/events","assignees_url":"https://api.github.com/repos/cuberite/cuberite/assignees{/user}","branches_url":"https://api.github.com/repos/cuberite/cuberite/branches{/branch}","tags_url":"https://api.github.com/repos/cuberite/cuberite/tags","blobs_url":"https://api.github.com/repos/cuberite/cuberite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cuberite/cuberite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cuberite/cuberite/git/refs{/sha}","trees_url":"https://api.github.com/repos/cuberite/cuberite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cuberite/cuberite/statuses/{sha}","languages_url":"https://api.github.com/repos/cuberite/cuberite/languages","stargazers_url":"https://api.github.com/repos/cuberite/cuberite/stargazers","contributors_url":"https://api.github.com/repos/cuberite/cuberite/contributors","subscribers_url":"https://api.github.com/repos/cuberite/cuberite/subscribers","subscription_url":"https://api.github.com/repos/cuberite/cuberite/subscription","commits_url":"https://api.github.com/repos/cuberite/cuberite/commits{/sha}","git_commits_url":"https://api.github.com/repos/cuberite/cuberite/git/commits{/sha}","comments_url":"https://api.github.com/repos/cuberite/cuberite/comments{/number}","issue_comment_url":"https://api.github.com/repos/cuberite/cuberite/issues/comments{/number}","contents_url":"https://api.github.com/repos/cuberite/cuberite/contents/{+path}","compare_url":"https://api.github.com/repos/cuberite/cuberite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cuberite/cuberite/merges","archive_url":"https://api.github.com/repos/cuberite/cuberite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cuberite/cuberite/downloads","issues_url":"https://api.github.com/repos/cuberite/cuberite/issues{/number}","pulls_url":"https://api.github.com/repos/cuberite/cuberite/pulls{/number}","milestones_url":"https://api.github.com/repos/cuberite/cuberite/milestones{/number}","notifications_url":"https://api.github.com/repos/cuberite/cuberite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cuberite/cuberite/labels{/name}","releases_url":"https://api.github.com/repos/cuberite/cuberite/releases{/id}","created_at":"2013-07-26T19:56:59Z","updated_at":"2015-12-21T07:53:02Z","pushed_at":"2015-12-21T19:15:47Z","git_url":"git://github.com/cuberite/cuberite.git","ssh_url":"git@github.com:cuberite/cuberite.git","clone_url":"https://github.com/cuberite/cuberite.git","svn_url":"https://github.com/cuberite/cuberite","homepage":"http://cuberite.org","size":146838,"stargazers_count":1016,"watchers_count":1016,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":260,"mirror_url":null,"open_issues_count":424,"forks":260,"open_issues":424,"watchers":1016,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/2790"},"html":{"href":"https://github.com/cuberite/cuberite/pull/2790"},"issue":{"href":"https://api.github.com/repos/cuberite/cuberite/issues/2790"},"comments":{"href":"https://api.github.com/repos/cuberite/cuberite/issues/2790/comments"},"review_comments":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/2790/comments"},"review_comment":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cuberite/cuberite/pulls/2790/commits"},"statuses":{"href":"https://api.github.com/repos/cuberite/cuberite/statuses/0d90a9ff3f58cebca71ea6c2bce2aa3d9cdfc813"}}}}