Advertisement
guitarplayer616

build improved

Aug 24th, 2018
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 32.06 KB | None | 0 0
  1. local sArg = ...
  2.  
  3. function getPaste(key,file)
  4.     local h = http.get("http://pastebin.com/raw/"..textutils.urlEncode(tostring(key)))
  5.     local code = h.readAll()
  6.     h.close()
  7.  
  8.     local new = fs.open(tostring(file),"w")
  9.     new.write(code)
  10.     new.close()
  11. end
  12.  
  13. if not fs.exists("market") then
  14.     getPaste("BztihKh3" ,"market")
  15. end
  16. if not sArg then
  17.     shell.run("market")
  18.     error()
  19. else
  20.     if not fs.exists(sArg) then
  21.         shell.run("market "..sArg)
  22.     end
  23.     h = fs.open(sArg,"rb")
  24. end
  25.  
  26. Schematic = {
  27.     boundary = {
  28.     --bounds of the schematic
  29.         ['x'] = 0,
  30.         ['y'] = 0,
  31.         ['z'] = 0,
  32.     },
  33.     current = {
  34.     --current position of turtle
  35.         ['x'] = -1,
  36.         ['y'] = 0,
  37.         ['z'] = 0,
  38.         ['direction'] = 0,
  39.     },
  40.     target = {
  41.     --the next objective of where to place the block and what that block is
  42.         ['x'] = 0,
  43.         ['y'] = 0,
  44.         ['z'] = 0,
  45.         ["ascendingY"] = true,
  46.         ["ascendingZ"] = true,
  47.         ["block"] = {
  48.             ["id"] = 0,
  49.             ["name"] = "",
  50.             ["data"] = 0,
  51.             ["slots"] = {
  52.                 0,
  53.                 1,
  54.                 2,
  55.             }
  56.         },
  57.     },
  58.     inventory = {
  59.     --what's inside the turtle's slots
  60.     },
  61.    
  62.     mt = {},
  63.     new = function()
  64.         local instance = {}
  65.         --shallow copy of functions
  66.         setmetatable(instance,Schematic.mt)
  67.         --deep copy of tables
  68.         local boundary = textutils.serialize(Schematic.boundary)
  69.         local current = textutils.serialize(Schematic.current)
  70.         local target = textutils.serialize(Schematic.target)
  71.        
  72.         instance.boundary = textutils.unserialize(boundary)
  73.         instance.current = textutils.unserialize(current)
  74.         instance.target = textutils.unserialize(target)
  75.         return instance
  76.     end,
  77.    
  78.     iterateZ = function(self)
  79.         if self.target.ascendingZ then
  80.             if self.target.z < self.boundary.z then
  81.                 self.target.z = self.target.z + 1
  82.             else
  83.                 self:iterateY()
  84.                 self.target.ascendingZ = false
  85.             end
  86.         else
  87.             if self.target.z > 0 then
  88.                 self.target.z = self.target.z - 1
  89.             else
  90.                 self:iterateY()
  91.                 self.target.ascendingZ = true
  92.             end
  93.         end
  94.     end,
  95.    
  96.     iterateY = function(self)
  97.         if self.target.ascendingY then
  98.             if self.target.y < self.boundary.y then
  99.                 self.target.y = self.target.y + 1
  100.             else
  101.                 self:iterateX()
  102.                 self.target.ascendingY = false
  103.             end
  104.         else
  105.             if self.target.y > 0 then
  106.                 self.target.y = self.target.y - 1
  107.             else
  108.                 self:iterateX()
  109.                 self.target.ascendingY = true
  110.             end
  111.         end
  112.     end,
  113.    
  114.     iterateX = function(self)
  115.         if self.target.x < self.boundary.x then
  116.             self.target.x = self.target.x + 1
  117.         else
  118.             print("finished")
  119.             self:goto(self.boundary.x,-1,-1)
  120.             self:goto(-1,-1,-1)
  121.             self:turn(0)
  122.             error()
  123.         end
  124.     end,
  125.    
  126.     turnRight = function(self)
  127.         turtle.turnRight()
  128.         self.current.direction = (self.current.direction + 1)%4
  129.     end,
  130.    
  131.     turnLeft = function(self)
  132.         turtle.turnLeft()
  133.         self.current.direction = (self.current.direction - 1)%4
  134.     end,
  135.    
  136.     forward = function(self)
  137.         while not turtle.forward() do
  138.             turtle.dig()
  139.         end
  140.         if self.current.direction == 0 then
  141.             self.current.z = self.current.z + 1
  142.         elseif self.current.direction == 1 then
  143.             self.current.y = self.current.y - 1
  144.         elseif self.current.direction == 2 then
  145.             self.current.z = self.current.z - 1
  146.         elseif self.current.direction == 3 then
  147.             self.current.y = self.current.y + 1
  148.         end
  149.     end,
  150.  
  151.     up = function(self)
  152.         while not turtle.up() do
  153.             turtle.digUp()
  154.         end
  155.         self.current.x = self.current.x + 1
  156.     end,
  157.  
  158.     down = function(self)
  159.         while not turtle.down() do
  160.             turtle.digDown()
  161.         end
  162.         self.current.x = self.current.x - 1
  163.     end,
  164.  
  165.     place = function(self)
  166.         while not turtle.placeDown() do
  167.             turtle.digDown()
  168.         end
  169.         local n = turtle.getSelectedSlot()
  170.         self.inventory[n].count = self.inventory[n].count - 1
  171.     end,
  172.    
  173.     turn = function(self,direction)
  174.         --0,1,2,3
  175.         --make more efficient later
  176.         local leftDirection = (self.current.direction - 1)%4
  177.         if leftDirection == direction then
  178.             self:turnLeft()
  179.         else
  180.             while self.current.direction ~= direction do
  181.                 self:turnRight()
  182.             end
  183.         end
  184.     end,
  185.    
  186.     goto = function(self,heightGoal,widthGoal,lengthGoal)
  187.         heightGoal = heightGoal or self.target.x
  188.         widthGoal = widthGoal or self.target.y
  189.         lengthGoal = lengthGoal or self.target.z
  190.        
  191.         while heightGoal > self.current.x do
  192.             self:up()
  193.         end
  194.         while heightGoal < self.current.x do
  195.             self:down()
  196.         end
  197.         if widthGoal > self.current.y then
  198.             self:turn(3)
  199.             while widthGoal > self.current.y do
  200.                 self:forward()
  201.             end
  202.         elseif widthGoal < self.current.y then
  203.             self:turn(1)
  204.             while widthGoal < self.current.y do
  205.                 self:forward()
  206.             end
  207.         end
  208.         if lengthGoal > self.current.z then
  209.             self:turn(0)
  210.             while lengthGoal > self.current.z do
  211.                 self:forward()
  212.             end
  213.         elseif lengthGoal < self.current.z then
  214.             self:turn(2)
  215.             while lengthGoal < self.current.z do
  216.                 self:forward()
  217.             end
  218.         end
  219.     end,
  220.    
  221.     recordInventory = function(self,nBlock,nData)
  222.     --given int blockID and int nData, find the item in the turtle's inventory
  223.         local s = turtle.getSelectedSlot() - 1
  224.         for n = s,s+15 do
  225.             n = (n%16)+1
  226.             turtle.select(n)
  227.             local tData = turtle.getItemDetail(n)
  228.             self.inventory[n] = tData
  229.         end
  230.     end,
  231.    
  232.     select = function(self,nBlock,nData)
  233.     --find the block using the inventory table
  234.         local s = turtle.getSelectedSlot() - 1
  235.         for n = s,(s+15) do
  236.             n = n%16
  237.             n = n + 1
  238.             local tData = self.inventory[n]
  239.             if tData and block_name[nBlock] and tData.name == block_name[nBlock] and tData.count > 0 then
  240.             --if an item is there and the id matches a blockName and that blockName matches the itemName and there is some left then
  241.                 if nBlock == 35 or nBlock == 5 or nBlock ==17 or nBlock == 98 or nBlock ==159 or nBlock == 160 or nBlock == 171 then
  242.                 --if it's wool or wood or stone bricks then check the data
  243.                     if tData.damage == nData then
  244.                         return n
  245.                     end
  246.                 else
  247.                 --otherwise the block_id matching is good enough
  248.                     return n
  249.                 end
  250.             end
  251.         end
  252.     end,
  253. }
  254.  
  255. Schematic.mt.__index = Schematic
  256. Schematic.mt.__tostring = function(self)
  257.     return tostring(self.current.x).." "..tostring(self.current.y).." "..tostring(self.current.z)
  258. end
  259.  
  260. block_name = {
  261.   "minecraft:stone",
  262.   "minecraft:grass",
  263.   "minecraft:dirt",
  264.   "minecraft:cobblestone",
  265.   "minecraft:planks",
  266.   "minecraft:sapling",
  267.   "minecraft:bedrock",
  268.   "minecraft:flowing_water",
  269.   "minecraft:water",
  270.   "minecraft:flowing_lava",
  271.   "minecraft:lava",
  272.   "minecraft:sand",
  273.   "minecraft:gravel",
  274.   "minecraft:gold_ore",
  275.   "minecraft:iron_ore",
  276.   "minecraft:coal_ore",
  277.   "minecraft:log",
  278.   "minecraft:leaves",
  279.   "minecraft:sponge",
  280.   "minecraft:glass",
  281.   "minecraft:lapis_ore",
  282.   "minecraft:lapis_block",
  283.   "minecraft:dispenser",
  284.   "minecraft:sandstone",
  285.   "minecraft:noteblock",
  286.   "minecraft:bed",
  287.   "minecraft:golden_rail",
  288.   "minecraft:detector_rail",
  289.   "minecraft:sticky_piston",
  290.   "minecraft:web",
  291.   "minecraft:tallgrass",
  292.   "minecraft:deadbush",
  293.   "minecraft:piston",
  294.   "minecraft:piston_head",
  295.   "minecraft:wool",
  296.   [ 37 ] = "minecraft:yellow_flower",
  297.   [ 38 ] = "minecraft:red_flower",
  298.   [ 39 ] = "minecraft:brown_mushroom",
  299.   [ 40 ] = "minecraft:red_mushroom",
  300.   [ 41 ] = "minecraft:gold_block",
  301.   [ 42 ] = "minecraft:iron_block",
  302.   [ 43 ] = "minecraft:double_stone_slab",
  303.   [ 44 ] = "minecraft:stone_slab",
  304.   [ 45 ] = "minecraft:brick_block",
  305.   [ 46 ] = "minecraft:tnt",
  306.   [ 47 ] = "minecraft:bookshelf",
  307.   [ 48 ] = "minecraft:mossy_cobblestone",
  308.   [ 49 ] = "minecraft:obsidian",
  309.   [ 50 ] = "minecraft:torch",
  310.   [ 51 ] = "minecraft:fire",
  311.   [ 52 ] = "minecraft:mob_spawner",
  312.   [ 53 ] = "minecraft:oak_stairs",
  313.   [ 54 ] = "minecraft:chest",
  314.   [ 55 ] = "minecraft:redstone_wire",
  315.   [ 56 ] = "minecraft:diamond_ore",
  316.   [ 57 ] = "minecraft:diamond_block",
  317.   [ 58 ] = "minecraft:crafting_table",
  318.   [ 59 ] = "minecraft:wheat",
  319.   [ 60 ] = "minecraft:farmland",
  320.   [ 61 ] = "minecraft:furnace",
  321.   [ 62 ] = "minecraft:lit_furnace",
  322.   [ 63 ] = "minecraft:standing_sign",
  323.   [ 64 ] = "minecraft:wooden_door",
  324.   [ 65 ] = "minecraft:ladder",
  325.   [ 66 ] = "minecraft:rail",
  326.   [ 67 ] = "minecraft:stone_stairs",
  327.   [ 68 ] = "minecraft:wall_sign",
  328.   [ 69 ] = "minecraft:lever",
  329.   [ 70 ] = "minecraft:stone_pressure_plate",
  330.   [ 71 ] = "minecraft:iron_door",
  331.   [ 72 ] = "minecraft:wooden_pressure_plate",
  332.   [ 73 ] = "minecraft:redstone_ore",
  333.   [ 74 ] = "minecraft:lit_redstone_ore",
  334.   [ 75 ] = "off",
  335.   [ 78 ] = "minecraft:snow_layer",
  336.   [ 79 ] = "minecraft:ice",
  337.   [ 80 ] = "minecraft:snow",
  338.   [ 81 ] = "minecraft:cactus",
  339.   [ 82 ] = "minecraft:clay",
  340.   [ 83 ] = "minecraft:reeds",
  341.   [ 84 ] = "minecraft:jukebox",
  342.   [ 85 ] = "minecraft:fence",
  343.   [ 86 ] = "minecraft:pumpkin",
  344.   [ 87 ] = "minecraft:netherrack",
  345.   [ 88 ] = "minecraft:soul_sand",
  346.   [ 89 ] = "minecraft:glowstone",
  347.   [ 90 ] = "minecraft:portal",
  348.   [ 91 ] = "minecraft:lit_pumpkin",
  349.   [ 92 ] = "minecraft:cake",
  350.   [ 93 ] = "off",
  351.   [ 96 ] = "minecraft:trapdoor",
  352.   [ 97 ] = "minecraft:monster_egg",
  353.   [ 98 ] = "minecraft:stonebrick",
  354.   [ 99 ] = "minecraft:brown_mushroom_block",
  355.   [ 100 ] = "minecraft:red_mushroom_block",
  356.   [ 101 ] = "minecraft:iron_bars",
  357.   [ 102 ] = "minecraft:glass_pane",
  358.   [ 103 ] = "minecraft:melon_block",
  359.   [ 104 ] = "minecraft:pumpkin_stem",
  360.   [ 105 ] = "minecraft:melon_stem",
  361.   [ 106 ] = "minecraft:vine",
  362.   [ 107 ] = "minecraft:fence_gate",
  363.   [ 108 ] = "minecraft:brick_stairs",
  364.   [ 109 ] = "minecraft:stone_brick_stairs",
  365.   [ 110 ] = "minecraft:mycelium",
  366.   [ 111 ] = "minecraft:waterlily",
  367.   [ 112 ] = "minecraft:nether_brick",
  368.   [ 113 ] = "minecraft:nether_brick_fence",
  369.   [ 114 ] = "minecraft:nether_brick_stairs",
  370.   [ 115 ] = "minecraft:nether_wart",
  371.   [ 116 ] = "minecraft:enchanting_table",
  372.   [ 117 ] = "minecraft:brewing_stand",
  373.   [ 118 ] = "minecraft:cauldron",
  374.   [ 119 ] = "minecraft:end_portal",
  375.   [ 120 ] = "minecraft:end_portal_frame",
  376.   [ 121 ] = "minecraft:end_stone",
  377.   [ 122 ] = "minecraft:dragon_egg",
  378.   [ 123 ] = "inactive",
  379.   [ 126 ] = "minecraft:wooden_slab",
  380.   [ 127 ] = "minecraft:cocoa",
  381.   [ 128 ] = "minecraft:sandstone_stairs",
  382.   [ 129 ] = "minecraft:emerald_ore",
  383.   [ 130 ] = "minecraft:ender_chest",
  384.   [ 131 ] = "minecraft:tripwire_hook",
  385.   [ 132 ] = "minecraft:tripwire_hook",
  386.   [ 133 ] = "minecraft:emerald_block",
  387.   [ 134 ] = "minecraft:spruce_stairs",
  388.   [ 135 ] = "minecraft:birch_stairs",
  389.   [ 136 ] = "minecraft:jungle_stairs",
  390.   [ 137 ] = "minecraft:command_block",
  391.   [ 138 ] = "minecraft:beacon",
  392.   [ 139 ] = "minecraft:cobblestone_wall",
  393.   [ 140 ] = "minecraft:flower_pot",
  394.   [ 141 ] = "minecraft:carrots",
  395.   [ 142 ] = "minecraft:potatoes",
  396.   [ 143 ] = "minecraft:wooden_button",
  397.   [ 144 ] = "minecraft:skull",
  398.   [ 145 ] = "minecraft:anvil",
  399.   [ 146 ] = "minecraft:trapped_chest",
  400.   [ 147 ] = "light",
  401.   [ 152 ] = "minecraft:redstone_block",
  402.   [ 153 ] = "minecraft:quartz_ore",
  403.   [ 154 ] = "minecraft:hopper",
  404.   [ 155 ] = "minecraft:quartz_block",
  405.   [ 156 ] = "minecraft:quartz_stairs",
  406.   [ 157 ] = "minecraft:activator_rail",
  407.   [ 158 ] = "minecraft:dropper",
  408.   [ 159 ] = "minecraft:stained_hardened_clay",
  409.   [ 160 ] = "minecraft:stained_glass_pane",
  410.   [ 161 ] = "minecraft:leaves2",
  411.   [ 162 ] = "minecraft:log2",
  412.   [ 163 ] = "minecraft:acacia_stairs",
  413.   [ 164 ] = "minecraft:dark_oak_stairs",
  414.   [ 165 ] = "minecraft:slime",
  415.   [ 166 ] = "minecraft:barrier",
  416.   [ 167 ] = "minecraft:iron_trapdoor",
  417.   [ 168 ] = "minecraft:prismarine",
  418.   [ 169 ] = "minecraft:sea_lantern",
  419.   [ 170 ] = "minecraft:hay_block",
  420.   [ 171 ] = "minecraft:carpet",
  421.   [ 172 ] = "minecraft:hardened_clay",
  422.   [ 173 ] = "minecraft:coal_block",
  423.   [ 174 ] = "minecraft:packed_ice",
  424.   [ 175 ] = "minecraft:double_plant",
  425.   [ 176 ] = "minecraft:standing_banner",
  426.   [ 177 ] = "minecraft:wall_banner",
  427.   [ 178 ] = "minecraft:daylight_detector_inverted",
  428.   [ 179 ] = "minecraft:red_sandstone",
  429.   [ 180 ] = "minecraft:red_sandstone_stairs",
  430.   [ 181 ] = "minecraft:double_stone_slab2",
  431.   [ 182 ] = "minecraft:stone_slab2",
  432.   [ 183 ] = "minecraft:spruce_fence_gate",
  433.   [ 184 ] = "minecraft:birch_fence_gate",
  434.   [ 185 ] = "minecraft:jungle_fence_gate",
  435.   [ 186 ] = "minecraft:dark_oak_fence_gate",
  436.   [ 187 ] = "minecraft:acacia_fence_gate",
  437.   [ 188 ] = "minecraft:spruce_fence",
  438.   [ 189 ] = "minecraft:birch_fence",
  439.   [ 190 ] = "minecraft:jungle_fence",
  440.   [ 191 ] = "minecraft:dark_oak_fence",
  441.   [ 192 ] = "minecraft:acacia_fence",
  442.   [ 193 ] = "minecraft:spruce_door",
  443.   [ 194 ] = "minecraft:birch_door",
  444.   [ 195 ] = "minecraft:jungle_door",
  445.   [ 196 ] = "minecraft:acacia_door",
  446.   [ 197 ] = "minecraft:dark_oak_door",
  447.   [ 198 ] = "minecraft:end_rod",
  448.   [ 199 ] = "minecraft:chorus_plant",
  449.   [ 200 ] = "minecraft:chorus_flower",
  450.   [ 201 ] = "minecraft:purpur_block",
  451.   [ 202 ] = "minecraft:purpur_pillar",
  452.   [ 203 ] = "minecraft:purpur_stairs",
  453.   [ 204 ] = "minecraft:purpur_double_slab",
  454.   [ 205 ] = "minecraft:purpur_slab",
  455.   [ 206 ] = "minecraft:end_bricks",
  456.   [ 207 ] = "minecraft:beetroots",
  457.   [ 208 ] = "minecraft:grass_path",
  458.   [ 209 ] = "minecraft:end_gateway",
  459.   [ 210 ] = "minecraft:repeating_command_block",
  460.   [ 211 ] = "minecraft:chain_command_block",
  461.   [ 212 ] = "minecraft:frosted_ice",
  462.   [ 213 ] = "minecraft:magma",
  463.   [ 214 ] = "minecraft:nether_wart_block",
  464.   [ 215 ] = "minecraft:red_nether_brick",
  465.   [ 216 ] = "minecraft:bone_block",
  466.   [ 217 ] = "minecraft:structure_void",
  467.   [ 218 ] = "minecraft:observer",
  468.   [ 219 ] = "minecraft:white_shulker_box",
  469.   [ 220 ] = "minecraft:orange_shulker_box",
  470.   [ 221 ] = "minecraft:magenta_shulker_box",
  471.   [ 222 ] = "minecraft:light_blue_shulker_box",
  472.   [ 223 ] = "minecraft:yellow_shulker_box",
  473.   [ 224 ] = "minecraft:lime_shulker_box",
  474.   [ 225 ] = "minecraft:pink_shulker_box",
  475.   [ 226 ] = "minecraft:gray_shulker_box",
  476.   [ 227 ] = "minecraft:silver_shulker_box",
  477.   [ 228 ] = "minecraft:cyan_shulker_box",
  478.   [ 229 ] = "minecraft:purple_shulker_box",
  479.   [ 230 ] = "minecraft:blue_shulker_box",
  480.   [ 231 ] = "minecraft:brown_shulker_box",
  481.   [ 232 ] = "minecraft:green_shulker_box",
  482.   [ 233 ] = "minecraft:red_shulker_box",
  483.   [ 234 ] = "minecraft:black_shulker_box",
  484.   [ 235 ] = "minecraft:white_glazed_terracotta",
  485.   [ 236 ] = "minecraft:orange_glazed_terracotta",
  486.   [ 237 ] = "minecraft:magenta_glazed_terracotta",
  487.   [ 238 ] = "minecraft:light_blue_glazed_terracotta",
  488.   [ 239 ] = "minecraft:yellow_glazed_terracotta",
  489.   [ 240 ] = "minecraft:lime_glazed_terracotta",
  490.   [ 241 ] = "minecraft:pink_glazed_terracotta",
  491.   [ 242 ] = "minecraft:gray_glazed_terracotta",
  492.   [ 243 ] = "minecraft:light_gray_glazed_terracotta",
  493.   [ 244 ] = "minecraft:cyan_glazed_terracotta",
  494.   [ 245 ] = "minecraft:purple_glazed_terracotta",
  495.   [ 246 ] = "minecraft:blue_glazed_terracotta",
  496.   [ 247 ] = "minecraft:brown_glazed_terracotta",
  497.   [ 248 ] = "minecraft:green_glazed_terracotta",
  498.   [ 249 ] = "minecraft:red_glazed_terracotta",
  499.   [ 250 ] = "minecraft:black_glazed_terracotta",
  500.   [ 251 ] = "minecraft:concrete",
  501.   [ 252 ] = "minecraft:concrete_powder",
  502.   [ 255 ] = "minecraft:structure_block",
  503.   [ 256 ] = "minecraft:iron_shovel",
  504.   [ 257 ] = "minecraft:iron_pickaxe",
  505.   [ 258 ] = "minecraft:iron_axe",
  506.   [ 259 ] = "minecraft:flint_and_steel",
  507.   [ 260 ] = "minecraft:apple",
  508.   [ 261 ] = "minecraft:bow",
  509.   [ 262 ] = "minecraft:arrow",
  510.   [ 263 ] = "minecraft:coal",
  511.   [ 264 ] = "minecraft:diamond",
  512.   [ 265 ] = "minecraft:iron_ingot",
  513.   [ 266 ] = "minecraft:gold_ingot",
  514.   [ 267 ] = "minecraft:iron_sword",
  515.   [ 268 ] = "minecraft:wooden_sword",
  516.   [ 269 ] = "minecraft:wooden_shovel",
  517.   [ 270 ] = "minecraft:wooden_pickaxe",
  518.   [ 271 ] = "minecraft:wooden_axe",
  519.   [ 272 ] = "minecraft:stone_sword",
  520.   [ 273 ] = "minecraft:stone_shovel",
  521.   [ 274 ] = "minecraft:stone_pickaxe",
  522.   [ 275 ] = "minecraft:stone_axe",
  523.   [ 276 ] = "minecraft:diamond_sword",
  524.   [ 277 ] = "minecraft:diamond_shovel",
  525.   [ 278 ] = "minecraft:diamond_pickaxe",
  526.   [ 279 ] = "minecraft:diamond_axe",
  527.   [ 280 ] = "minecraft:stick",
  528.   [ 281 ] = "minecraft:bowl",
  529.   [ 282 ] = "minecraft:mushroom_stew",
  530.   [ 283 ] = "minecraft:golden_sword",
  531.   [ 284 ] = "minecraft:golden_shovel",
  532.   [ 285 ] = "minecraft:golden_pickaxe",
  533.   [ 286 ] = "minecraft:golden_axe",
  534.   [ 287 ] = "minecraft:string",
  535.   [ 288 ] = "minecraft:feather",
  536.   [ 289 ] = "minecraft:gunpowder",
  537.   [ 290 ] = "minecraft:wooden_hoe",
  538.   [ 291 ] = "minecraft:stone_hoe",
  539.   [ 292 ] = "minecraft:iron_hoe",
  540.   [ 293 ] = "minecraft:diamond_hoe",
  541.   [ 294 ] = "minecraft:golden_hoe",
  542.   [ 295 ] = "minecraft:wheat_seeds",
  543.   [ 296 ] = "minecraft:wheat",
  544.   [ 297 ] = "minecraft:bread",
  545.   [ 298 ] = "minecraft:leather_helmet",
  546.   [ 299 ] = "minecraft:leather_chestplate",
  547.   [ 300 ] = "minecraft:leather_leggings",
  548.   [ 301 ] = "minecraft:leather_boots",
  549.   [ 302 ] = "minecraft:chainmail_helmet",
  550.   [ 303 ] = "minecraft:chainmail_chestplate",
  551.   [ 304 ] = "minecraft:chainmail_leggings",
  552.   [ 305 ] = "minecraft:chainmail_boots",
  553.   [ 306 ] = "minecraft:iron_helmet",
  554.   [ 307 ] = "minecraft:iron_chestplate",
  555.   [ 308 ] = "minecraft:iron_leggings",
  556.   [ 309 ] = "minecraft:iron_boots",
  557.   [ 310 ] = "minecraft:diamond_helmet",
  558.   [ 311 ] = "minecraft:diamond_chestplate",
  559.   [ 312 ] = "minecraft:diamond_leggings",
  560.   [ 313 ] = "minecraft:diamond_boots",
  561.   [ 314 ] = "minecraft:golden_helmet",
  562.   [ 315 ] = "minecraft:golden_chestplate",
  563.   [ 316 ] = "minecraft:golden_leggings",
  564.   [ 317 ] = "minecraft:golden_boots",
  565.   [ 318 ] = "minecraft:flint",
  566.   [ 319 ] = "minecraft:porkchop",
  567.   [ 320 ] = "minecraft:cooked_porkchop",
  568.   [ 321 ] = "minecraft:painting",
  569.   [ 322 ] = "minecraft:golden_apple",
  570.   [ 323 ] = "minecraft:sign",
  571.   [ 324 ] = "minecraft:wooden_door",
  572.   [ 325 ] = "minecraft:bucket",
  573.   [ 326 ] = "minecraft:water_bucket",
  574.   [ 327 ] = "minecraft:lava_bucket",
  575.   [ 328 ] = "minecraft:minecart",
  576.   [ 329 ] = "minecraft:saddle",
  577.   [ 330 ] = "minecraft:iron_door",
  578.   [ 331 ] = "minecraft:redstone",
  579.   [ 332 ] = "minecraft:snowball",
  580.   [ 333 ] = "minecraft:boat",
  581.   [ 334 ] = "minecraft:leather",
  582.   [ 335 ] = "minecraft:milk_bucket",
  583.   [ 336 ] = "minecraft:brick",
  584.   [ 337 ] = "minecraft:clay_ball",
  585.   [ 338 ] = "minecraft:reeds",
  586.   [ 339 ] = "minecraft:paper",
  587.   [ 340 ] = "minecraft:book",
  588.   [ 341 ] = "minecraft:slime_ball",
  589.   [ 342 ] = "minecraft:chest_minecart",
  590.   [ 343 ] = "minecraft:furnace_minecart",
  591.   [ 344 ] = "minecraft:egg",
  592.   [ 345 ] = "minecraft:compass",
  593.   [ 346 ] = "minecraft:fishing_rod",
  594.   [ 347 ] = "minecraft:clock",
  595.   [ 348 ] = "minecraft:glowstone_dust",
  596.   [ 349 ] = "minecraft:fish",
  597.   [ 350 ] = "minecraft:cooked_fish",
  598.   [ 351 ] = "minecraft:dye",
  599.   [ 352 ] = "minecraft:bone",
  600.   [ 353 ] = "minecraft:sugar",
  601.   [ 354 ] = "minecraft:cake",
  602.   [ 355 ] = "minecraft:bed",
  603.   [ 356 ] = "minecraft:repeater",
  604.   [ 357 ] = "minecraft:cookie",
  605.   [ 358 ] = "minecraft:filled_map",
  606.   [ 359 ] = "minecraft:shears",
  607.   [ 360 ] = "minecraft:melon",
  608.   [ 361 ] = "minecraft:pumpkin_seeds",
  609.   [ 362 ] = "minecraft:melon_seeds",
  610.   [ 363 ] = "minecraft:beef",
  611.   [ 364 ] = "minecraft:cooked_beef",
  612.   [ 365 ] = "minecraft:chicken",
  613.   [ 366 ] = "minecraft:cooked_chicken",
  614.   [ 367 ] = "minecraft:rotten_flesh",
  615.   [ 368 ] = "minecraft:ender_pearl",
  616.   [ 369 ] = "minecraft:blaze_rod",
  617.   [ 370 ] = "minecraft:ghast_tear",
  618.   [ 371 ] = "minecraft:gold_nugget",
  619.   [ 372 ] = "minecraft:nether_wart",
  620.   [ 373 ] = "minecraft:potion",
  621.   [ 374 ] = "minecraft:glass_bottle",
  622.   [ 375 ] = "minecraft:spider_eye",
  623.   [ 376 ] = "minecraft:fermented_spider_eye",
  624.   [ 377 ] = "minecraft:blaze_powder",
  625.   [ 378 ] = "minecraft:magma_cream",
  626.   [ 379 ] = "minecraft:brewing_stand",
  627.   [ 380 ] = "minecraft:cauldron",
  628.   [ 381 ] = "minecraft:ender_eye",
  629.   [ 382 ] = "minecraft:speckled_melon",
  630.   [ 384 ] = "minecraft:experience_bottle",
  631.   [ 385 ] = "minecraft:fire_charge",
  632.   [ 386 ] = "minecraft:writable_book",
  633.   [ 387 ] = "minecraft:written_book",
  634.   [ 388 ] = "minecraft:emerald",
  635.   [ 389 ] = "minecraft:item_frame",
  636.   [ 390 ] = "minecraft:flower_pot",
  637.   [ 391 ] = "minecraft:carrot",
  638.   [ 392 ] = "minecraft:potato",
  639.   [ 393 ] = "minecraft:baked_potato",
  640.   [ 394 ] = "minecraft:poisonous_potato",
  641.   [ 395 ] = "minecraft:map",
  642.   [ 396 ] = "minecraft:golden_carrot",
  643.   [ 397 ] = "Skeleton",
  644.   [ 399 ] = "minecraft:nether_star",
  645.   [ 400 ] = "minecraft:pumpkin_pie",
  646.   [ 401 ] = "minecraft:fireworks",
  647.   [ 402 ] = "minecraft:firework_charge",
  648.   [ 403 ] = "minecraft:enchanted_book",
  649.   [ 404 ] = "minecraft:comparator",
  650.   [ 405 ] = "minecraft:netherbrick",
  651.   [ 406 ] = "minecraft:quartz",
  652.   [ 407 ] = "minecraft:tnt_minecart",
  653.   [ 408 ] = "minecraft:hopper_minecart",
  654.   [ 409 ] = "minecraft:prismarine_shard",
  655.   [ 410 ] = "minecraft:prismarine_crystals",
  656.   [ 411 ] = "minecraft:rabbit",
  657.   [ 412 ] = "minecraft:cooked_rabbit",
  658.   [ 413 ] = "minecraft:rabbit_stew",
  659.   [ 414 ] = "minecraft:rabbit_foot",
  660.   [ 415 ] = "minecraft:rabbit_hide",
  661.   [ 416 ] = "minecraft:armor_stand",
  662.   [ 417 ] = "minecraft:iron_horse_armor",
  663.   [ 418 ] = "minecraft:golden_horse_armor",
  664.   [ 419 ] = "minecraft:diamond_horse_armor",
  665.   [ 420 ] = "minecraft:lead",
  666.   [ 421 ] = "minecraft:name_tag",
  667.   [ 422 ] = "minecraft:command_block_minecart",
  668.   [ 423 ] = "minecraft:mutton",
  669.   [ 424 ] = "minecraft:cooked_mutton",
  670.   [ 425 ] = "minecraft:banner",
  671.   [ 426 ] = "minecraft:end_crystal",
  672.   [ 427 ] = "minecraft:spruce_door",
  673.   [ 428 ] = "minecraft:birch_door",
  674.   [ 429 ] = "minecraft:jungle_door",
  675.   [ 430 ] = "minecraft:acacia_door",
  676.   [ 431 ] = "minecraft:dark_oak_door",
  677.   [ 432 ] = "minecraft:chorus_fruit",
  678.   [ 433 ] = "minecraft:popped_chorus_fruit",
  679.   [ 434 ] = "minecraft:beetroot",
  680.   [ 435 ] = "minecraft:beetroot_seeds",
  681.   [ 436 ] = "minecraft:beetroot_soup",
  682.   [ 437 ] = "minecraft:dragon_breath",
  683.   [ 438 ] = "minecraft:splash_potion",
  684.   [ 439 ] = "minecraft:spectral_arrow",
  685.   [ 440 ] = "minecraft:tipped_arrow",
  686.   [ 441 ] = "minecraft:lingering_potion",
  687.   [ 442 ] = "minecraft:shield",
  688.   [ 443 ] = "minecraft:elytra",
  689.   [ 444 ] = "minecraft:spruce_boat",
  690.   [ 445 ] = "minecraft:birch_boat",
  691.   [ 446 ] = "minecraft:jungle_boat",
  692.   [ 447 ] = "minecraft:acacia_boat",
  693.   [ 448 ] = "minecraft:dark_oak_boat",
  694.   [ 449 ] = "minecraft:totem_of_undying",
  695.   [ 450 ] = "minecraft:shulker_shell",
  696.   [ 452 ] = "minecraft:iron_nugget",
  697.   [ 453 ] = "minecraft:knowledge_book",
  698.   [ 0 ] = "minecraft:air",
  699.   [ 2261 ] = "minecraft:record_mall",
  700.   [ 2262 ] = "minecraft:record_mellohi",
  701.   [ 2263 ] = "minecraft:record_stal",
  702.   [ 2264 ] = "minecraft:record_strad",
  703.   [ 2265 ] = "minecraft:record_ward",
  704.   [ 2266 ] = "minecraft:record_11",
  705.   [ 2267 ] = "minecraft:record_wait",
  706.   [ 2256 ] = "minecraft:record_13",
  707.   [ 2257 ] = "minecraft:record_cat",
  708.   [ 2258 ] = "minecraft:record_blocks",
  709.   [ 2259 ] = "minecraft:record_chirp",
  710.   [ 2260 ] = "minecraft:record_far",
  711. }
  712.  
  713. --[[function findMaterials(nBlock,nData)
  714.     --given int blockID and int nData, find the item in the turtle's inventory
  715.     for n = 1,16 do
  716.         turtle.select(n)
  717.         local tData = turtle.getItemDetail(n)
  718.         if tData and block_name[nBlock] and tData.name == block_name[nBlock] then
  719.             if nBlock == 35 or nBlock == 5 or nBlock ==17 or nBlock == 98 or nBlock ==159 or nBlock == 160 or nBlock == 171 then
  720.                 if tData.damage == nData then
  721.                     return n
  722.                 end
  723.             else
  724.                 return n
  725.             end
  726.         end
  727.     end
  728.  end]]
  729.  
  730. --textutils.pagedPrint(textutils.serialize(findMaterials(50,0)))
  731. local block_id = {}
  732.  
  733. block_id[0] = "Air"
  734. block_id[1] = "Stone"
  735. block_id[2] = "Grass"
  736. block_id[3] = "Dirt"
  737. block_id[4] = "Cobblestone"
  738. block_id[5] = "Wood Planks"
  739. block_id[6] = "Sapling"
  740. block_id[7] = "Bedrock"
  741. block_id[8] = "Water"
  742. block_id[9] = "Stationary water"
  743. block_id[10] = "Lava"
  744. block_id[11] = "Stationary lava"
  745. block_id[12] = "Sand"
  746. block_id[13] = "Gravel"
  747. block_id[14] = "Gold Ore"
  748. block_id[15] = "Iron (Ore)"
  749. block_id[16] = "Coal Ore"
  750. block_id[17] = "Wood"
  751. block_id[18] = "Leaves"
  752. block_id[19] = "Sponge"
  753. block_id[20] = "Glass"
  754. block_id[21] = "Lapis Lazuli (Ore)"
  755. block_id[22] = "Lapis Lazuli (Block)"
  756. block_id[23] = "Dispenser"
  757. block_id[24] = "Sandstone"
  758. block_id[25] = "Note Block Tile entity"
  759. block_id[26] = "Bed"
  760. block_id[27] = "Powered Rail "
  761. block_id[28] = "Detector Rail "
  762. block_id[29] = "Sticky Piston"
  763. block_id[30] = "Cobweb"
  764. block_id[31] = "Tall Grass"
  765. block_id[32] = "Dead Bush"
  766. block_id[33] = "Piston"
  767. block_id[34] = "Piston Extension"
  768. block_id[35] = "Wool"
  769. block_id[36] = "Block moved by Piston"
  770. block_id[37] = "Dandelionandelion"
  771. block_id[38] = "Rose"
  772. block_id[39] = "Brown Mushroom"
  773. block_id[40] = "Red Mushroom"
  774. block_id[41] = "Block of Gold"
  775. block_id[42] = "Block of Iron"
  776. block_id[43] = "Double Slabs"
  777. block_id[44] = "Slabs"
  778. block_id[45] = "Brick Block"
  779. block_id[46] = "TNT"
  780. block_id[47] = "Bookshelf"
  781. block_id[48] = "Moss Stone"
  782. block_id[49] = "Obsidian"
  783. block_id[50] = "Torch"
  784. block_id[51] = "Fire"
  785. block_id[52] = "Monster Spawner"
  786. block_id[53] = "Wooden Stairs"
  787. block_id[54] = "Chest"
  788. block_id[55] = "Redstone (Wire)"
  789. block_id[56] = "Diamond (Ore)"
  790. block_id[57] = "Block of Diamond"
  791. block_id[58] = "Crafting Table"
  792. block_id[59] = "Seeds"
  793. block_id[60] = "Farland"
  794. block_id[61] = "Furnace"
  795. block_id[62] = "Burning Furnace"
  796. block_id[63] = "Sign Post"
  797. block_id[64] = "Wooden Door"
  798. block_id[65] = "Ladders"
  799. block_id[66] = "Rails"
  800. block_id[67] = "Cobblestone Stairs"
  801. block_id[68] = "Wall Sign"
  802. block_id[69] = "Lever"
  803. block_id[70] = "Stone Pressure Plate"
  804. block_id[71] = "Iron Door"
  805. block_id[72] = "Wooden Pressure Plates"
  806. block_id[73] = "Redstone Ore"
  807. block_id[74] = "Glowing Redstone Ore"
  808. block_id[75] = "Redstone Torch"
  809. block_id[76] = "Redstone Torch"
  810. block_id[77] = "Stone Button "
  811. block_id[78] = "Snow"
  812. block_id[79] = "Ice"
  813. block_id[80] = "Snow Block"
  814. block_id[81] = "Cactus"
  815. block_id[82] = "Clay (Block)"
  816. block_id[83] = "Sugar Cane"
  817. block_id[84] = "Jukebox"
  818. block_id[85] = "Fence"
  819. block_id[86] = "Pumpkin"
  820. block_id[87] = "Netherrack"
  821. block_id[88] = "Soul Sand"
  822. block_id[89] = "Glowstone"
  823. block_id[90] = "Portal"
  824. block_id[91] = "Jack-O-Lantern"
  825. block_id[92] = "Cake Block"
  826. block_id[93] = "Redstone Repeater"
  827. block_id[94] = "Redstone Repeater"
  828. block_id[95] = "Stained Glass"
  829. block_id[96] = "Trapdoors"
  830. block_id[97] = "Hidden Silverfish"
  831. block_id[98] = "Stone Bricks"
  832. block_id[99] = "Huge brown and red mushroom"
  833. block_id[100] = "Huge brown and red mushroom"
  834. block_id[101] = "Iron Bars"
  835. block_id[102] = "Glass Pane"
  836. block_id[103] = "Melon"
  837. block_id[104] = "Pumpkin Stem"
  838. block_id[105] = "Melon Stem"
  839. block_id[106] = "Vines"
  840. block_id[107] = "Fence Gate"
  841. block_id[108] = "Brick Stairs"
  842. block_id[109] = "Stone Brick Stairs"
  843. block_id[110] = "Mycelium"
  844. block_id[111] = "Lily Pad"
  845. block_id[112] = "Nether Brick"
  846. block_id[113] = "Nether Brick Fence"
  847. block_id[114] = "Nether Brick Stairs"
  848. block_id[115] = "Nether Wart"
  849. block_id[116] = "Enchantment Table"
  850. block_id[117] = "Brewing Stand"
  851. block_id[118] = "Cauldron"
  852. block_id[119] = "End Portal"
  853. block_id[120] = "End Portal Frame"
  854. block_id[121] = "End Stone "
  855. block_id[126] = "Wood Slabs"
  856. block_id[128] = "Sandstone Stairs"
  857. block_id[134] = "Spruce Wood Stairs"
  858. block_id[135] = "Birch Wood Stairs"
  859. block_id[136] = "Jungle Wood Stairs"
  860. block_id[156] = "Quartz Stairs"
  861. block_id[159] = "Stained Clay"
  862. block_id[160] = "Stained Glass Pane"
  863. block_id[163] = "Acacia Wood Stairs"
  864. block_id[164] = "Dark Oak Wood Stairs"
  865. block_id[171] = "Carpet"
  866. block_id[172] = "Hardened Clay"
  867. block_id[256] = "Iron Ingotron Shovel"
  868. block_id[257] = "Iron Pickaxe"
  869. block_id[258] = "Iron Axe"
  870. block_id[259] = "Flint and Steel"
  871. block_id[260] = "Red Apple"
  872. block_id[261] = "Bow"
  873. block_id[262] = "Arrow"
  874. block_id[263] = "Coal"
  875.  
  876. local woolColors = {}
  877. woolColors[0] = "White"
  878. woolColors[1] = "Orange"
  879. woolColors[2] = "Magenta"
  880. woolColors[3] = "Light Blue"
  881. woolColors[4] = "Yellow"
  882. woolColors[5] = "Lime"
  883. woolColors[6] = "Pink"
  884. woolColors[7] = "Gray"
  885. woolColors[8] = "Light Gray"
  886. woolColors[9] = "Cyan"
  887. woolColors[10] = "Purple"
  888. woolColors[11] = "Blue"
  889. woolColors[12] = "Brown"
  890. woolColors[13] = "Green"
  891. woolColors[14] = "Red"
  892. woolColors[15] = "Black"
  893.  
  894. local woodTypes = {}
  895. woodTypes[0] = "Oak"
  896. woodTypes[1] = "Spruce"
  897. woodTypes[2] = "Birch"
  898. woodTypes[3] = "Jungle"
  899. woodTypes[4] = "Acacia"
  900. woodTypes[5] = "Dark Oak"
  901.  
  902. local stairOrientation = {}
  903. stairOrientation[0] = "East"
  904. stairOrientation[1] = "West"
  905. stairOrientation[2] = "South"
  906. stairOrientation[3] = "North"
  907. stairOrientation[4] = "East Inverted"
  908. stairOrientation[5] = "West Inverted"
  909. stairOrientation[6] = "South Inverted"
  910. stairOrientation[7] = "North Inverted"
  911.  
  912. local length = 0
  913. local height = 0
  914. local width = 0
  915. local blocks = {}
  916. local data = {}
  917.  
  918. function getBlockName(id, blockData)
  919.   blockData = blockData or nil
  920.   if(block_id[id] == nil) then
  921.     return "UNKNOWN"
  922.   else
  923.     if(blockData) then
  924.       if(id == 35) then
  925.         str = woolColors[blockData] .. " " .. block_id[id]
  926.         return str
  927.       end
  928.     end
  929.     return block_id[id]
  930.   end
  931. end
  932.  
  933. function getBlockId(x,y,z)
  934.   return blocks[y + z*width + x*length*width + 1]
  935. end
  936.  
  937. function getData(x,y,z)
  938.   return data[y + z*width + x*length*width + 1]
  939. end
  940.  
  941. function readbytes(h, n)
  942.   for i=1,n do
  943.     h.read()
  944.   end
  945. end
  946.  
  947. function readname(h)  
  948.   local n1 = h.read()
  949.   local n2 = h.read()
  950.  
  951.   if(n1 == nil or n2 == nil) then
  952.     return ""
  953.   end
  954.  
  955.   local n = n1*256 + n2
  956.  
  957.   local str = ""
  958.   for i=1,n do
  959.     local c = h.read()
  960.     if c == nil then
  961.       return
  962.     end  
  963.     str = str .. string.char(c)
  964.   end
  965.   return str
  966. end
  967.  
  968. function parse(a, h, containsName)
  969.   local containsName = containsName or true
  970.   local i,i1,i2,i3,i4
  971.   if a==0 then
  972.     return
  973.   end
  974.   if containsName then
  975.     name = readname(h)
  976.     uPrint(name,colors.lime,1)
  977.   end  
  978.  
  979.   if a==1 then
  980.     readbytes(h,1)  
  981.   elseif a==2 then
  982.     i1 = h.read()
  983.     i2 = h.read()
  984.     i = i1*256 + i2
  985.     uPrint(i,colors.white,2)
  986.     if(name=="Height") then
  987.       height = i
  988.     elseif (name=="Length") then
  989.       length = i
  990.     elseif (name=="Width") then
  991.       width = i
  992.     end
  993.   elseif a==3 then
  994.     readbytes(h,4)
  995.   elseif a==4 then
  996.     readbytes(h,8)
  997.   elseif a==5 then
  998.     readbytes(h,4)
  999.   elseif a==6 then
  1000.     readbytes(h,8)
  1001.   elseif a==7 then
  1002.     i1 = h.read()
  1003.     i2 = h.read()
  1004.     i3 = h.read()
  1005.     i4 = h.read()
  1006.     i = i1*256*256*256 + i2*256*256 + i3*256 + i4
  1007.     if name == "Blocks" then
  1008.       for i=1,i do
  1009.         table.insert(blocks, h.read())
  1010.       end
  1011.       saveTable(blocks, "blocks")
  1012.     elseif name == "Data" then
  1013.       for i=1,i do
  1014.         table.insert(data, h.read())
  1015.       end
  1016.       saveTable(data,"data")
  1017.     else
  1018.       readbytes(h,i)
  1019.     end
  1020.   elseif a==8 then
  1021.     i1 = h.read()
  1022.     i2 = h.read()
  1023.     i = i1*256 + i2
  1024.     readbytes(h,i)
  1025.   elseif a==9 then
  1026.     --readbytes(h,5)
  1027.     local type = h.read()
  1028.     i1 = h.read()
  1029.     i2 = h.read()
  1030.     i3 = h.read()
  1031.     i4 = h.read()
  1032.     i = i1*256*256*256 + i2*256*256 + i3*256 + i4
  1033.     for j=1,i do
  1034.       parse(h.read(), h, false)
  1035.     end
  1036.   end
  1037. end
  1038.  
  1039. function readThrough()
  1040.     local a = 0
  1041.     while (a ~= nil) do
  1042.         a = h.read()
  1043.         parse(a, h)
  1044.     end
  1045. end
  1046.  
  1047. function saveTable(tData,sFilename)
  1048.     local h = fs.open(sFilename,"w")
  1049.     h.write(textutils.serialize(tData))
  1050.     h.close()
  1051. end
  1052.  
  1053. uPrint = function(sTitle,nColor,nIndents)
  1054.     --reads a number, string, or payload
  1055.     sTitle = sTitle or ""
  1056.     if sTitle == "Schematic" then
  1057.         nIndents = 0
  1058.         nColor = colors.orange
  1059.     end
  1060.     nColor = nColor or colors.white
  1061.     term.setTextColor(nColor)
  1062.     nIndents = nIndents or 1
  1063.     local sIndent = ""
  1064.     for i = 1,nIndents do
  1065.         sIndent = sIndent.."  "
  1066.     end
  1067.     print(sIndent..tostring(sTitle))
  1068. end
  1069.  
  1070. readThrough()
  1071.  
  1072. print("Press key to start building...")
  1073. read()
  1074.  
  1075. chickenSM = nil
  1076. chickenSM = Schematic.new()
  1077. chickenSM.boundary.x = height-1
  1078. chickenSM.boundary.y = width-1
  1079. chickenSM.boundary.z = length-1
  1080. chickenSM:recordInventory()
  1081. --chickenSM:resetPosition()
  1082.  
  1083. while true do
  1084.     --making it skip 0,0,0 (test with tent)
  1085.     blockID = getBlockId(chickenSM.target.x,chickenSM.target.y,chickenSM.target.z)
  1086.     blockData = getData(chickenSM.target.x,chickenSM.target.y,chickenSM.target.z)
  1087.     if blockID ~= 0 and blockID ~= 65 and blockID ~= 96 and blockID ~= 50 then
  1088.         chickenSM:goto()
  1089.         --turning too much is annoying
  1090.         local nSlot = chickenSM:select(blockID,blockData) --return item slot
  1091.         --takes a long time, not in the class
  1092.         if not nSlot then
  1093.             error("Not enough "..tostring(blockID)..":"..tostring(blockData))
  1094.         end
  1095.         turtle.select(nSlot)
  1096.         chickenSM:place()
  1097.     end
  1098.     chickenSM:iterateZ()
  1099. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement