Turtles and sugar cane?

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

KyneSilverhide

New Member
Jul 29, 2019
6
0
0
Hi,

I wanted to setup a sugar cane farm, harvested by a turtle. The problem is that my turtle destroy the items, but harvests nothing...
I've tried with a mining and a farming turtle.. same result.
Is it possible? Or does the turtles only work with wheat, melons, etc.

Bonus question : If sugar cane can't be harvested by a turtle, will it work with cacti?
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
The canes are just dropping to the ground instead of going into the turtle's inventory, yes? Have you looked into the turtle.suck command(s) from the Turtle API?

Edit: Oh, I was thinking the blocks were getting destroyed, but still dropping items... Are you using "attack" or "dig"?
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
I just put a mining turtle in front of some cane and told it to dig. The cane went directly into its inventory.
 

james228uk

New Member
Jul 29, 2019
1
0
0
Yeah, that's odd. I too just tried it, and both the Farming Turtle and Mining Turtle were able to break the sugar canes. The canes were automatically put into the turtle's inventories without using the turtle.suck() command.
 

KyneSilverhide

New Member
Jul 29, 2019
6
0
0
Solved !

I was also trying the same thing without the program, by writing the code in lua, and it worked.
So I've started to write a custom program myself, designed for my own layout, and it was also working... until I added the "refuel" code.

There is actually a bug in the deluxe suite that sometimes use the first slot as fuel. And in this case, sugar cane can indeed be used as fuel, so all the items were simply "disappearing", as we were used as fuel :)

My program : http://pastebin.com/gBAEc2ur (only designed for a 11x8 layout, with water between each row. It can be extended easily by updating the two values (8 and 11), but it will only work is the width (8) is an even number.
 

Bomb Bloke

New Member
Jul 29, 2019
612
0
0
Couple of tips. This:

Code:
i = 0
while i < 14 do
  turtle.forward()
  i = i + 1
end

... can be re-written as:

Code:
for i=0,13 do
  turtle.forward()
end

Which is short enough that you may as well just turn it into a single line:

Code:
for i=0,13 do turtle.forward() end

However, try to avoid using just "turtle.forward()" unless you don't strictly care whether the turtle moves forward (what if a mob or player gets in the way? What if a cane chooses that exact moment to grow?). Instead use something like:

Code:
while not turtle.forward() do
  turtle.attack()
  turtle.dig()
end