Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SLEEP_BETWEEN_DIG = 0.5
- local SLEEP_MAIN_LOOP_WAIT = 30
- local SLEEP_MAIN_LOOP_ACTIVE = 1
- local SNOW_PER_LOOP = 32
- local TURTLE_INVENTORY_SIZE = 16
- local SNOW_STACK_SIZE = 16
- function garbage_all()
- local i = TURTLE_INVENTORY_SIZE
- while i > 0 do
- turtle.select(i)
- turtle.drop()
- i = i - 1
- end
- end
- function select_item(item)
- local slot = 1
- while slot <= TURTLE_INVENTORY_SIZE do
- local data = turtle.getItemDetail(slot)
- if data and data.name == item then
- turtle.select(slot)
- return true
- end
- slot = slot + 1
- end
- return false
- end
- function is_full()
- local slot
- local data
- local empty
- slot = TURTLE_INVENTORY_SIZE
- empty = 0
- while slot > 0 do
- data = turtle.getItemDetail(slot)
- if not data then
- empty = empty + 1
- end
- slot = slot - 1
- end
- return empty < (SNOW_PER_LOOP / SNOW_STACK_SIZE)
- end
- function dig_snow()
- local i
- i = 0
- while i < SNOW_PER_LOOP do
- turtle.dig()
- sleep(SLEEP_BETWEEN_DIG)
- i = i + 1
- end
- end
- function drop_to_chest()
- while select_item('minecraft:snowball') and turtle.dropDown() do end
- return select_item('minecraft:snowball')
- end
- function core()
- while true do
- if not is_full() then
- dig_snow()
- elseif not select_item('minecraft:snowball') then
- garbage_all()
- end
- if not drop_to_chest() then
- sleep(SLEEP_MAIN_LOOP_WAIT)
- else
- sleep(SLEEP_MAIN_LOOP_ACTIVE)
- end
- end
- end
- core()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement