Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local range,heightLimit = 16, 126
- if args and #args>=1 then
- if args[1]=="help" then
- print([[chunkCleaner <range> <heightLimit>
- <range>: (num) distance in meters (default: 16)
- <heightLimit>: (num) ceil effect on vertical axis (default: 126)
- Clear chunk surrounding Command computer's chunk position.
- Effect between Command computer Y position and <heightLimit>
- Skip Command computer's chunk position.
- Could remove bedrock. To keep nether's ceiling set heightLimit to 126.]])
- return
- else
- range = tonumber(args[1]) or 16
- end
- end
- if args and #args>=2 then
- heightLimit = tonumber(args[2]) or 126
- end
- local baseX,baseY,baseZ = commands.getBlockPosition()
- local function chunkOrigin(_x,_y,_z)
- return _x-(_x%16),_y-(_y%16),_z-(_z%16)
- end
- local function clearChunk(_x,_y,_z)
- local oX,oY,oZ = chunkOrigin(_x,_y,_z)
- local _y = baseY
- local _,cursorY = term.getCursorPos()
- while _y <= heightLimit do
- sleep(.1)
- term.setCursorPos(1,cursorY)
- term.clearLine()
- term.write("y:".._y)
- commands.fill(
- oX,
- math.min(heightLimit, _y),
- oZ,
- oX+15,
- math.min(heightLimit, _y+63),
- oZ+15,
- "minecraft:air"
- )
- _y = _y+64
- end
- print("")
- end
- local z = baseZ-range
- while z<baseZ+range do
- local x = baseX-range
- while x<baseX+range do
- if baseX >= x and baseX <= x+15
- and baseZ >= z and baseZ <= z+15
- then
- print("Skip command chunk")
- else
- print(string.format("Clearing chunk x:%d, y:%d, z:%d",x,baseY,z))
- clearChunk(x,baseY,z)
- end
- x = x + 16
- sleep(.5)
- end
- z = z +16
- end
Add Comment
Please, Sign In to add comment