{"action":"created","comment":{"url":"https://api.github.com/repos/Vazkii/Botania/pulls/comments/32113726","id":32113726,"diff_hunk":"@@ -0,0 +1,195 @@\n+/**\n+ * This class was created by <SoundLogic>. It's distributed as\n+ * part of the Botania Mod. Get the Source Code in github:\n+ * https://github.com/Vazkii/Botania\n+ * \n+ * Botania is Open Source and distributed under the\n+ * Botania License: http://botaniamod.net/license.php\n+ * \n+ * File Created @ [June 8, 2015, 12:55:20 AM (GMT)]\n+ */\n+package vazkii.botania.client.core.handler;\n+\n+import java.util.ArrayList;\n+import java.util.Comparator;\n+import java.util.Iterator;\n+import java.util.List;\n+import java.util.SortedSet;\n+import java.util.TreeSet;\n+\n+import net.minecraft.client.Minecraft;\n+import net.minecraft.client.gui.GuiChat;\n+import net.minecraft.client.gui.GuiScreen;\n+import net.minecraft.client.gui.GuiTextField;\n+import net.minecraft.creativetab.CreativeTabs;\n+import net.minecraft.item.Item;\n+import net.minecraft.item.ItemStack;\n+import net.minecraft.util.ChatComponentText;\n+\n+import org.lwjgl.input.Keyboard;\n+\n+import vazkii.botania.api.corporea.CorporeaHelper;\n+import vazkii.botania.common.lib.LibObfuscation;\n+import cpw.mods.fml.common.eventhandler.SubscribeEvent;\n+import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;\n+import cpw.mods.fml.common.gameevent.TickEvent.Phase;\n+import cpw.mods.fml.relauncher.ReflectionHelper;\n+\n+public class CorporeaAutoCompleteHandler {\n+\n+\tboolean isAutoCompleted = false;\n+\tString originalString = \"\";\n+\tList<CompletionData> completions = new ArrayList<CompletionData>();\n+\tint position;\n+\n+\tprivate static class CompletionData implements Comparable<CompletionData> {\n+\n+\t\tprivate String string;\n+\t\tprivate int prefixLength;\n+\n+\t\tpublic CompletionData(String string, int prefixLength) {\n+\t\t\tthis.string = string;\n+\t\t\tthis.prefixLength = prefixLength;\n+\t\t}\n+\n+\t\t@Override\n+\t\tpublic int compareTo(CompletionData arg0) {\n+\t\t\treturn string.compareTo(arg0.string);\n+\t\t}\n+\t}\n+\n+\tstatic TreeSet<String> itemNames = new TreeSet<String>(\n+\t\t\tnew Comparator<String>() {\n+\t\t\t\t@Override\n+\t\t\t\tpublic int compare(String arg0, String arg1) {\n+\t\t\t\t\treturn arg0.compareToIgnoreCase(arg1);\n+\t\t\t\t}\n+\t\t\t});\n+\n+\tprivate boolean tabLastTick = false;\n+\n+\tpublic static void updateItemList() {\n+\t\titemNames.clear();\n+\t\tIterator<Item> iterator = Item.itemRegistry.iterator();\n+\t\tArrayList<ItemStack> curList = new ArrayList<ItemStack>();\n+\n+\t\twhile (iterator.hasNext()) {\n+\t\t\tItem item = iterator.next();\n+\n+\t\t\tif (item != null && item.getCreativeTab() != null) {\n+\t\t\t\tcurList.clear();\n+\t\t\t\ttry {\n+\t\t\t\t\titem.getSubItems(item, (CreativeTabs) null, curList);\n+\t\t\t\t\tfor (ItemStack stack : curList) {\n+\t\t\t\t\t\titemNames.add(stack.getDisplayName().trim());\n+\t\t\t\t\t}\n+\t\t\t\t}\n+\t\t\t\tcatch (Exception e) {}\n+\t\t\t}\n+\t\t}\n+\t}\n+\n+\t@SubscribeEvent\n+\tpublic void onTick(ClientTickEvent event) {\n+\t\tif (event.phase != Phase.END)\n+\t\t\treturn;\n+\t\tGuiScreen screen = Minecraft.getMinecraft().currentScreen;\n+\t\tif (!(screen instanceof GuiChat)) {\n+\t\t\tisAutoCompleted = false;\n+\t\t\treturn;\n+\t\t}\n+\t\tGuiChat chat = (GuiChat) screen;\n+\t\tif (isAutoCompleted) {\n+\t\t\tboolean valid = ReflectionHelper.getPrivateValue(GuiChat.class, chat, LibObfuscation.COMPLETE_FLAG);\n+\t\t\tif (!valid) {","path":"src/main/java/vazkii/botania/client/core/handler/CorporeaAutoCompleteHandler.java","position":104,"original_position":104,"commit_id":"88850bce48523392ba93f88ed53b2156b868518d","original_commit_id":"88850bce48523392ba93f88ed53b2156b868518d","user":{"login":"soundlogic2236","id":2828052,"avatar_url":"https://avatars.githubusercontent.com/u/2828052?v=3","gravatar_id":"","url":"https://api.github.com/users/soundlogic2236","html_url":"https://github.com/soundlogic2236","followers_url":"https://api.github.com/users/soundlogic2236/followers","following_url":"https://api.github.com/users/soundlogic2236/following{/other_user}","gists_url":"https://api.github.com/users/soundlogic2236/gists{/gist_id}","starred_url":"https://api.github.com/users/soundlogic2236/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soundlogic2236/subscriptions","organizations_url":"https://api.github.com/users/soundlogic2236/orgs","repos_url":"https://api.github.com/users/soundlogic2236/repos","events_url":"https://api.github.com/users/soundlogic2236/events{/privacy}","received_events_url":"https://api.github.com/users/soundlogic2236/received_events","type":"User","site_admin":false},"body":"Oh! The !valid bit. github broke that up. I shall fix","created_at":"2015-06-10T12:55:36Z","updated_at":"2015-06-10T12:55:36Z","html_url":"https://github.com/Vazkii/Botania/pull/1077#discussion_r32113726","pull_request_url":"https://api.github.com/repos/Vazkii/Botania/pulls/1077","_links":{"self":{"href":"https://api.github.com/repos/Vazkii/Botania/pulls/comments/32113726"},"html":{"href":"https://github.com/Vazkii/Botania/pull/1077#discussion_r32113726"},"pull_request":{"href":"https://api.github.com/repos/Vazkii/Botania/pulls/1077"}}},"pull_request":{"url":"https://api.github.com/repos/Vazkii/Botania/pulls/1077","id":37280571,"html_url":"https://github.com/Vazkii/Botania/pull/1077","diff_url":"https://github.com/Vazkii/Botania/pull/1077.diff","patch_url":"https://github.com/Vazkii/Botania/pull/1077.patch","issue_url":"https://api.github.com/repos/Vazkii/Botania/issues/1077","number":1077,"state":"open","locked":false,"title":"Added Corporea Autocompletion system","user":{"login":"soundlogic2236","id":2828052,"avatar_url":"https://avatars.githubusercontent.com/u/2828052?v=3","gravatar_id":"","url":"https://api.github.com/users/soundlogic2236","html_url":"https://github.com/soundlogic2236","followers_url":"https://api.github.com/users/soundlogic2236/followers","following_url":"https://api.github.com/users/soundlogic2236/following{/other_user}","gists_url":"https://api.github.com/users/soundlogic2236/gists{/gist_id}","starred_url":"https://api.github.com/users/soundlogic2236/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soundlogic2236/subscriptions","organizations_url":"https://api.github.com/users/soundlogic2236/orgs","repos_url":"https://api.github.com/users/soundlogic2236/repos","events_url":"https://api.github.com/users/soundlogic2236/events{/privacy}","received_events_url":"https://api.github.com/users/soundlogic2236/received_events","type":"User","site_admin":false},"body":"Lag free with 120 mods and facades!","created_at":"2015-06-09T17:53:09Z","updated_at":"2015-06-10T12:55:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a72ce89ed6c07e157f68d947de4ea616b11fe9f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Vazkii/Botania/pulls/1077/commits","review_comments_url":"https://api.github.com/repos/Vazkii/Botania/pulls/1077/comments","review_comment_url":"https://api.github.com/repos/Vazkii/Botania/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Vazkii/Botania/issues/1077/comments","statuses_url":"https://api.github.com/repos/Vazkii/Botania/statuses/88850bce48523392ba93f88ed53b2156b868518d","head":{"label":"soundlogic2236:master","ref":"master","sha":"88850bce48523392ba93f88ed53b2156b868518d","user":{"login":"soundlogic2236","id":2828052,"avatar_url":"https://avatars.githubusercontent.com/u/2828052?v=3","gravatar_id":"","url":"https://api.github.com/users/soundlogic2236","html_url":"https://github.com/soundlogic2236","followers_url":"https://api.github.com/users/soundlogic2236/followers","following_url":"https://api.github.com/users/soundlogic2236/following{/other_user}","gists_url":"https://api.github.com/users/soundlogic2236/gists{/gist_id}","starred_url":"https://api.github.com/users/soundlogic2236/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soundlogic2236/subscriptions","organizations_url":"https://api.github.com/users/soundlogic2236/orgs","repos_url":"https://api.github.com/users/soundlogic2236/repos","events_url":"https://api.github.com/users/soundlogic2236/events{/privacy}","received_events_url":"https://api.github.com/users/soundlogic2236/received_events","type":"User","site_admin":false},"repo":{"id":37093760,"name":"Botania","full_name":"soundlogic2236/Botania","owner":{"login":"soundlogic2236","id":2828052,"avatar_url":"https://avatars.githubusercontent.com/u/2828052?v=3","gravatar_id":"","url":"https://api.github.com/users/soundlogic2236","html_url":"https://github.com/soundlogic2236","followers_url":"https://api.github.com/users/soundlogic2236/followers","following_url":"https://api.github.com/users/soundlogic2236/following{/other_user}","gists_url":"https://api.github.com/users/soundlogic2236/gists{/gist_id}","starred_url":"https://api.github.com/users/soundlogic2236/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soundlogic2236/subscriptions","organizations_url":"https://api.github.com/users/soundlogic2236/orgs","repos_url":"https://api.github.com/users/soundlogic2236/repos","events_url":"https://api.github.com/users/soundlogic2236/events{/privacy}","received_events_url":"https://api.github.com/users/soundlogic2236/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/soundlogic2236/Botania","description":"A magic mod for Minecraft based on nature and plant life.","fork":true,"url":"https://api.github.com/repos/soundlogic2236/Botania","forks_url":"https://api.github.com/repos/soundlogic2236/Botania/forks","keys_url":"https://api.github.com/repos/soundlogic2236/Botania/keys{/key_id}","collaborators_url":"https://api.github.com/repos/soundlogic2236/Botania/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/soundlogic2236/Botania/teams","hooks_url":"https://api.github.com/repos/soundlogic2236/Botania/hooks","issue_events_url":"https://api.github.com/repos/soundlogic2236/Botania/issues/events{/number}","events_url":"https://api.github.com/repos/soundlogic2236/Botania/events","assignees_url":"https://api.github.com/repos/soundlogic2236/Botania/assignees{/user}","branches_url":"https://api.github.com/repos/soundlogic2236/Botania/branches{/branch}","tags_url":"https://api.github.com/repos/soundlogic2236/Botania/tags","blobs_url":"https://api.github.com/repos/soundlogic2236/Botania/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/soundlogic2236/Botania/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/soundlogic2236/Botania/git/refs{/sha}","trees_url":"https://api.github.com/repos/soundlogic2236/Botania/git/trees{/sha}","statuses_url":"https://api.github.com/repos/soundlogic2236/Botania/statuses/{sha}","languages_url":"https://api.github.com/repos/soundlogic2236/Botania/languages","stargazers_url":"https://api.github.com/repos/soundlogic2236/Botania/stargazers","contributors_url":"https://api.github.com/repos/soundlogic2236/Botania/contributors","subscribers_url":"https://api.github.com/repos/soundlogic2236/Botania/subscribers","subscription_url":"https://api.github.com/repos/soundlogic2236/Botania/subscription","commits_url":"https://api.github.com/repos/soundlogic2236/Botania/commits{/sha}","git_commits_url":"https://api.github.com/repos/soundlogic2236/Botania/git/commits{/sha}","comments_url":"https://api.github.com/repos/soundlogic2236/Botania/comments{/number}","issue_comment_url":"https://api.github.com/repos/soundlogic2236/Botania/issues/comments{/number}","contents_url":"https://api.github.com/repos/soundlogic2236/Botania/contents/{+path}","compare_url":"https://api.github.com/repos/soundlogic2236/Botania/compare/{base}...{head}","merges_url":"https://api.github.com/repos/soundlogic2236/Botania/merges","archive_url":"https://api.github.com/repos/soundlogic2236/Botania/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/soundlogic2236/Botania/downloads","issues_url":"https://api.github.com/repos/soundlogic2236/Botania/issues{/number}","pulls_url":"https://api.github.com/repos/soundlogic2236/Botania/pulls{/number}","milestones_url":"https://api.github.com/repos/soundlogic2236/Botania/milestones{/number}","notifications_url":"https://api.github.com/repos/soundlogic2236/Botania/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/soundlogic2236/Botania/labels{/name}","releases_url":"https://api.github.com/repos/soundlogic2236/Botania/releases{/id}","created_at":"2015-06-08T21:26:13Z","updated_at":"2015-06-08T21:26:16Z","pushed_at":"2015-06-09T17:50:21Z","git_url":"git://github.com/soundlogic2236/Botania.git","ssh_url":"git@github.com:soundlogic2236/Botania.git","clone_url":"https://github.com/soundlogic2236/Botania.git","svn_url":"https://github.com/soundlogic2236/Botania","homepage":"http://botaniamod.net/","size":23422,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"Vazkii:master","ref":"master","sha":"f29202758321d48b1e618b527f63fcd308455c16","user":{"login":"Vazkii","id":1794735,"avatar_url":"https://avatars.githubusercontent.com/u/1794735?v=3","gravatar_id":"","url":"https://api.github.com/users/Vazkii","html_url":"https://github.com/Vazkii","followers_url":"https://api.github.com/users/Vazkii/followers","following_url":"https://api.github.com/users/Vazkii/following{/other_user}","gists_url":"https://api.github.com/users/Vazkii/gists{/gist_id}","starred_url":"https://api.github.com/users/Vazkii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vazkii/subscriptions","organizations_url":"https://api.github.com/users/Vazkii/orgs","repos_url":"https://api.github.com/users/Vazkii/repos","events_url":"https://api.github.com/users/Vazkii/events{/privacy}","received_events_url":"https://api.github.com/users/Vazkii/received_events","type":"User","site_admin":false},"repo":{"id":15870488,"name":"Botania","full_name":"Vazkii/Botania","owner":{"login":"Vazkii","id":1794735,"avatar_url":"https://avatars.githubusercontent.com/u/1794735?v=3","gravatar_id":"","url":"https://api.github.com/users/Vazkii","html_url":"https://github.com/Vazkii","followers_url":"https://api.github.com/users/Vazkii/followers","following_url":"https://api.github.com/users/Vazkii/following{/other_user}","gists_url":"https://api.github.com/users/Vazkii/gists{/gist_id}","starred_url":"https://api.github.com/users/Vazkii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vazkii/subscriptions","organizations_url":"https://api.github.com/users/Vazkii/orgs","repos_url":"https://api.github.com/users/Vazkii/repos","events_url":"https://api.github.com/users/Vazkii/events{/privacy}","received_events_url":"https://api.github.com/users/Vazkii/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Vazkii/Botania","description":"A magic mod for Minecraft based on nature and plant life.","fork":false,"url":"https://api.github.com/repos/Vazkii/Botania","forks_url":"https://api.github.com/repos/Vazkii/Botania/forks","keys_url":"https://api.github.com/repos/Vazkii/Botania/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Vazkii/Botania/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Vazkii/Botania/teams","hooks_url":"https://api.github.com/repos/Vazkii/Botania/hooks","issue_events_url":"https://api.github.com/repos/Vazkii/Botania/issues/events{/number}","events_url":"https://api.github.com/repos/Vazkii/Botania/events","assignees_url":"https://api.github.com/repos/Vazkii/Botania/assignees{/user}","branches_url":"https://api.github.com/repos/Vazkii/Botania/branches{/branch}","tags_url":"https://api.github.com/repos/Vazkii/Botania/tags","blobs_url":"https://api.github.com/repos/Vazkii/Botania/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Vazkii/Botania/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Vazkii/Botania/git/refs{/sha}","trees_url":"https://api.github.com/repos/Vazkii/Botania/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Vazkii/Botania/statuses/{sha}","languages_url":"https://api.github.com/repos/Vazkii/Botania/languages","stargazers_url":"https://api.github.com/repos/Vazkii/Botania/stargazers","contributors_url":"https://api.github.com/repos/Vazkii/Botania/contributors","subscribers_url":"https://api.github.com/repos/Vazkii/Botania/subscribers","subscription_url":"https://api.github.com/repos/Vazkii/Botania/subscription","commits_url":"https://api.github.com/repos/Vazkii/Botania/commits{/sha}","git_commits_url":"https://api.github.com/repos/Vazkii/Botania/git/commits{/sha}","comments_url":"https://api.github.com/repos/Vazkii/Botania/comments{/number}","issue_comment_url":"https://api.github.com/repos/Vazkii/Botania/issues/comments{/number}","contents_url":"https://api.github.com/repos/Vazkii/Botania/contents/{+path}","compare_url":"https://api.github.com/repos/Vazkii/Botania/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Vazkii/Botania/merges","archive_url":"https://api.github.com/repos/Vazkii/Botania/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Vazkii/Botania/downloads","issues_url":"https://api.github.com/repos/Vazkii/Botania/issues{/number}","pulls_url":"https://api.github.com/repos/Vazkii/Botania/pulls{/number}","milestones_url":"https://api.github.com/repos/Vazkii/Botania/milestones{/number}","notifications_url":"https://api.github.com/repos/Vazkii/Botania/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Vazkii/Botania/labels{/name}","releases_url":"https://api.github.com/repos/Vazkii/Botania/releases{/id}","created_at":"2014-01-13T14:30:52Z","updated_at":"2015-06-08T20:13:34Z","pushed_at":"2015-06-10T00:51:59Z","git_url":"git://github.com/Vazkii/Botania.git","ssh_url":"git@github.com:Vazkii/Botania.git","clone_url":"https://github.com/Vazkii/Botania.git","svn_url":"https://github.com/Vazkii/Botania","homepage":"http://botaniamod.net/","size":35613,"stargazers_count":192,"watchers_count":192,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":121,"mirror_url":null,"open_issues_count":7,"forks":121,"open_issues":7,"watchers":192,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Vazkii/Botania/pulls/1077"},"html":{"href":"https://github.com/Vazkii/Botania/pull/1077"},"issue":{"href":"https://api.github.com/repos/Vazkii/Botania/issues/1077"},"comments":{"href":"https://api.github.com/repos/Vazkii/Botania/issues/1077/comments"},"review_comments":{"href":"https://api.github.com/repos/Vazkii/Botania/pulls/1077/comments"},"review_comment":{"href":"https://api.github.com/repos/Vazkii/Botania/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Vazkii/Botania/pulls/1077/commits"},"statuses":{"href":"https://api.github.com/repos/Vazkii/Botania/statuses/88850bce48523392ba93f88ed53b2156b868518d"}}}}