Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Direwolf20's 9x9 House builder")
- print("Slots 1-3 = Walls (?? Stacks)")
- print("Slot 4 = Floor (?? blocks)")
- print("Slot 5 = Ceiling Middle (?? blocks)")
- print("Slot 6 = Glass (16 blocks)")
- local function checkCount(slot)
- if turtle.getItemCount(slot) == 0 then
- slot = slot + 1
- turtle.select(slot)
- return slot
- end
- return slot
- end
- local function tryRefuel(slot)
- if turtle.getFuelLevel() <= 5 then
- turtle.select(16)
- turtle.refuel(4)
- turtle.select(slot)
- end
- end
- local function floor(slot)
- --Does 4 passes. One up and one down for 8 rows.
- --Leaves the 9th row empty to start the walls
- turtle.select(slot) --Selects cobble for floor
- for j = 0, 3 do
- for i = 0, 8 do --Does one row up and another back
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.forward()
- end
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- for i = 0, 8 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- end
- return(slot)
- end
- local function walls(slot)
- --Starts on the last row of the floors as the first wall
- for j = 0, 8 do
- --places 6 blocks up on the first wall missing the floor
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.up()
- end
- turtle.forward()
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.down()
- end
- end
- -- places it back onto the floor for the second wall.
- -- possibly loop this twice and finish with a seperate door piece?
- for k = 0, 1 do
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- for j = 0, 7 do
- --places 5 blocks up from the floor
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.up()
- end
- turtle.forward()
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.down()
- end
- end
- end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- --Last wall with the door does a column of 3 then a door then repeats
- for j = 0, 2 do
- --places 5 blocks up from the floor
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.up()
- end
- turtle.forward()
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.down()
- end
- end
- ---------------------
- --Door is placed here
- turtle.up()
- turtle.up()
- ---------------------
- for i = 0, 4 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.up()
- end
- turtle.forward()
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.down()
- end
- --Finished out the row of columns
- for j = 0, 2 do
- --places 5 blocks up from the floor
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.up()
- end
- turtle.forward()
- for i = 0, 6 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.down()
- end
- end
- end
- local function roof(slot)
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- print("enter loop")
- for j = 0, 2 do
- for i = 0, 8 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- print("place down")
- turtle.forward()
- print("forward")
- end
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- for i = 0, 8 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.forward()
- end
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- for i = 0, 8 do
- tryRefuel(slot)
- slot = checkCount(slot)
- turtle.placeDown()
- turtle.forward()
- end
- end
- --Control Section
- --Starts with slot 1 for cobble
- local function control()
- slot = 1
- tryRefuel(slot)
- slot = checkCount(slot)
- -- turtle.up()
- -- floor(slot)
- -- walls(slot)
- roof(slot)
- end
- control()
Advertisement
Add Comment
Please, Sign In to add comment