Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Sky Factory 2 build Farming mods 25 blocks away from you base
- -- Requires:
- -- Slot 1,15 Resources
- -- Slot 16, Coal
- -- this turtle builds form left to right
- -- place turtle on block next to the platform that you wanna build
- -- it's a 18x18 mob farm so You will need 19 stack of cobblestone to build it
- local Moveto ="r"
- local NextSlot
- local lastslotValid=1
- local ResourcesAmount=1
- local width
- local length
- local function NextSelect()
- for i = lastslotValid, 15 do
- turtle.select(i)
- itemCount = turtle.getItemCount(i)
- if itemCount ~= 0 then
- NextSlot=i
- lastslotValid=i
- ResourcesAmount=1
- break
- else
- lastslotValid=i
- NextSlot=i
- ResourcesAmount=0
- end
- end
- end
- function MoveBack()
- NextSelect()
- turtle.select(NextSlot)
- turtle.back()
- turtle.place()
- end
- function MoveIt()
- NextSelect()
- turtle.select(NextSlot)
- turtle.turnLeft()
- turtle.back()
- turtle.down()
- end
- function MoveItleft()
- NextSelect()
- turtle.select(NextSlot)
- turtle.turnRight()
- turtle.back()
- turtle.place()
- turtle.turnRight()
- end
- function MoveItRight()
- NextSelect()
- turtle.select(NextSlot)
- turtle.turnLeft()
- turtle.back()
- turtle.place()
- turtle.turnLeft()
- end
- local function GetResources()
- local OneSlotFull
- for i = 1, 15 do
- turtle.select(i)
- itemCount = turtle.getItemCount(i)
- if itemCount ~= 0 then
- OneSlotFull=true
- end
- end
- if OneSlotFull then
- return true
- else
- print("No Resources feed Me ")
- return false
- end
- end
- local function TurtleReFuel()
- for i = 1, 16 do
- turtle.select(i)
- if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then
- turtle.refuel()
- end
- end
- turtle.select(1)
- if turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 then
- print("your turtle needs fuel to move put some into last slot")
- return false
- else
- return true
- end
- end
- function addmoreresources()
- while ResourcesAmount==0 do
- print("add more resources and Press Enter to continue!")
- local event, key = os.pullEvent( "key" )
- if key == keys.enter then
- print( "Let's Go !")
- lastslotValid=1
- NextSelect()
- turtle.place()
- end
- end
- while turtle.getFuelLevel() ~= "unlimited" and turtle.getFuelLevel() < 1 do
- print("your turtle needs fuel to move put some into last slot")
- turtle.select(16)
- turtle.refuel()
- turtle.select(1)
- turtle.place()
- end
- end
- function BuildSquareTunnel(D1,D2)
- for i=1,D1 do
- for j=1,4 do
- for i=1,D2 do
- MoveBack()
- addmoreresources()
- end
- turtle.turnRight()
- end
- MoveBack()
- turtle.turnRight()
- turtle.up()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- end
- end
- local SurfacesDims = {{25,3},{12,11},{18,18}}
- function GotoThecenter()
- turtle.up()
- turtle.turnLeft()
- for i=1,8 do
- turtle.forward()
- end
- turtle.turnLeft()
- for i=1,4 do
- turtle.forward()
- end
- end
- function BuildNextPlatform()
- NextSelect()
- turtle.select(NextSlot)
- turtle.up()
- turtle.turnLeft()
- for i = 1, 7 do
- turtle.forward()
- end
- Moveto ="r"
- MoveIt()
- end
- function buildPlatfurms(a,y)
- local Dim1=SurfacesDims[a][1]
- local Dim2=SurfacesDims[a][2]
- for j=1,Dim2 do
- for i=1,Dim1-1 do
- if y==1 and (i==9 or i==10) and (j==9 or j==10) then
- turtle.back()
- else
- MoveBack()
- addmoreresources()
- end
- end
- if Moveto =="r" then
- MoveItleft()
- Moveto = "l"
- else
- MoveItRight()
- Moveto = "r"
- end
- end
- end
- if GetResources() and TurtleReFuel() then
- MoveIt()
- buildPlatfurms(1)
- BuildNextPlatform()
- buildPlatfurms(2)
- GotoThecenter()
- BuildSquareTunnel(18,3)
- turtle.turnRight()
- for i=1,2 do
- if i==2 then
- turtle.turnLeft()
- end
- for i=1,7 do
- turtle.forward()
- end
- end
- Moveto = "r"
- buildPlatfurms(3,1)
- turtle.up()
- turtle.turnRight()
- for j=1,18 do
- turtle.forward()
- end
- turtle.turnLeft()
- BuildSquareTunnel(3,17)
- buildPlatfurms(3)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement