This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Buho's profile picture

turtle.attack() detonates creepers?

Started by Buho, 23 February 2013 - 10:10 AM
Buho #1
Posted 23 February 2013 - 11:10 AM
Title: turtle.attack() detonates creepers?

I've been having a very difficult time creating an XP farm with a turtle doing the brunt of the work. It seems creepers randomly explode if the turtle.attack() them. I can't find any information on vanilla Minecraft about what makes creepers explode (beyond proximity to the player, which isn't the case here), so I'm wondering if it's a ComputerCraft thing.

In other XP farms I've made, I guide the mobs down a water track to the turtle and this seems to help a lot. (Do creepers explode if attacked while they are midair? If so, how do I work around this?)

But in my latest trap, I funnel the mobs into the nether where they are all packed together in a group. When a creeper explodes, they take out ALL the mobs and I get no XP. I can't use water in the nether, so I'm trying to figure out WHY the creepers explode. When I attack manually, they don't explode randomly.

I can't find anything on this. Anybody know?

I'm using a mining turtle with CC 1.4.
Lyqyd #2
Posted 23 February 2013 - 05:32 PM
Split into new topic.
Shnupbups #3
Posted 23 February 2013 - 05:35 PM
The game treats turtles like a player, if one hits a creeper the creeper will aggro and boom.
Doyle3694 #4
Posted 24 February 2013 - 01:54 AM
I have created simple creeper dropdown turtle kill them machines, none has ever detonated a creeper, provide more information about your setup?

Also, the turtle is not treated as a player, no.
Buho #5
Posted 24 February 2013 - 06:44 AM
Shnupbups, I agree with Doyle, creepers do not recognize turtles as players to persue and detonate when close.

My first XP farm used a 24-block drop to weaken the mobs. A block at mob chest-height kept them contained in the drop. I initially placed my turtle right at the drop floor to attack the knees of the mobs as I would normally. Creepers cannot see me from this angle and so do not explode. Yet every once in a while a creeper would explode.

First trap design, side view
X . X		X = glass
X . X		. = air
X . <		< = turtle facing direction
X X .

At the time, my xpgrind program was very simple, attacking as often as possible. I reasoned that possibly the turtle is hitting a creeper before it landed, detonating it. So I increased the attack delay to 2 seconds. This helped a lot but wasn't foolproof. So I moved the turtle back and coaxed the mobs toward the turtle with water:

Second trap design, side view
X . X
X . X		  X = glass or obsidian (I was getting tired of rebuilding)
X . . X		  . = air
X . . X X X X .	  < = turtle facing direction
. X . . . . . X	  ~ = water source block
. X ~ . . . . <
. . X X X X X .

No more explosions with this setup! However, a few mobs tended to hang out on the landing block, and when the turtle attacked, it would knockback the mobs, slowing things a bit, but my farm wasn't very efficient, so that didn't matter.

My 2nd farm is more efficient and I send them to the nether to collect. The grinding area is very similar to the past two:

Third trap design, side view
. O X .
X O . X	   X = glass, stone, etc
X O . X	   O = obsidian portal
X O . X	   . = air
. O . X	   < = turtle facing direction
. X . <
. . X .

Mobs fall two blocks from the portal and can't go anywhere. I have an optional sticky piston at mob chest-height to shuffle them into a single block in front of the turtle, which has not caused any explosions. In this setup, there is no active dropping, yet as with the first design, creepers detonate quite frequently. (I'm so glad turtles are blast-proof!) Are creepers jumping or are creepers still falling from the portal ledge? In a fourth design, I used a piston to move them into a corridor with a 2-block-high ceiling to keep them from jumping. This helped a little, but creepers still explode!

I'm running out of ideas, and I'm running out of glass and stone to replace my trap after the explosions, which brings me here. What's going on? Why are creepers exploding when turtle.attack()?

EDIT: Creepers have exploded with me 30+ blocks away, doing other things while the turtle grinds for me. I'm playing SSP in vanilla Minecraft 1.4.x except what's needed to run CC 1.4.

