You will need to do two things:
- Firstly, there are two other parts to the
/setblock
command that need to be present; the datavalue, and the method of handling the existing block, if any.
- Secondly, the data tag at the end should just be
{Command: "testfor @p[_=1]"}
, without the TileEntityData bit.
Thus, the resulting command should be along the lines of
/setblock <x> <y> <z> command_block 0 replace {Command:"testfor @p[_=1]"}
As proof, here's a shot of me using that command:
And here's the result:
In Minecraft, an exact integer coordinate (like 10, 64, -5) is actually on the corner between 8 different blocks. A center of a block is at 10.5, 64.5, -4.5.
When using a command such as /fill or /setblock, if a whole number is given, Minecraft automatically adds 0.5 to all of the numbers. This is because blocks must be aligned to the grid properly, so it must assume that when a user says "10" they have actually just truncated "10.5"
This isn't a programming mistake or glitch, it's because it literally can't place the block at an exact coordinate of "10".
On the F3 screen in newer versions, the "Looking at" coordinate will tell you what you actually have to type in to set the block you are looking at.
Best Answer
This is the command to setblock with a command block that has a command:
You just use the command data tag