{"action":"created","comment":{"url":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/comments/29937092","id":29937092,"diff_hunk":"@@ -0,0 +1,84 @@\n+==========================\n+Working with Tile Entities\n+==========================\n+\n+Tile entities are blocks that are capable of additional operations like autonomically crafting (furnaces and brewing stands) or provide effects (like a beacon or a note block). They also contain additional data like an inventory or text (like chests, signs or command blocks).\n+\n+Identifying Tile Entities and their Type\n+========================================\n+\n+Again, it all starts with a ``Location``. The ``getTileEntity()`` function will return the tile entity corresponding to the block or ``Optional.absent()`` if the block is not a tile entity.\n+\n+ .. code-block:: java\n+ \n+\tpublic boolean isTileEntity(Location block) {\n+\t\treturn block.getTileEntity().isPresent();\n+\t}\n+\t\n+The type of a tile entity can then be obtained by the ``getType()`` function which returns a ``TileEntityType``. Which can then be compared similar to a ``BlockType``. After performing this check the ``TileEntity`` variable can safely be cast to the according subtype.\n+\n+ .. code-block:: java\n+ \n+\tpublic boolean isJukebox(TileEntity entity) {\n+\t\treturn entity.getType() == TileEntityTypes.JUKEBOX;\n+\t}\n+\t\n+\tpublic Optional<Jukebox> getJukebox(TileEntity entity) {\n+\t\tif (isJukebox(entity)) {\n+\t\t\treturn Optional.of((Jukebox) entity);\n+\t\t} else {\n+\t\t\treturn Optional.absent();\n+\t\t}\n+\t}","path":"source/plugin/basics/blocks/tileentities.rst","position":32,"original_position":32,"commit_id":"079db867f112dbc729aedd1597aa286c9977fb83","original_commit_id":"079db867f112dbc729aedd1597aa286c9977fb83","user":{"login":"saladoc","id":7555130,"avatar_url":"https://avatars.githubusercontent.com/u/7555130?v=3","gravatar_id":"","url":"https://api.github.com/users/saladoc","html_url":"https://github.com/saladoc","followers_url":"https://api.github.com/users/saladoc/followers","following_url":"https://api.github.com/users/saladoc/following{/other_user}","gists_url":"https://api.github.com/users/saladoc/gists{/gist_id}","starred_url":"https://api.github.com/users/saladoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saladoc/subscriptions","organizations_url":"https://api.github.com/users/saladoc/orgs","repos_url":"https://api.github.com/users/saladoc/repos","events_url":"https://api.github.com/users/saladoc/events{/privacy}","received_events_url":"https://api.github.com/users/saladoc/received_events","type":"User","site_admin":false},"body":"You pinpoint exactly what I felt when writing those examples. I did it multiple times that I returned an `Optional` instead of writing much simpler code because I felt it to be more in line with the Sponge coding style.\r\nI guess I'll just go with your second suggestion and act like I stole the relevant lines from bigger functions.","created_at":"2015-05-08T12:57:23Z","updated_at":"2015-05-08T12:57:23Z","html_url":"https://github.com/SpongePowered/SpongeDocs/pull/204#discussion_r29937092","pull_request_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/204","_links":{"self":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/comments/29937092"},"html":{"href":"https://github.com/SpongePowered/SpongeDocs/pull/204#discussion_r29937092"},"pull_request":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/204"}}},"pull_request":{"url":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/204","id":34935173,"html_url":"https://github.com/SpongePowered/SpongeDocs/pull/204","diff_url":"https://github.com/SpongePowered/SpongeDocs/pull/204.diff","patch_url":"https://github.com/SpongePowered/SpongeDocs/pull/204.patch","issue_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/issues/204","number":204,"state":"open","locked":false,"title":"Block API Documentation","user":{"login":"saladoc","id":7555130,"avatar_url":"https://avatars.githubusercontent.com/u/7555130?v=3","gravatar_id":"","url":"https://api.github.com/users/saladoc","html_url":"https://github.com/saladoc","followers_url":"https://api.github.com/users/saladoc/followers","following_url":"https://api.github.com/users/saladoc/following{/other_user}","gists_url":"https://api.github.com/users/saladoc/gists{/gist_id}","starred_url":"https://api.github.com/users/saladoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saladoc/subscriptions","organizations_url":"https://api.github.com/users/saladoc/orgs","repos_url":"https://api.github.com/users/saladoc/repos","events_url":"https://api.github.com/users/saladoc/events{/privacy}","received_events_url":"https://api.github.com/users/saladoc/received_events","type":"User","site_admin":false},"body":"Re-done from my first attempt. \r\n\r\nThis covers\r\n - usage of `Location` class to access and alter block types / states\r\n - working with `BlockState`s, also basic coverage of data api\r\n - accessing tile entities, their data and, if present, their inventories\r\n - a very brief take on `BlockSnapshot`s\r\n\r\nThis still lacks\r\n - a page about using the data interface that I can link to\r\n - a page about using the inventory api that I can link to\r\n\r\nFeedback appreciated.\r\n\r\nRelated Issue: #10 ","created_at":"2015-05-07T16:46:37Z","updated_at":"2015-05-08T12:57:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a8333fcd767730d04e0d563594bf761069b3651","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/204/commits","review_comments_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/204/comments","review_comment_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/issues/204/comments","statuses_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/statuses/079db867f112dbc729aedd1597aa286c9977fb83","head":{"label":"saladoc:blockapi","ref":"blockapi","sha":"079db867f112dbc729aedd1597aa286c9977fb83","user":{"login":"saladoc","id":7555130,"avatar_url":"https://avatars.githubusercontent.com/u/7555130?v=3","gravatar_id":"","url":"https://api.github.com/users/saladoc","html_url":"https://github.com/saladoc","followers_url":"https://api.github.com/users/saladoc/followers","following_url":"https://api.github.com/users/saladoc/following{/other_user}","gists_url":"https://api.github.com/users/saladoc/gists{/gist_id}","starred_url":"https://api.github.com/users/saladoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saladoc/subscriptions","organizations_url":"https://api.github.com/users/saladoc/orgs","repos_url":"https://api.github.com/users/saladoc/repos","events_url":"https://api.github.com/users/saladoc/events{/privacy}","received_events_url":"https://api.github.com/users/saladoc/received_events","type":"User","site_admin":false},"repo":{"id":35231239,"name":"SpongeDocs","full_name":"saladoc/SpongeDocs","owner":{"login":"saladoc","id":7555130,"avatar_url":"https://avatars.githubusercontent.com/u/7555130?v=3","gravatar_id":"","url":"https://api.github.com/users/saladoc","html_url":"https://github.com/saladoc","followers_url":"https://api.github.com/users/saladoc/followers","following_url":"https://api.github.com/users/saladoc/following{/other_user}","gists_url":"https://api.github.com/users/saladoc/gists{/gist_id}","starred_url":"https://api.github.com/users/saladoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saladoc/subscriptions","organizations_url":"https://api.github.com/users/saladoc/orgs","repos_url":"https://api.github.com/users/saladoc/repos","events_url":"https://api.github.com/users/saladoc/events{/privacy}","received_events_url":"https://api.github.com/users/saladoc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/saladoc/SpongeDocs","description":"","fork":true,"url":"https://api.github.com/repos/saladoc/SpongeDocs","forks_url":"https://api.github.com/repos/saladoc/SpongeDocs/forks","keys_url":"https://api.github.com/repos/saladoc/SpongeDocs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/saladoc/SpongeDocs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/saladoc/SpongeDocs/teams","hooks_url":"https://api.github.com/repos/saladoc/SpongeDocs/hooks","issue_events_url":"https://api.github.com/repos/saladoc/SpongeDocs/issues/events{/number}","events_url":"https://api.github.com/repos/saladoc/SpongeDocs/events","assignees_url":"https://api.github.com/repos/saladoc/SpongeDocs/assignees{/user}","branches_url":"https://api.github.com/repos/saladoc/SpongeDocs/branches{/branch}","tags_url":"https://api.github.com/repos/saladoc/SpongeDocs/tags","blobs_url":"https://api.github.com/repos/saladoc/SpongeDocs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/saladoc/SpongeDocs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/saladoc/SpongeDocs/git/refs{/sha}","trees_url":"https://api.github.com/repos/saladoc/SpongeDocs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/saladoc/SpongeDocs/statuses/{sha}","languages_url":"https://api.github.com/repos/saladoc/SpongeDocs/languages","stargazers_url":"https://api.github.com/repos/saladoc/SpongeDocs/stargazers","contributors_url":"https://api.github.com/repos/saladoc/SpongeDocs/contributors","subscribers_url":"https://api.github.com/repos/saladoc/SpongeDocs/subscribers","subscription_url":"https://api.github.com/repos/saladoc/SpongeDocs/subscription","commits_url":"https://api.github.com/repos/saladoc/SpongeDocs/commits{/sha}","git_commits_url":"https://api.github.com/repos/saladoc/SpongeDocs/git/commits{/sha}","comments_url":"https://api.github.com/repos/saladoc/SpongeDocs/comments{/number}","issue_comment_url":"https://api.github.com/repos/saladoc/SpongeDocs/issues/comments{/number}","contents_url":"https://api.github.com/repos/saladoc/SpongeDocs/contents/{+path}","compare_url":"https://api.github.com/repos/saladoc/SpongeDocs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/saladoc/SpongeDocs/merges","archive_url":"https://api.github.com/repos/saladoc/SpongeDocs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/saladoc/SpongeDocs/downloads","issues_url":"https://api.github.com/repos/saladoc/SpongeDocs/issues{/number}","pulls_url":"https://api.github.com/repos/saladoc/SpongeDocs/pulls{/number}","milestones_url":"https://api.github.com/repos/saladoc/SpongeDocs/milestones{/number}","notifications_url":"https://api.github.com/repos/saladoc/SpongeDocs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/saladoc/SpongeDocs/labels{/name}","releases_url":"https://api.github.com/repos/saladoc/SpongeDocs/releases{/id}","created_at":"2015-05-07T16:33:05Z","updated_at":"2015-05-07T16:33:06Z","pushed_at":"2015-05-07T16:38:25Z","git_url":"git://github.com/saladoc/SpongeDocs.git","ssh_url":"git@github.com:saladoc/SpongeDocs.git","clone_url":"https://github.com/saladoc/SpongeDocs.git","svn_url":"https://github.com/saladoc/SpongeDocs","homepage":null,"size":3946,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"SpongePowered:master","ref":"master","sha":"9c10e77ea6d5f9b28ffd774ddd930b735082a76d","user":{"login":"SpongePowered","id":8683473,"avatar_url":"https://avatars.githubusercontent.com/u/8683473?v=3","gravatar_id":"","url":"https://api.github.com/users/SpongePowered","html_url":"https://github.com/SpongePowered","followers_url":"https://api.github.com/users/SpongePowered/followers","following_url":"https://api.github.com/users/SpongePowered/following{/other_user}","gists_url":"https://api.github.com/users/SpongePowered/gists{/gist_id}","starred_url":"https://api.github.com/users/SpongePowered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpongePowered/subscriptions","organizations_url":"https://api.github.com/users/SpongePowered/orgs","repos_url":"https://api.github.com/users/SpongePowered/repos","events_url":"https://api.github.com/users/SpongePowered/events{/privacy}","received_events_url":"https://api.github.com/users/SpongePowered/received_events","type":"Organization","site_admin":false},"repo":{"id":27024702,"name":"SpongeDocs","full_name":"SpongePowered/SpongeDocs","owner":{"login":"SpongePowered","id":8683473,"avatar_url":"https://avatars.githubusercontent.com/u/8683473?v=3","gravatar_id":"","url":"https://api.github.com/users/SpongePowered","html_url":"https://github.com/SpongePowered","followers_url":"https://api.github.com/users/SpongePowered/followers","following_url":"https://api.github.com/users/SpongePowered/following{/other_user}","gists_url":"https://api.github.com/users/SpongePowered/gists{/gist_id}","starred_url":"https://api.github.com/users/SpongePowered/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SpongePowered/subscriptions","organizations_url":"https://api.github.com/users/SpongePowered/orgs","repos_url":"https://api.github.com/users/SpongePowered/repos","events_url":"https://api.github.com/users/SpongePowered/events{/privacy}","received_events_url":"https://api.github.com/users/SpongePowered/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SpongePowered/SpongeDocs","description":"","fork":false,"url":"https://api.github.com/repos/SpongePowered/SpongeDocs","forks_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/forks","keys_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/teams","hooks_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/hooks","issue_events_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/issues/events{/number}","events_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/events","assignees_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/assignees{/user}","branches_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/branches{/branch}","tags_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/tags","blobs_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/git/refs{/sha}","trees_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/statuses/{sha}","languages_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/languages","stargazers_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/stargazers","contributors_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/contributors","subscribers_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/subscribers","subscription_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/subscription","commits_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/commits{/sha}","git_commits_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/git/commits{/sha}","comments_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/comments{/number}","issue_comment_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/issues/comments{/number}","contents_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/contents/{+path}","compare_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/merges","archive_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/downloads","issues_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/issues{/number}","pulls_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls{/number}","milestones_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/milestones{/number}","notifications_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/labels{/name}","releases_url":"https://api.github.com/repos/SpongePowered/SpongeDocs/releases{/id}","created_at":"2014-11-23T06:56:04Z","updated_at":"2015-05-08T11:03:18Z","pushed_at":"2015-05-08T11:03:18Z","git_url":"git://github.com/SpongePowered/SpongeDocs.git","ssh_url":"git@github.com:SpongePowered/SpongeDocs.git","clone_url":"https://github.com/SpongePowered/SpongeDocs.git","svn_url":"https://github.com/SpongePowered/SpongeDocs","homepage":null,"size":8971,"stargazers_count":43,"watchers_count":43,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":41,"mirror_url":null,"open_issues_count":38,"forks":41,"open_issues":38,"watchers":43,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/204"},"html":{"href":"https://github.com/SpongePowered/SpongeDocs/pull/204"},"issue":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/issues/204"},"comments":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/issues/204/comments"},"review_comments":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/204/comments"},"review_comment":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/pulls/204/commits"},"statuses":{"href":"https://api.github.com/repos/SpongePowered/SpongeDocs/statuses/079db867f112dbc729aedd1597aa286c9977fb83"}}}}