Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local m = require("blib")
- m.map = {x = 1, y = 1, z = 1, xf = 0, yf = 1}
- local Length
- local Width
- function isWaterBlock()
- if m.map.x % 9 == 5 and m.map.y % 9 == 5 then
- return true
- end
- end
- function Plant()
- turtle.digDown()
- if m.SelectItem("minecraft:wheat_seeds") then
- turtle.placeDown()
- return true
- end
- end
- function Start()
- for x = 1, Width do -- starting length cuts one turn off, but not one column off. see below
- for y = 1, Length - 1 do -- width cuts one length down off the next
- -- check for fuel
- if(not m.CheckFuel(10)) then
- return Shutdown("Out of Fuel!")
- end
- if not isWaterBlock() then
- Plant()
- end
- m.MapForward()
- end
- Plant() -- Plant on turns
- if( Width - x ~= 0) then -- Technically on the last column, we want to continue forward so we can't do 'Width - 1', but don't turn into the next column
- if(lastTurn == "Right") then -- if we're on an even column, turn left
- m.MapTurnLeft()
- m.MapForward()
- m.MapTurnLeft()
- lastTurn = "Left"
- else -- odd columns (start is 1 btw) turn right!
- m.MapTurnRight()
- m.MapForward()
- m.MapTurnRight()
- lastTurn = "Right"
- end
- end
- end
- end
- function Main()
- local response
- print("Welcome to the Minecraft hoe plot planter!")
- print("please enter how many plots wide you want to build!")
- local plotsWide = read()
- Width = 9 * plotsWide
- print("please enter how many plots long you want to build!")
- local plotsLong = read()
- Length = 9 * plotsLong
- Start()
- print("Finished!")
- end
- Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement