Advertisement
guitarplayer616

build basic

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