←  Turtle Programs

ComputerCraft | Programmable Computers for Minecraft

»

versatile Harvester

Kaikaku's Photo Kaikaku 06 Mar 2021

Automated Harvester

After a long MC pause I started playing a 1.16 world (Direwolf20 pack) and was very happy, seeing CC:Tweaked in the pack. Thank you Squid and all others that have contributed Posted Image

This program could be interesting for you and give you ideas for other projects. The turtle needs a frame of "landmark blocks" to identify the area to be harvested. This allows using a startup program to boot.
The turtle can harvest most plants that grow from a source block: sugar cane, kelp, melons, pumpkins, bamboo, mushrooms, nether vines and various modded plants like industrial hemp, Pam's gardens or natura bushes.
The movement algorithm is quite simple and ensures that the turtle can handle many different farm layouts:

Dig up/forward/down and go forward
If landmark block then u-turn (right, left, right,...)
If u-turn not possible then change harvesting orientation

The turtle won't break landmark blocks.
If it detects a landmark above it, this is a home position (chest below) to drop items and wait for a specified time.
If there's a landmark below it, this is a refuel station (chest above).
The turtle tries to suck in items like bamboo or kelp.

Parameters (optional, not case sensitive):
aHarvester [startup] [notDown] [notUp] [minFuelxxxx] [critFuelxxxx] [number1 [number2]] [noCannibalism]
  • startup: creates a startup file using the other parameters of the program call, old startup is renamed
  • notDown: turtle won't dig down
  • notUp: turtle won't dig up
  • minFuelxxxx: turtle will refuel if below xxxx (default is 2000)
  • critFuelxxxx: turtle will not move from home / empty fuel station when below xxxx (default is s.th. like 500)
  • number1 (first number): turtle sleeps number1 seconds at home position(s)
  • number2 (second number): shut down program after reaching number2+1 times a home position
  • noCannibalism: don't break other turtles on same y-level (not working 100%, but the "cannibal" will stop after the feast)
Pastebin:
https://pastebin.com/ZVc6H649

Video:
The video length somehow got out of control, I actually strive for short videos Posted Image
However, the melon time lapse shows the movement pattern nicely.


PS: With the "new" waterlocked mechanism, the kelp farm doesn't have to spawn in new water soures. However, waterlocking messes up filling water tanks.
Edited by Kaikaku, 07 March 2021 - 03:16 PM.
Quote

Purple's Photo Purple 16 Apr 2021

Random question. What happens if you exit the world while the turtle is in the middle of a cycle? Does it know to restart or continue where it left off or do you need to reset it manually?
Quote