2

I have a 1 tick clock, which leads to a command block with the command:

testfor @p[-262,3,113,1] {SelectedItem:{id:minecraft:stick}}

That works. It finds me under the right conditions.

Then I have a redstone comparator, leading to a redstone repeater (seemed to be needed), then another command block for the actual command to do.

If the (second) command is

tp @p -268 3 113

then it works.

If it is any of the following then it won't teleport (though the first command block is finding me)

tp @p[-262,3,113,1] -268 3 113
tp @p[x=-262,y=3,z=113,r=1] -268 3 113
tp @p[-262,3,113,1] {SelectedItem:{id:minecraft:stick}} -268 3 113
tp @p[x=-262,y=3,z=113,r=1] {SelectedItem:{id:minecraft:stick}} -268 3 113

Can anyone suggest an answer?

Edit:

I'm on Minecraft 1.8.8.

Here's the clock (off to the right is a switch to turn it on and off, off to the left is the command block circuit). enter image description here

Here's the main circuit. The right hand command block is the first (the testfor). Behind it is a redstone repeater.

The left hand command block is the second (the tp).

enter image description here

Hope that helps.

  • Just something to try - have you tried changing the @p in the tp command to @a? – angussidney Sep 4 '15 at 9:56
  • I really suggest using execute instead of testfor. Testfor has way too many problems for doing something when something happens without it being singleplayer. – Judge2020 Sep 4 '15 at 12:16
  • @angussidney - how would that work? I need the closest people to the point defined, that are carrying a stick. Surely if I use @a then that gives me anyone carrying a stick. Could you clarify? – James Carlyle-Clarke Sep 4 '15 at 15:44
  • @Judge2020 - I'd be interested to see examples. Still, the Testfor seems to fire fine (I've still got the console showing results and it's finding me, it's just the /tp that is not working). Sure, I had to reinforce it with a redstone reinforce which seemed strange, but it seems to work fine. – James Carlyle-Clarke Sep 4 '15 at 15:46
  • 2
    Stop what you're doing! You're mixing redstone dust and command blocks, which is a Bad Idea™! You should eliminate as much redstone dust as possible. Redstone dust in a command block contraption is the devil, it is pure evil, you do not want it anywhere near you. Your first step should be to get rid of it. – MBraedley Sep 5 '15 at 15:23
-1

Comparator and fast clocks don't mix well so here is a complete clock only solution.

Setup:

/scoreboard objectives add Selector dummy
/scoreboard objectives add Marker dummy
/summon ArmorStand -262 3 113 {Silent:1,CustomName:"Tracker",Invulnerable:1,Invisible:1,Marker:1,NoGravity:1}

Clock:

/scoreboard players set @a Selector 0
/scoreboard players set @a[x=-262,y=3,z=113,r=1] Selector 1 {Inventory:{id:minecraft:stick}}
/scoreboard players set @e Marker 0
/scoreboard players set @e[type=ArmorStand] Marker 1 {Silent:1,CustomName:"Tracker",Invulnerable:1,Invisible:1,Marker:1,NoGravity:1}
/execute @e[type=ArmorStand,score_Marker_min=1] ~ ~ ~ tp @p[r=1] -268 3 113
  • 1
    Additionally, the new snapshots have added a feature allowing command blocks to be set up to repeat and chain without any need for redstone or comparators. May be worth checking out if you aren't particularly tied to 1.8. – Silentvenom7 Sep 4 '15 at 20:28
  • Confused as to what you're trying to do here. You're setting everyone's Selector score to 0, then setting everyone holding a stick's Selector score to 0 again, then doing absolutely nothing based off of the Selector score? ArmorStands don't have an inventory tag, and what is an ArmorStand needed for in OP's question anyway? – SirBenet Sep 4 '15 at 20:51
  • The second selector is my bad, the selector is for the player and the armor stand is to used to find the closest player to the selecting point. – ModDL Sep 4 '15 at 21:19
  • The inventory i copied the wrong thing. :P – ModDL Sep 4 '15 at 21:19
  • Thanks @ModDL; presumably the setup should be run once via a command block (or more often? When?), and the clock section should be run from the clock via a command block? And can I use something other than an ArmorStand? I guess I'll try it and see. I'm trying to see how it would work over the life of a level... Since I have an on/off switch on the clock, would it be worth pairing the setup commands with another set to 'clear up', ie remove the objectives and the armorstand, with the setup being run when I switch it on, and the clear up being run when I switch it off? – James Carlyle-Clarke Sep 5 '15 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.