EDIT 2: I just tested in creative mode with a creeper dispenser on a clock. Punching creepers midair does not cause them to explode.
Buho #6
Posted 25 February 2013 - 11:56 AM
I have created simple creeper dropdown turtle kill them machines, none has ever detonated a creeper, provide more information about your setup?

Also, the turtle is not treated as a player, no.
Doyle, what are you doing different than me? Thanks.
SuicidalSTDz #7
Posted 25 February 2013 - 12:04 PM
The turtle is NOT treated as a player, however, any "entity" (Mobs preferably) that hits/attacks another mob will cause that mob (If hostile or neutral) to attack the mob that attacked it. (If that makes sense) I can see the confusion that turtles are "players" since the mob they attack drops XP, but they are simply a rendered block holding a sword. Of course if you want to know more about this, you could look at dan200's code for turtles and see what makes them "tick".

An in-game example of this is the fact that if a skeleton shoots a creeper, the creeper will go after the skeleton. Of course this can happen with any combination of mob (Only hostile and neutral)
Buho #8
Posted 25 February 2013 - 12:24 PM
Suicidal, that's a little helpful. But I don't know how a creeper could detonate near my turtle if it doesn't detonate when I attack it from the very same position. It can't see me (since I'm attacking the knees).

And the related question: how do others use turtles to grind for XP that do not cause creepers to explode?
SuicidalSTDz #9
Posted 25 February 2013 - 12:27 PM
Suicidal, that's a little helpful. But I don't know how a creeper could detonate near my turtle if it doesn't detonate when I attack it from the very same position. It can't see me (since I'm attacking the knees).

And the related question: how do others use turtles to grind for XP that do not cause creepers to explode?
Since the turtle is not treated as a player, my guess is that the Creeper treats it differently than the Player. The Creeper may have a direct line of sight at the turtle but not you. Not sure how it works.

For my creeper farms, I use the "Damage them then kill them in one hit" method. It works rather well and the turtles are able to kill them in one hit. Drop the creepers from a height higher than 20 blocks from where the turtle is. This works for my farm but may vary depending on how you set it up.
Cloudy #10
Posted 25 February 2013 - 01:29 PM
We attack the creeper using a fake player. The creeper obviously thinks it is a threat and blows up.
SuicidalSTDz #11
Posted 25 February 2013 - 01:31 PM
We attack the creeper using a fake player. The creeper obviously thinks it is a threat and blows up.
Great hypothesis :D/> Or statement :P/>

EDIT: Why not make a pig farm. I mean after all, they created the creeper so they must be superior. ;)/>
immibis #12
Posted 25 February 2013 - 03:02 PM
If turtles are strong enough to survive the explosion, then just make the bottom part of your farm out of obsidian.
Buho #13
Posted 25 February 2013 - 03:11 PM
Thanks for the confirmation, Cloudy.

immibis, I've done this. However, the explosion destroys other mobs nearby as well as any experience orbs that I haven't scooped up yet. This is particularly bad in the nether setup where hundreds of mobs (or maybe a thousand) will collect if I AFK overnight.

Yes, I will try to tweak my grinder so creepers die after one hit. I haven't had success with this with zombies since some wear armor, but it might be more predictable with creepers. I figured I could skip the fall damage part altogether with spamming turtle.attack() but I guess not.

My 2nd farm is tall already, adding a drop will complicate things a lot. I'm trying to farm endermen simultaneously, so I'm using a piston funnel instead of water, in addition to 3-block-high pads, which adds a lot of height. I might experiment with a crusher.

Anybody else with creeper XP farms and turtles, advice appreciated. Thanks for all the help thus far! This is a good community.
SuicidalSTDz #14
Posted 25 February 2013 - 03:41 PM
Thanks for the confirmation, Cloudy.

immibis, I've done this. However, the explosion destroys other mobs nearby as well as any experience orbs that I haven't scooped up yet. This is particularly bad in the nether setup where hundreds of mobs (or maybe a thousand) will collect if I AFK overnight.

Yes, I will try to tweak my grinder so creepers die after one hit. I haven't had success with this with zombies since some wear armor, but it might be more predictable with creepers. I figured I could skip the fall damage part altogether with spamming turtle.attack() but I guess not.

My 2nd farm is tall already, adding a drop will complicate things a lot. I'm trying to farm endermen simultaneously, so I'm using a piston funnel instead of water, in addition to 3-block-high pads, which adds a lot of height. I might experiment with a crusher.

Anybody else with creeper XP farms and turtles, advice appreciated. Thanks for all the help thus far! This is a good community.
The mod MiscPeripherals has a nice turtle called the Xp Turtle, if memory serves, this turtle can suck in xp and do "expansive" operations with the xp it has collected.
Doyle3694 #15
Posted 25 February 2013 - 11:47 PM
How many turtles do you have killing creepers? I recon having 2 turtles on each side of the 2x2 hole the creepers fall into. The turtles only occupy the upper part of the 2 in height, so underneath I have a water stream going to a collection point. Also, I don't know the exact coding for turtle.attack() and creeper explosions, but I recon the creeper searches for the entity that last damaged it(or something like that), don't know if the turtle makes a fake entity just to damage. Because if you think of it, a player shooting a bow at a creeper isn't going to detonate a creeper, because the damageing entity is farther away than the creeper blast radius. Though, don't quote me on all these "theories", someone who knows how to code and knows what detonates a creeper behind the scenes would have to comfirm it all.
Engineer #16
Posted 26 February 2013 - 02:20 AM
I am not an expert but is it in idea to one hit KO the creeper? So, the creeper is full health, comes up and BAM dead. You could do this by doing this:



I dont know if this works, have to go soon and couldnt test it :P/>
Doyle3694 #17
Posted 26 February 2013 - 03:14 AM
Yeah that's kinda what my setup achives, atleast 2 turtles killing each creeper
Buho #18
Posted 27 February 2013 - 12:24 PM
Why two turtles? Isn't one enough? Or is that to get around creepers exploding? I.e., kill em fast with multiple hits from different directions?

And what's going on in that image? That third turtle looks several blocks away not doing anything. One turtle attacks from below. I read something on this forum that said that works better?
ChunLing #19
Posted 28 February 2013 - 03:33 AM
it works better because the creeper will definitely be hit instead of being out of range.

If you have a two block deep pit, with a turtle on the bottom and turtles on all four sides facing in, you can have at least five turtles hitting the creeper at once (offset their attacks, and they should play ping-pong with the creeper to maximize the damage). But that's kinda overkill.
Buho #20
Posted 01 March 2013 - 12:12 PM
Okay, I think I've got this working finally.

Final setup, side-view:
. X . X . . . . . .		. = Air
. X . X . . . . . .		X = Obsidian
C X . X . . . . . .		C = Computer with modem
> G . . X X T . . .		> = Sticky piston
. T . . . . T X . .		G = Glass
X X X ~ . . . . . $		~ = Water source block
X X X X X X X X X X		T = Wireless melee turtle
				$ = Me, to collect the XP

The two T's on the right are actually 3 melee turtles, one above and two on each side of the water flume. Overkill? No. The creepers start to blow up but the melee turtles triple-team them before they can detonate!

The computer/turtle/piston trifecta on the left are to isolate endermen, something that took a very, very long time to figure out what with the exploding creepers. This design turned out to be one of the simplest I constructed (one design had a back &amp; forth intranet of computer-controlled pistons for precise choreographing). The computer sends a redstone signal to the piston every 10 seconds to extend, wait one second, and retract. Every two cycles, it extends, waits 10 seconds for the shorter mobs to clear out (important!), and then sends a rednet signal to the turtle on the left to attack for 10 seconds. After that, the turtle stops and the piston retracts. The delays ensure the creepers clear out so they don't explode from the left turtle. The trap is designed to keep the endermen in place but push the shorter mobs out of the way.

Creepers exploding on attack really made this WAAAY more difficult than I thought when I began this project! Part of me is ticked off, but the other part of me welcomes the challenge! ;)/>

Thanks for your help, everyone!