{"id":383,"date":"2017-06-18T01:14:56","date_gmt":"2017-06-18T01:14:56","guid":{"rendered":"https:\/\/www.triptera.com.au\/wordpress\/?p=383"},"modified":"2017-06-18T02:40:57","modified_gmt":"2017-06-18T02:40:57","slug":"python-in-minecraft-2-placing-many-blocks-individually","status":"publish","type":"post","link":"https:\/\/www.triptera.com.au\/wordpress\/2017\/06\/18\/python-in-minecraft-2-placing-many-blocks-individually\/","title":{"rendered":"Python in Minecraft 2 &#8211; Placing many blocks individually"},"content":{"rendered":"<p>In the last exercise we placed a wool block with variation 1. If you want to know which blocks you can place, check out the reference material at<\/p>\n<p><a href=\"http:\/\/www.stuffaboutcode.com\/p\/minecraft-api-reference.html\">http:\/\/www.stuffaboutcode.com\/p\/minecraft-api-reference.html<\/a><\/p>\n<p>In the next example, the same wool block is placed and glass is placed all around it. Glass doesn&#8217;t have any variations so we are using the first form of the setBlock command<\/p>\n<p><code>nano placeglassaroundwool.py<\/code><\/p>\n<pre class=\"brush: python; title: ; wrap-lines: false; notranslate\" title=\"\">\r\nimport mcpi.minecraft as minecraft\r\nimport mcpi.block as block\r\nmc=minecraft.Minecraft.create()\r\nmc.setBlock(-219,73,-222, block.WOOL.id, 1)\r\nmc.setBlock(-220,72,-223, block.GLASS)\r\nmc.setBlock(-220,72,-222, block.GLASS)\r\nmc.setBlock(-220,72,-221, block.GLASS)\r\nmc.setBlock(-220,73,-223, block.GLASS)\r\nmc.setBlock(-220,73,-222, block.GLASS)\r\nmc.setBlock(-220,73,-221, block.GLASS)\r\nmc.setBlock(-220,74,-223, block.GLASS)\r\nmc.setBlock(-220,74,-222, block.GLASS)\r\nmc.setBlock(-220,74,-221, block.GLASS)\r\nmc.setBlock(-219,72,-223, block.GLASS)\r\nmc.setBlock(-219,72,-222, block.GLASS)\r\nmc.setBlock(-219,72,-221, block.GLASS)\r\nmc.setBlock(-219,73,-223, block.GLASS)\r\nmc.setBlock(-219,73,-221, block.GLASS)\r\nmc.setBlock(-219,74,-223, block.GLASS)\r\nmc.setBlock(-219,74,-222, block.GLASS)\r\nmc.setBlock(-219,74,-221, block.GLASS)\r\nmc.setBlock(-218,72,-223, block.GLASS)\r\nmc.setBlock(-218,72,-222, block.GLASS)\r\nmc.setBlock(-218,72,-221, block.GLASS)\r\nmc.setBlock(-218,73,-223, block.GLASS)\r\nmc.setBlock(-218,73,-222, block.GLASS)\r\nmc.setBlock(-218,73,-221, block.GLASS)\r\nmc.setBlock(-218,74,-223, block.GLASS)\r\nmc.setBlock(-218,74,-222, block.GLASS)\r\nmc.setBlock(-218,74,-221, block.GLASS)\r\n<\/pre>\n<p>Run this python script to see it build in minecraft<\/p>\n<p><code>python3 placeglassaroundwool.py<\/code><\/p>\n<p><a href=\"https:\/\/www.triptera.com.au\/wordpress\/wp-content\/uploads\/2017\/06\/placeglassaroundwool.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-384\" src=\"https:\/\/www.triptera.com.au\/wordpress\/wp-content\/uploads\/2017\/06\/placeglassaroundwool-300x169.png\" alt=\"\" width=\"300\" height=\"169\" srcset=\"https:\/\/www.triptera.com.au\/wordpress\/wp-content\/uploads\/2017\/06\/placeglassaroundwool-300x169.png 300w, https:\/\/www.triptera.com.au\/wordpress\/wp-content\/uploads\/2017\/06\/placeglassaroundwool-768x432.png 768w, https:\/\/www.triptera.com.au\/wordpress\/wp-content\/uploads\/2017\/06\/placeglassaroundwool.png 854w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the last exercise we placed a wool block with variation 1. If you want to know which blocks you can place, check out the reference material at http:\/\/www.stuffaboutcode.com\/p\/minecraft-api-reference.html In the next example, the same wool block is placed and glass is placed all around it. Glass doesn&#8217;t have any variations so we are using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","footnotes":""},"categories":[13],"tags":[],"class_list":["post-383","post","type-post","status-publish","format-standard","hentry","category-coderdojo"],"_links":{"self":[{"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/posts\/383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/comments?post=383"}],"version-history":[{"count":1,"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/posts\/383\/revisions"}],"predecessor-version":[{"id":385,"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/posts\/383\/revisions\/385"}],"wp:attachment":[{"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/media?parent=383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/categories?post=383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.triptera.com.au\/wordpress\/wp-json\/wp\/v2\/tags?post=383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}