Advertisement
Doob

M [OpenComputers]

Jan 16th, 2017
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.35 KB | None | 0 0
  1. local deb = require("component").debug
  2. local event = require("event")
  3. local cmd = deb.runCommand
  4. local wrld, block, n = 0
  5. local WORLD = deb.getWorld(wrld)
  6.  
  7. local tContinuum = {}
  8.  
  9. local tOres = {
  10.   -- [ID] = {Name, Size, Meta}
  11.   [14] = {"minecraft:gold_ore", 1, 0},
  12.   [15] = {"minecraft:iron_ore", 1, 0},
  13.   [16] = {"minecraft:coal", 1, 0},
  14.   [21] = {"minecraft:dye", 6, 4},
  15.   [56] = {"minecraft:diamond", 1, 0},
  16.   [73] = {"minecraft:redstone", 4, 0},
  17.   [129] = {"minecraft:emerald", 1, 0}
  18. }
  19.  
  20. local tWaste = {
  21.   "minecraft:stained_hardened_clay",
  22.   "minecraft:hardened_clay",
  23.   "minecraft:yellow_flower",
  24.   "minecraft:wheat_seeds",
  25.   "minecraft:cobblestone",
  26.   "minecraft:netherrack",
  27.   "minecraft:red_flower",
  28.   "minecraft:soul_sand",
  29.   "minecraft:sandstone",
  30.   "minecraft:end_stone",
  31.   "minecraft:gravel",
  32.   "minecraft:stone",
  33.   "minecraft:grass",
  34.   "minecraft:stone",
  35.   "minecraft:dirt",
  36.   "minecraft:sand",
  37. }
  38.  
  39. local tEffects = {
  40.   -- [Name] = {ID, bad/good}
  41.   "Speed","Slowness","Haste","Mining Fatigue","Strength","Instant Health","Instant Damage","Jump Boost","Nausea","Regeneration","Resistance","Fire Resistance","Water Breathing","Invisibility","Blindness","Night Vision","Hunger","Weakness","Poison","Wither","Health Boost","Absorption","Saturation","Glowing","Levitation","Luck","Bad Luck",
  42.   ["Speed"] = {1, 1},
  43.   ["Slowness"] = {2, 0},
  44.   ["Haste"] = {3, 1},
  45.   ["Mining Fatigue"] = {4, 0},
  46.   ["Strength"] = {5, 1},
  47.   ["Instant Health"] = {6, 1},
  48.   ["Instant Damage"] = {7, 1},
  49.   ["Jump Boost"] = {8, 1},
  50.   ["Nausea"] = {9, 0},
  51.   ["Regeneration"] = {10, 1},
  52.   ["Resistance"] = {11, 1},
  53.   ["Fire Resistance"] = {12, 1},
  54.   ["Water Breathing"] = {13, 1},
  55.   ["Invisibility"] = {14, 1},
  56.   ["Blindness"] = {15, 0},
  57.   ["Night Vision"] = {16, 1},
  58.   ["Hunger"] = {17, 0},
  59.   ["Weakness"] = {18, 0},
  60.   ["Poison"] = {19, 0},
  61.   ["Wither"] = {20, 0},
  62.   ["Health Boost"] = {21, 1},
  63.   ["Absorption"] = {22, 1},
  64.   ["Saturation"] = {23, 1},
  65.   ["Glowing"] = {24, 1},
  66.   ["Levitation"] = {25, 1},
  67.   ["Luck"] = {26, 1},
  68.   ["Bad Luck"] = {27, 0}
  69. }
  70.  
  71. local tEnchants = {
  72.   -- [ID] = {Name, MaxLevel}
  73.   [0] = {"Protection", 4},
  74.   [1] = {"Fire Protection", 4},
  75.   [2] = {"Feather Falling", 4},
  76.   [3] = {"Blast Protection", 4},
  77.   [4] = {"Projectile Protection", 4},
  78.   [5] = {"Respiration", 3},
  79.   [6] = {"Aqua Affinity", 1},
  80.   [7] = {"Thorns", 3},
  81.   [8] = {"Depth Strider", 3},
  82.   [9] = {"Frost Walker", 2},
  83.   [10] = {"Curse of Binding", 1},
  84.   --------
  85.   [16] = {"Sharpness", 5},
  86.   [17] = {"Smite", 5},
  87.   [18] = {"Bane of Arthropods", 5},
  88.   [19] = {"Knockback", 2},
  89.   [20] = {"Fire Aspect", 2},
  90.   [21] = {"Looting", 3},
  91.   [22] = {"Sweeping Edge", 3},
  92.   --------
  93.   [32] = {"Efficiency", 5},
  94.   [33] = {"Silk Touch", 1},
  95.   [34] = {"Unbreaking", 3},
  96.   [35] = {"Fortune", 3},
  97.   --------
  98.   [48] = {"Power", 5},
  99.   [49] = {"Punch", 2},
  100.   [50] = {"Flame", 1},
  101.   [51] = {"Infinity", 1},
  102.   --------
  103.   [61] = {"Luck of the Sea", 3},
  104.   [62] = {"Lure", 3},
  105.   --------
  106.   [70] = {"Mending", 1},
  107.   [71] = {"Curse of Vanishing", 1}
  108. }
  109.  
  110. tContinuum.clear = function(Player)
  111.   for i = 1, #tWaste do
  112.     cmd("clear "..Player.." "..tWaste[i])
  113.   end
  114. end
  115.  
  116. tContinuum.mine = function(Player, d)
  117.   local p = deb.getPlayer(Player)
  118.   if p.getWorld().getDimensionId() == wrld then
  119.     local pX, pY, pZ = p.getPosition()
  120.     pX, pY, pZ = math.ceil(pX)-1, math.ceil(pY), math.ceil(pZ)-1
  121.     p.setPosition(pX+0.5, pY, pZ+0.5)
  122.     n = 0
  123.     for a = -d, d do
  124.       block = WORLD.getBlockId(pX+a, pY-1, pZ+a)
  125.       if block == 89 and WORLD.getBlockId(a+pX, pY-1, pZ-a) == 89 then
  126.         n = n + 1
  127.       else
  128.         return nil
  129.       end
  130.     end
  131.     if WORLD.getBlockId(pX, pY+2, pZ) == 57 then
  132.       cmd("setblock ".. pX .." ".. pY+2 .." ".. pZ .." air")
  133.       if n == 9 then
  134.         for x = pX-d, pX+d do
  135.           for y = 1, pY-1 do
  136.             for z = pZ-d, pZ+d do
  137.               block = WORLD.getBlockId(x, y, z)
  138.               if tOres[block] then
  139.                 cmd("setblock "..x.." "..y.." "..z.." stone")
  140.                 cmd("give "..Player.." "..table.concat(tOres[block], " "))
  141.               end
  142.             end
  143.           end
  144.         end
  145.       end
  146.     end
  147.   end
  148. end
  149.  
  150. while true do
  151.   e = {event.pull("chat_message")}
  152.   if e[4] == "clear" then
  153.     tContinuum.clear(e[3])
  154.   elseif e[4] == "mine" then
  155.     tContinuum.mine(e[3], 4)
  156.   end
  157.   os.sleep()
  158. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement