Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sideTunnelDistance=2;
- local sideTunnelLength=5;
- local cobbleSlot = 1;
- function digForward(number)
- for i = 0,number,1
- do
- turtle.dig();
- stepForward();
- placeBlocksLeftRight();
- turtle.digUp();
- turtle.up();
- placeBlocksLeftRight();
- placeBlockUp();
- turtle.down();
- end
- end
- function moveForward(stepNumber)
- if(stepNumber==nil)then
- stepForward();
- else
- for sn=0,stepNumber,1 do
- stepForward();
- end
- end
- end
- function stepForward()
- if(turtle.getFuelLevel()<50)then
- if(turtle.refuel())then
- print("Successfully refuelled");
- else
- print("Refuelling failed... shutting off!");
- error("Refuelling failed!");
- end
- end
- turtle.forward();
- end
- function stepUp()
- if(turtle.getFuelLevel()<50)then
- if(turtle.refuel())then
- print("Successfully refuelled");
- else
- print("Refuelling failed... shutting off!");
- error("Refuelling failed!");
- end
- end
- turtle.up();
- end
- function placeBlocksLeftRight()
- turtle.turnLeft();
- placeCobbleFront();
- turtle.turnLeft();
- turtle.turnLeft();
- placeCobbleFront();
- turtle.turnRight();
- end
- function placeCobbleFront()
- --TODO: Finish this method
- --check wether the old slot still contains cobblestone
- if((turtle.getItemDetail(cobbleSlot) ~= nil) and (turtle.getItemDetail(cobbleSlot).name=="minecraft:cobblestone"))then
- turtle.place(cobbleSlot);
- else
- if(getcobbleSlot() == false)then
- print("No Cobblestone left. this might become messy :("); --TODO: stop when there is no cobble left?
- else
- turtle.place(cobbleSlot);
- end
- end
- end
- function placeBlockUp()
- if(turtle.getItemDetail(cobbleSlot).name=="minecraft:cobblestone")then
- turtle.placeUp(cobbleSlot);
- else
- if(getcobbleSlot() == false)then
- print("No Cobblestone left. this might become messy :("); --TODO: stop when there is no cobble left?
- else
- turtle.placeUp(cobbleSlot);
- end
- end
- end
- function endTunnel()
- placeCobbleFront();
- turtle.up();
- placeCobbleFront();
- turtle.down();
- end
- function getcobbleSlot()
- for i=1,9,1 do
- if(turtle.getItemDetail(cobbleSlot).name=="minecraft:cobblestone")then
- cobbleSlot = i;
- return true;
- end
- end
- return false;
- end
- --Here begins the actual Script
- for k=0,10,1
- do
- digForward(sideTunnelDistance+1);
- endTunnel()
- turtle.turnLeft();
- digForward(sideTunnelLength);
- endTunnel()
- turtle.turnLeft();
- turtle.turnLeft();
- moveForward(sideTunnelLength);
- digForward(sideTunnelLength);
- endTunnel()
- turtle.turnLeft();
- turtle.turnLeft();
- moveForward(sideTunnelLength);
- turtle.turnRight();
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement