{"id":152,"date":"2016-05-07T19:50:02","date_gmt":"2016-05-07T19:50:02","guid":{"rendered":"http:\/\/timbertops.co.uk\/blog\/?p=152"},"modified":"2019-04-04T20:23:57","modified_gmt":"2019-04-04T19:23:57","slug":"computercraft-automatic-enchantment-sorter","status":"publish","type":"post","link":"https:\/\/timbertops.co.uk\/index.php\/2016\/05\/07\/computercraft-automatic-enchantment-sorter\/","title":{"rendered":"Computercraft automatic enchantment sorter"},"content":{"rendered":"<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"lua\">local chest = peripheral.wrap(\"front\")\r\nprint(\"Radcom's Enchantment sorter V1.2\")\r\nwhile true do\r\n    sleep(1)\r\n    for i = 1, chest.getInventorySize() do\r\n        local item = chest.getStackInSlot(i)\r\n        if item and item.ench then\r\n            print(\"Found a \", item.name, \" with an enchantment\")\r\n            print(\"Moving\")\r\n            chest.pushItem(\"south\",i,1)\r\n        else\r\n            if item then\r\n                print(\"moving: \",item.qty, \" \",item.name)\r\n                chest.pushItem(\"east\",i,item.qty)\r\n            end\r\n        end\r\n     end\r\nend<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>local chest = peripheral.wrap(&#8220;front&#8221;) print(&#8220;Radcom&#8217;s Enchantment sorter V1.2&#8221;) while true do sleep(1) for i = 1, chest.getInventorySize() do local item = chest.getStackInSlot(i) if item and item.ench then print(&#8220;Found a &#8220;, item.name, &#8221; with an enchantment&#8221;) print(&#8220;Moving&#8221;) chest.pushItem(&#8220;south&#8221;,i,1) else if item then print(&#8220;moving: &#8220;,item.qty, &#8221; &#8220;,item.name) chest.pushItem(&#8220;east&#8221;,i,item.qty) end end end end &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-152","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/152","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=152"}],"version-history":[{"count":6,"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/152\/revisions"}],"predecessor-version":[{"id":201,"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/152\/revisions\/201"}],"wp:attachment":[{"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/timbertops.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}