{"action":"created","comment":{"url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments/85225819","pull_request_review_id":5953764,"id":85225819,"diff_hunk":"@@ -0,0 +1,307 @@\n+package com.minecolonies.entity.ai.citizen.guard;\n+\n+import com.minecolonies.colony.buildings.AbstractBuilding;\n+import com.minecolonies.colony.buildings.AbstractBuildingWorker;\n+import com.minecolonies.colony.buildings.BuildingGuardTower;\n+import com.minecolonies.colony.jobs.JobGuard;\n+import com.minecolonies.colony.permissions.Permissions;\n+import com.minecolonies.entity.ai.basic.AbstractEntityAISkill;\n+import com.minecolonies.entity.ai.util.AIState;\n+import com.minecolonies.tileentities.TileEntityColonyBuilding;\n+import com.minecolonies.util.InventoryUtils;\n+import net.minecraft.entity.Entity;\n+import net.minecraft.entity.EntityLivingBase;\n+import net.minecraft.entity.monster.EntityMob;\n+import net.minecraft.entity.monster.EntitySlime;\n+import net.minecraft.entity.player.EntityPlayer;\n+import net.minecraft.inventory.EntityEquipmentSlot;\n+import net.minecraft.item.*;\n+import net.minecraft.util.math.AxisAlignedBB;\n+import net.minecraft.util.math.BlockPos;\n+import org.jetbrains.annotations.NotNull;\n+\n+import java.util.List;\n+import java.util.Map;\n+\n+/**\n+ * Abstract class which contains all the guard basics let it be range, melee or magic.\n+ */\n+public abstract class AbstractEntityAIGuard extends AbstractEntityAISkill<JobGuard>\n+{\n+    /**\n+     * The start search distance of the guard to track/attack entities may get more depending on the level.\n+     */\n+    private static final double MAX_ATTACK_DISTANCE = 20.0D;\n+\n+    /**\n+     * Distance the guard starts searching.\n+     */\n+    private static final int START_SEARCH_DISTANCE = 5;\n+\n+    /**\n+     * Basic delay after operations.\n+     */\n+    private static final int BASE_DELAY = 1;\n+\n+    /**\n+     * Max amount the guard can shoot arrows before restocking.\n+     */\n+    private static final int MAX_ATTACKS = 50;\n+\n+    /**\n+     * Y range in which the guard detects other entities.\n+     */\n+    private static final double HEIGHT_DETECTION_RANGE = 10D;\n+\n+    /**\n+     * Path that close to the patrol target.\n+     */\n+    private static final int PATH_CLOSE                = 3;\n+\n+    /**\n+     * The distance the guard is searching entities in currently.\n+     */\n+    private int currentSearchDistance = START_SEARCH_DISTANCE;\n+\n+    /**\n+     * The current target.\n+     */\n+    protected EntityLivingBase targetEntity;\n+\n+    /**\n+     * Current goTo task.\n+     */\n+    private BlockPos currentPatrolTarget;\n+\n+    /**\n+     * Containing all close entities.\n+     */\n+    private List<Entity> entityList;\n+\n+    /**\n+     * Amount of arrows already shot or sword hits dealt.\n+     */\n+    protected int attacksExecuted = 0;\n+\n+    /**\n+     * Sets up some important skeleton stuff for every ai.\n+     *\n+     * @param job the job class\n+     */\n+    protected AbstractEntityAIGuard(@NotNull final JobGuard job)\n+    {\n+        super(job);\n+    }\n+\n+\n+    /**\n+     * Can be overridden in implementations.\n+     * <p>\n+     * Here the AI can check if the armour have to be re rendered and do it.\n+     */\n+    @Override\n+    protected void updateRenderMetaData()\n+    {\n+        updateArmor();\n+    }\n+\n+    /**\n+     * Goes back to the building and tries to take armour from it when he hasn't in his inventory.\n+     * @return the next state to go to.\n+     */\n+    protected AIState goToBuilding()\n+    {\n+        if(!walkToBuilding())\n+        {\n+            final AbstractBuildingWorker workBuilding = getOwnBuilding();\n+            if(workBuilding != null)\n+            {\n+                final TileEntityColonyBuilding chest = workBuilding.getTileEntity();\n+                for (int i = 0; i < workBuilding.getTileEntity().getSizeInventory(); i++)","path":"src/main/java/com/minecolonies/entity/ai/citizen/guard/AbstractEntityAIGuard.java","position":120,"original_position":120,"commit_id":"08c99d04a983f09add767ab809c5d33421ba7b36","original_commit_id":"08c99d04a983f09add767ab809c5d33421ba7b36","user":{"login":"Raycoms","id":6438347,"avatar_url":"https://avatars.githubusercontent.com/u/6438347?v=3","gravatar_id":"","url":"https://api.github.com/users/Raycoms","html_url":"https://github.com/Raycoms","followers_url":"https://api.github.com/users/Raycoms/followers","following_url":"https://api.github.com/users/Raycoms/following{/other_user}","gists_url":"https://api.github.com/users/Raycoms/gists{/gist_id}","starred_url":"https://api.github.com/users/Raycoms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Raycoms/subscriptions","organizations_url":"https://api.github.com/users/Raycoms/orgs","repos_url":"https://api.github.com/users/Raycoms/repos","events_url":"https://api.github.com/users/Raycoms/events{/privacy}","received_events_url":"https://api.github.com/users/Raycoms/received_events","type":"User","site_admin":false},"body":"No access to the building inventory.\r\n","created_at":"2016-10-26T21:35:40Z","updated_at":"2016-10-26T21:35:40Z","html_url":"https://github.com/Minecolonies/minecolonies/pull/225#discussion_r85225819","pull_request_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/225","_links":{"self":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments/85225819"},"html":{"href":"https://github.com/Minecolonies/minecolonies/pull/225#discussion_r85225819"},"pull_request":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/225"}}},"pull_request":{"url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/225","id":91082188,"html_url":"https://github.com/Minecolonies/minecolonies/pull/225","diff_url":"https://github.com/Minecolonies/minecolonies/pull/225.diff","patch_url":"https://github.com/Minecolonies/minecolonies/pull/225.patch","issue_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/225","number":225,"state":"open","locked":false,"title":"Feature/#99guards","user":{"login":"Raycoms","id":6438347,"avatar_url":"https://avatars.githubusercontent.com/u/6438347?v=3","gravatar_id":"","url":"https://api.github.com/users/Raycoms","html_url":"https://github.com/Raycoms","followers_url":"https://api.github.com/users/Raycoms/followers","following_url":"https://api.github.com/users/Raycoms/following{/other_user}","gists_url":"https://api.github.com/users/Raycoms/gists{/gist_id}","starred_url":"https://api.github.com/users/Raycoms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Raycoms/subscriptions","organizations_url":"https://api.github.com/users/Raycoms/orgs","repos_url":"https://api.github.com/users/Raycoms/repos","events_url":"https://api.github.com/users/Raycoms/events{/privacy}","received_events_url":"https://api.github.com/users/Raycoms/received_events","type":"User","site_admin":false},"body":"\r\n# Changes proposed in this pull request:\r\n- Adds melee and range guards\r\n\r\n\r\nReview please @Minecolonies/maintainers\r\n","created_at":"2016-10-26T20:30:12Z","updated_at":"2016-10-26T21:35:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9336a31ca3b310cacd68411cae764f9f87d46ae8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/225/commits","review_comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/225/comments","review_comment_url":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Minecolonies/minecolonies/issues/225/comments","statuses_url":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/08c99d04a983f09add767ab809c5d33421ba7b36","head":{"label":"Minecolonies:feature/#99guards","ref":"feature/#99guards","sha":"08c99d04a983f09add767ab809c5d33421ba7b36","user":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars.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://avatars.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":"2016-10-26T20:28:16Z","pushed_at":"2016-10-26T20:30:12Z","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":10411,"stargazers_count":9,"watchers_count":9,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":52,"forks":9,"open_issues":52,"watchers":9,"default_branch":"develop"}},"base":{"label":"Minecolonies:develop","ref":"develop","sha":"a396191deaf2d4e88f1824e9ba65c842d8789171","user":{"login":"Minecolonies","id":5167336,"avatar_url":"https://avatars.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://avatars.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":"2016-10-26T20:28:16Z","pushed_at":"2016-10-26T20:30:12Z","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":10411,"stargazers_count":9,"watchers_count":9,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":52,"forks":9,"open_issues":52,"watchers":9,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/225"},"html":{"href":"https://github.com/Minecolonies/minecolonies/pull/225"},"issue":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/issues/225"},"comments":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/issues/225/comments"},"review_comments":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/225/comments"},"review_comment":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/pulls/225/commits"},"statuses":{"href":"https://api.github.com/repos/Minecolonies/minecolonies/statuses/08c99d04a983f09add767ab809c5d33421ba7b36"}}}}
{"actor":{"display_login":"Raycoms"}}