CCCPaste

chop/plant

-- code requires felling turtle with wireless modem and slot 1 to have bonemeal, slot 2 to have saplings and the rest of the inventory to have rubber logs
t = turtle -- declare turtle to be variable "t" to decrease redundant coding
peripheral.find("modem", rednet.open) -- open the modem and shi
while true do -- infinite loop bruh
	t.place() -- places bonemeal on tree
	t.select(3) -- selects a slot with rubber log in it to compare with block in front of it
	if t.compare() then -- seeing if theres a tree in front of turtle
		rs.setOutput("right", true) -- sends redstone signal to other turtle
		os.sleep(0.5) -- waits half a second
		rs.setOutput("right", false) -- turns redstone off
		os.sleep(8) -- waits for resin to be collected
		t.select(1) -- selects bonemeal slot if there is a tree
		t.dig() --breaks the tree bro trust
	else
		t.select(1) -- selects bonemeal slot if there is no tree
	end
	if t.detect() then -- detects if theres a sapling still or if a tree has been cut
		t.select(1) -- redundantly selects bonemeal slot
		t.place() --places bonemeal
	else
		t.select(2) -- selects sapling to place
		t.place() -- places sapling
		t.select(1) -- selects bonemeal slot
		
	end
end