2

So I'm trying to make a pokeball system and I'm testing it on a chicken named TestCatch. I want the command to test if there is an item named pokeball near the chicken. I have this command:

 execute @e[name=TestCatch] ~ ~ ~ testfor @e[type=Item] {Item:{tag:{display:{Name:"Pokeball"}}}}   

Whenever I use it it just says

[16:18:51] Failed to execute 'testfor @e[type=Item] {Item:{tag:{display:{Name:"Pokeball"}}}}' as TestCatch

How can I fix this?

2
  • 2
    The command is structurally correct. Ensure the command block is running correctly and that there is an item that can be found with /testfor.
    – Skylinerw
    Dec 25, 2016 at 22:05
  • The command appears to be correct, so the command output means that the target of the testfor was not found. The only thing I can think of is that you're throwing the item like a snowball (default is right-click) rather than dropping the item (default key Q). Thrown snowballs are not the same as dropped snowball items.
    – user176681
    Apr 26, 2017 at 10:10

2 Answers 2

-1

You need to specify the radius:

execute @e[name=TestCatch] ~ ~ ~ testfor @e[type=Item,r=5] {Item:{tag:{display:{Name:"Pokeball"}}}}

this will test if there is a Pokeball item within 5 blocks of TestCatch

1
  • This would cause a false positive, not a false negative.
    – pppery
    Aug 19, 2019 at 16:56
-1

The correct answer would be:

execute @e[name=TestCatch] ~ ~ ~ /testfor @e[type=Item] {Item:{tag:{display:{Name:"Pokeball"}}}}

You just missed one / before testfor.

1
  • 1
    /execute commands do not need a slash in front of them
    – Klyzx
    Oct 24, 2017 at 3:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .