You'll need to use some external world editor capable of editing a block's NBT data. For example, MCEdit.
Open up the command block's data (method varies by tool; with MCEdit, run the "NBT Edit" filter with the command block selected):
Then, in the "Command" string, paste in a section sign (§) followed by a formatting code corresponding to the colour you want right before the text you want coloured:
When you go back into the game, the command in the block should look like this:
And give books that look like this:
In 1.9, the r
parameter has undergone some major changes. Prior to 16w07a, the produced radius and entity selection was very inconsistent. MC-95352 resulted in various different fix attempts.
For comparison, in 1.8 r=0
would target entities within the whole blockspace. As well, it would latch onto the block grid even when executed by an entity.
In 16w07a, the radius was fixed to be consistent and execute from the center of the block, but there was no offset to the input value. For example, r=0
would literally mean "these exact coordinates with no leniency". If any entity was not in the exact center of a block, it could not be targeted.
In 16w07b, the radius was changed to execute from the bottom face of the blockspace rather than the center, and the offset to the radius was set to 0.25. This meant that with r=0
(which essentially meant r=0.25
), an entity had to be within a small part of the center of the block, rather than the whole blockspace in 1.8.
In 1.9 pre-release 3, the radius offset was changed to 0.015625 (r=0
meant r=0.015625
).
And finally in 1.9 pre-release 4, the offset was removed again and r=0
meant "exactly at this location" once more. However, a major changed occurred here: the radius, when executed by an entity, no longer latches onto the block grid and instead used the entity as the origin. This means that with entities, you'd actually be searching around the entity rather than the block that they're in. See MC-97316 for details.
Since r=0
means "exactly at these coordinates" rather than "within this blockspace", you will not be able to use it absolutely anymore. You will need to change it to r=1
(which indeed means 1 block exactly in each direction, reaching to the center of the neighboring blocks).
Best Answer
The
replaceitem
syntax for entities is:The carpet's colour is represented by its data value (sometimes called "damage value"). Currently you have it set to 0, which is white. You can see these values here.
For example, for lime carpet: