Melee Turtle Mob Farm Question

  • 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

Alice

New Member
Jul 29, 2019
65
0
0
I have just built a cave spider mod farm with a tier 5 soul shard - same design as DW20's blaze farm in his single player.

The thing I am having a problem with is, because spiders drop can 2 items - string and spider eyes, the turtle.drop() function is only dropping whatever item is in the 1st inventory slot.

Could anyone tell me if there is a command or something to drop all of the inventory?
If not, what else could I do?

Hope you can help!! :)
 
Could anyone tell me if there is a command or something to drop all of the inventory?
If not, what else could I do?

Hope you can help!! :)

There is not a command to drop all items in the inventory, so you'll have to make it yourself. For example:

Code:
for vSlot = 1, 16, 1 do
 turtle.select(vSlot)
 turtle.dropDown()
end

That is just off the tips of my fingers, but it should work. If not, I'll double check against the code I am using.

Switching slots also adds a small delay, so you should update your turtle's attack delay to keep it roughly in the same area.
 
I use a simple loop in my code for that

Code:
while true do
  turtle.attack()
  turtle.drop()
  turtle.select(2)
  turtle.drop()
  turtle.select(1)
  sleep(1)
end
 
I use a simple loop in my code for that

Code:
while true do
turtle.attack()
turtle.drop()
turtle.select(2)
turtle.drop()
turtle.select(1)
sleep(1)
end

Yeah, if it REALLY is only two items, then yes, that would be best. But if your turtle picks up a string, and then a spider's eye (slot 2), and drops the string, and then drops the spider's eye (slot 2) and does not change back to slot one, you'll get stuff in slot three.

I've also got mine set up to deal with skeletons, which drop a silly amount of different things. But yeah, two slots should be enough to deal with spiders. In fact, fill in the other slots with something so things cannot be picked up there would be a good idea as well.
 
There is not a command to drop all items in the inventory, so you'll have to make it yourself. For example:

Code:
for vSlot = 1, 16, 1 do
turtle.select(vSlot)
turtle.dropDown()
end

That is just off the tips of my fingers, but it should work. If not, I'll double check against the code I am using.

Switching slots also adds a small delay, so you should update your turtle's attack delay to keep it roughly in the same area.
I do 16,1,-1. This way it ends at slot 1 once it's done :).

Also
Code:
if turtle.getItemCount(16)>0 then do DropStuff() end
So that you're not going trough its inventory constantly, but only if it's full.
 
I do 16,1,-1. This way it ends at slot 1 once it's done :).

Also
Code:
if turtle.getItemCount(16)>0 then do DropStuff() end

Ah, good ideas! I wonder how long it takes to do a getItemCount request? Likely a lot shorter than it takes to deal with everything else, so yes, that is great.

Code:
while turtle.attack() do
 print("Attack!")
 
 if turtle.getItemCount(16)>0 then
 for vSlot = 16, 1, -1 do
  turtle.select(vSlot)
  turtle.dropDown()
 end
 else
  sleep(0.5)
 end
end

There we go. I'd say that should work fairly well.
 
Dropping all slots takes a long time, so doing that between every attack is not practical. I check slot 14 after every attack, and if that has an item, I drop everything.

Code:
if turtle.getItemCount(14) > 0 then
  DropAll()
end

DropAll() is just the same function everyone else wrote (with slot 1 selected at the end).

edit: ninjad
 
getItemCount() is nearly instant. Both select() and drop() take a significant amount of time, a tick, maybe two (I haven't timed it precisely).

Code:
for slot = 1, MAXSLOTS do
  if turtle.getItemCount(slot) > 0 then
    turtle.select(slot)
    turtle.drop()
  end
end
turtle.select(1)

I like the backwards iteration idea to end up at slot 1 again :-)
 
Wow guys, thanks for all the suggestions!

Dropping all slots takes a long time, so doing that between every attack is not practical. I check slot 14 after every attack, and if that has an item, I drop everything.

Code:
if turtle.getItemCount(14) > 0 then
  DropAll()
end

DropAll() is just the same function everyone else wrote (with slot 1 selected at the end).

edit: ninjad

For this - if I wrote:
Code:
if turtle.getItemCount(3) > 0 then
 
    DropAll()
 
end

Would this check slot 3 and then if that has an item in, then drop all and then return to slot 1?

Sorry, I'm still learning :oops:
 
Pirate'd!



Excellent. Now, if only we had advanced turtles which had a "tool" slot, so I could give them more powerful weapons. And color screens, and gold casings. Cannot forget the "bling" value, as it were.
Telling you! Satelites, grav engines, miniature black holes and have the "turtles" MK2 look like this:
253299871_640.jpg

Or something. Also make them entities instead of tile entities and let us control them in full 3d instead of a silly limited orthogonal system. I want to make 3 of those things circle around me and shoot stuff with swagrays!
 
  • Like
Reactions: Abdiel
Would this check slot 3 and then if that has an item in, then drop all and then return to slot 1?

Sorry, I'm still learning :oops:

"dropAll()" is Damoklesz's way of saying:

Code:
 for vSlot = 16, 1, -1 do
  turtle.select(vSlot)
  turtle.dropDown()
 end

Although feel free to have vSlot start at 2 instead of 16.
Telling you! Satelites, grav engines, miniature black holes and have the "turtles" MK2 look like this:
253299871_640.jpg

Or something. Also make them entities instead of tile entities and let us control them in full 3d instead of a silly limited orthogonal system. I want to make 3 of those things circle around me and shoot stuff with swagrays!

Hahahah, mining laser turtles would make for awesome defense bots given an ability to detect things. Perhaps a mob detector upgrade?
 
"dropAll()" is Damoklesz's way of saying:

Code:
for vSlot = 16, 1, -1 do
  turtle.select(vSlot)
  turtle.dropDown()
end

Although feel free to have vSlot start at 2 instead of 16.

Hahahah, mining laser turtles would make for awesome defense bots given an ability to detect things. Perhaps a mob detector upgrade?
More like an awareness upgrade. List of ID's in a 5x5 cube around it returned in an array. And a second list of entities in the same area, but returned in a planar angle and distance.
 
More like an awareness upgrade. List of ID's in a 5x5 cube around it returned in an array. And a second list of entities in the same area, but returned in a planar angle and distance.

Perhaps the ability to also have dedicated scanners that would boost the range of that to twenty or twenty-five meters cubed (two scanners spread far enough apart can obtain more signal than either scanner times two, with some basic processing) so we could have scanning turtles in the swarm, and give the resistance something to shoot (and miss, of course) for.
 
Perhaps the ability to also have dedicated scanners that would boost the range of that to twenty or twenty-five meters cubed (two scanners spread far enough apart can obtain more signal than either scanner times two, with some basic processing) so we could have scanning turtles in the swarm, and give the resistance something to shoot (and miss, of course) for.
Sounds very cpu intensive.
 
Sounds very cpu intensive.

I was already specing building a cluster computer into the build to run the swarm. I'll have to sell a kidney to pay for it, but I get a good deal if I sell both so I can always buy another later if I cannot get a turtle to be my kidneyTurtle00.
 
I was already specing building a cluster computer into the build to run the swarm. I'll have to sell a kidney to pay for it, but I get a good deal if I sell both so I can always buy another later if I cannot get a turtle to be my kidneyTurtle00.
:D seriously, though, I want that the mk2 turtles to happen so much haha :D.
 
:D seriously, though, I want that the mk2 turtles to happen so much haha :D.

Indeed, and there is even precedence for it: Advanced computers, advanced monitors.

Hell, I want an advanced printer that requires ink sacks, red rose, lapis, cactus green, and dandelion yellow to print in full color. And an advanced disk drive that allowed me to have more than one disk in it.

I should really put my code where my fingers are, and go look at the ComputerCraft forums and see how hard they'd be to write myself.