Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local buttonType = "stone_pressure_plate"
- local asyncLimit = 900
- local mats = {
- {
- name = "minecraft:unpowered_repeater",
- metadata = 0,
- },
- {
- name = "minecraft:stone",
- metadata = 0,
- },
- {
- name = "minecraft:tnt",
- metadata = 0,
- },
- {
- name = "minecraft:redstone_wire",
- metadata = 0,
- },
- {
- name = "minecraft:air",
- metadata = 0,
- },
- {
- name = "minecraft:unpowered_repeater",
- metadata = 2,
- },
- {
- name = "minecraft:piston",
- metadata = 1,
- },
- {
- name = "minecraft:"..buttonType,
- metadata = 0,
- }
- }
- local pats = {{{{3,5,5},{5,2,5}},{{5,2,5},{2,7,2}},{{5,5,3},{5,2,5}}},{{{3,5,5},{5,2,7}},{{5,2,5},{2,4,2}},{{5,5,3},{7,2,5}}},{{{3,5,5},{5,2,7}},{{7,2,5},{2,4,2}},{{5,5,3},{5,2,7}}},{{{3,5,5},{7,2,7}},{{5,2,5},{2,4,2}},{{5,5,3},{7,2,7}}},{{{3,5,5},{7,2,7}},{{5,2,7},{2,4,2}},{{5,5,3},{7,2,7}}},{{{3,7,5},{7,2,7}},{{5,2,5},{2,4,2}},{{5,7,3},{7,2,7}}},{{{3,7,5},{7,2,7}},{{5,2,7},{2,4,2}},{{5,7,3},{7,2,7}}},{{{3,7,5},{7,2,7}},{{7,2,7},{2,4,2}},{{5,7,3},{7,2,7}}},{{{5,3,5},{2,5,2}},{{3,2,3},{5,4,5}},{{5,3,5},{2,5,2}}},[0]={{{1,2,1},{3,4,5}},{{2,2,2},{4,4,4}},{{6,2,6},{5,4,3}}}}
- local args = {...}
- local de = {5,5,6,0,0,0}
- if commands then
- de[4],de[5],de[6] = commands.getBlockPosition()
- de[5]=de[5]+1
- end
- for i,j in ipairs(de) do
- args[i] = tonumber(args[i]) or j
- end
- if args[3] > args[1] * args[2] then
- print("Too many mines")
- return
- end
- local mines = {}
- for i=0,args[1]+1 do
- mines[i] = {}
- end
- while args[3] > 0 do
- local x,y = math.random(args[1]),math.random(args[2])
- if not mines[x][y] then
- mines[x][y] = true
- args[3]=args[3]-1
- end
- end
- local function count(x,y)
- local ms = 0
- for i=-1,1 do
- for j=-1,1 do
- if mines[x+i][y+j] then
- ms=ms+1
- end
- end
- end
- return ms
- end
- local taken = 0
- local function set(x,y,z,bn)
- local mat = mats[bn or 2]
- commands.async.setblock(args[4]+x,args[5]+y,args[6]+z,mat.name,mat.metadata)
- taken = taken + 1
- if taken >= asyncLimit then
- sleep(0.1)
- taken = 0
- end
- end
- if commands then
- for i=0,args[1]*3+1 do
- for h=0,3 do
- set(i,h,0)
- set(i,h,args[2]*3+1)
- end
- end
- for i=1,args[2]*3 do
- for h=0,3 do
- set(0,h,i)
- set(args[1]*3+1,h,i)
- end
- end
- for i=0,args[1]-1 do
- for j=0,args[2]-1 do
- local c = mines[i+1][j+1] and #pats or count(i+1,j+1)
- for k=1,3 do
- for l=1,3 do
- set(i*3+k,4,j*3+l,5)
- set(i*3+k,0,j*3+l)
- for m=1,2 do
- set(i*3+k,m,j*3+l,pats[c][k][m][l])
- end
- set(i*3+k,3,j*3+l)
- end
- end
- set(i*3+2,4,j*3+2,#mats)
- end
- end
- else
- print("This needs to be on an command computer")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement