Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ | Lazy tree farm.
- |
- | - Bonemeal goes in chest to right of turtle.
- | - Saplings funnel into chest under turtle (Hopperhock used here since pack has Botania)
- | - Block 8 blocks above sapling space in front of turtle
- | - Place next to Skeleton farm for maximum AFK efficiency
- |
- | - Enjoy
- |
- --]]
- local FUEL_THRESHOLD = 80;
- local SLOT_COUNT = 16;
- local i, found, slotItem, currSlot, present, block, presentBelow, blockBelow = 1, false, nil, nil, turtle.inspect(), turtle.inspectDown();
- -- in case chunk is unloaded or server crashes mid-routine
- while not presentBelow do
- turtle.Down();
- presentBelow, blockBelow = turtle.inspectDown();
- present, block = turtle.inspect();
- end
- while present and (not (block.name == "minecraft:oak_sapling" or block.name == "minecraft:oak_log")) and i <= 4 do
- turtle.turnLeft();
- present, block = turtle.inspect();
- i = i + 1;
- end
- if i == 4 and present and not (block.name == "minecraft:oak_sapling" or block.name == "minecraft:oak_log") then
- assert(false, "Something is horribly wrong. Get Kammon.");
- end
- -- main function loop
- while true do
- term.clear();
- print("Current fuel: "..turtle.getFuelLevel());
- print(os.getComputerLabel().." will cease function below "..FUEL_THRESHOLD..".");
- print("Please make sure to drop Charcoal and Bone Meal in the area to keep me running.");
- if turtle.getFuelLevel() < FUEL_THRESHOLD then
- found = false;
- while not found do
- for i = 1, SLOT_COUNT do
- slotItem = turtle.getItemDetail(i)
- if slotItem and slotItem.name == "minecraft:charcoal" then
- turtle.select(i);
- found = true;
- end
- end
- if not found then
- turtle.turnRight(); turtle.turnRight();
- if not turtle.suck() then
- print("Out of usable fuel. Please drop charcoal in the area.");
- os.sleep(300);
- term.clear();
- end
- turtle.turnLeft(); turtle.turnLeft();
- else
- turtle.refuel();
- end
- end
- end
- while present do
- if block.name == "minecraft:oak_sapling" then
- i = 1
- found = false;
- while i <= SLOT_COUNT and not found do
- slotItem = turtle.getItemDetail(i)
- if slotItem and slotItem.name == "minecraft:bone_meal" then
- turtle.select(i);
- found = true;
- end
- i = i + 1;
- end
- if not found then turtle.turnRight(); turtle.suck(); turtle.turnLeft() end
- turtle.place();
- elseif block.name == "minecraft:oak_log" then
- while present and block.name == "minecraft:oak_log" do
- turtle.dig();
- turtle.digUp();
- turtle.up();
- present, block = turtle.inspect();
- end
- while not turtle.detectDown() do turtle.down() end
- end
- present, block = turtle.inspect();
- end
- if not present then
- os.sleep(5);
- found = false;
- i = 1;
- while i <= SLOT_COUNT and not found do
- slotItem = turtle.getItemDetail(i);
- if slotItem and slotItem.name == "minecraft:oak_sapling" then
- turtle.select(i);
- found = true;
- end
- i = i + 1;
- end
- if not found then turtle.suckDown() end
- turtle.place();
- end
- present, block = turtle.inspect();
- for i = 1, 16 do
- slotItem = turtle.getItemDetail(i);
- if slotItem and slotItem.name == "minecraft:oak_log" then
- turtle.select(i);
- turtle.dropUp()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement