1

I'm trying to get arrow to explode on impact but the command I'm using doesn't work. It should work but there is an error message that comes up most of the time saying:

Arrow did not match the required data structure

The command has worked a couple of times but mostly it just comes up with the error.

/testfor @e[type=Arrow] {inGround:1b}
2
  • What do you want to achieve with this command? What is the full error?
    – nelson2tm
    Commented May 1, 2016 at 7:53
  • @nelson2tm i want to make a system to make the arrow explode on impact. the full error is "Arrow did not match the required data structure"
    – rhys
    Commented May 1, 2016 at 8:17

2 Answers 2

3

The command is structured correctly.

Most commands are processed equal to the number of targets obtained by the selector first, which is the case for /testfor. Every single arrow in the world has its NBT data checked one at a time.

However, the output of the command block only shows the result of the last iteration. While an arrow could have been found during the process, the last arrow found may not match.

You should use a comparator to check the actual success of the command, or run the command yourself in the chat and scroll through the return messages until you find one that's a success.


But in general, /testfor is not helpful and you should not be using it in this situation. It will not allow you to target which arrow was found. You've already run into the case of there being arrows that don't match, so any subsequent commands will be targeting them.

Use /scoreboard instead, to either assign a score pre-1.9 or a "tag" in 1.9:

/scoreboard players tag @e[type=Arrow,tag=in] remove in
/scoreboard players tag @e[type=Arrow,tag=!in] add in {inGround:1b}

And you'd then be able to target those specific arrows by selecting the "in" label:

/say @e[type=Arrow,tag=in]
-2

Recently, in 1.9, there was a huge update on command blocks and NBT data.

Try in 1.8.9 or earlier to see if this problem still exists. If so, the command is not compatible with 1.9.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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