Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- io.write("Enter Length: ")
- length = io.read()
- io.write("Enter Height: ")
- height = io.read()
- local SLOT_COUNT = 16
- local FUEL_CHEST = 15
- local WOOD_CHEST = 16
- local FILL_SLOT_COUNT = 4
- function countItems(itemToCount)
- local itemCount = 0
- for slot = 1, SLOT_COUNT, 1 do
- item = turtle.getItemDetail(slot)
- if(item ~= nil) then
- if(item.name == itemToCount) then
- itemCount = itemCount + turtle.getItemCount(slot)
- end
- end
- end
- return itemCount
- end
- function refuel()
- fuel_level = turtle.getFuelLevel()
- if fuel_level < 1000 then
- turtle.select(FUEL_CHEST)
- turtle.digUp()
- turtle.placeUp()
- slot = 9
- turtle.select(slot)
- turtle.suckUp(64)
- turtle.refuel(64)
- turtle.select(FUEL_CHEST)
- turtle.digUp()
- end
- end
- function checkWOOD()
- if (countItems("minecraft:cobblestone") < 64) then
- turtle.select(WOOD_CHEST)
- turtle.digUp()
- turtle.placeUp()
- for slot = 1, FILL_SLOT_COUNT, 1 do
- turtle.select(slot)
- turtle.suckUp()
- end
- turtle.select(WOOD_CHEST)
- turtle.digUp()
- end
- end
- function getItemIndex(itemName)
- for slot = 1, SLOT_COUNT, 1 do
- local item = turtle.getItemDetail(slot)
- if(item ~= nil) then
- if(item["name"] == itemName) then
- return slot
- end
- end
- end
- end
- function moveForward()
- turtle.forward()
- end
- function moveBackward()
- turtle.back()
- end
- function placeBlock()
- turtle.placeDown()
- end
- function turnAround()
- turtle.turnRight()
- turtle.turnRight()
- turtle.up()
- end
- repeat
- for i = 1,tonumber(length) -1 do
- checkWOOD()
- refuel()
- turtle.select(getItemIndex("minecraft:cobblestone"))
- placeBlock()
- moveForward()
- if i == tonumber(length) - 1 then
- placeBlock()
- turnAround()
- height = height - 1
- end
- end
- until height == 0
Advertisement
Add Comment
Please, Sign In to add comment