mojira.dev
MC-90296

Written books cannot be tested with pages tag

When creating a written book with customized pages using valid command, a book expected was created. The command was:

/give @p minecraft:written_book 1 0 {title:"1",author:"abc",pages:["1","2"]}

But when it was put into a chest in the first slot, it can't be tested if the tag tag included the pages tag of this written book.
For example:

/testforblock ~ ~ ~2 minecraft:chest -1 {Items:[{id:"minecraft:written_book",tag:{author:"abc"}}]}

This worked well.

But when the command changed, by adding a pages tag, like this:

/testforblock ~ ~ ~2 minecraft:chest -1 {Items:[{id:"minecraft:written_book",tag:{author:"abc",pages:["1","2"]}}]}

It couldn't be tested.

The command was changed to these, but no one worked:

/testforblock ~ ~ ~2 minecraft:chest -1 {Items:[{id:"minecraft:written_book",tag:{author:"abc",pages:["{text:\"1\"}","{text:\"2\"}"]}}]}
/testforblock ~ ~ ~2 minecraft:chest -1 {Items:[{id:"minecraft:written_book",tag:{author:"abc",pages:["{text:\"1\",color:\"black\"}","{text:\"2\",color:\"black\"}"]}}]}
/testforblock ~ ~ ~2 minecraft:chest -1 {Items:[{id:"minecraft:written_book",tag:{author:"abc",pages:["{\"text\":\"1\"}","{\"text\":\"2\"}"]}}]}

Comments 6

Please do not mark unreleased versions as affected.
You don't have access to them yet.

--- I am a robot. This action was performed automatically.

This one works:

/testforblock ~ ~ ~2 minecraft:chest -1 {Items:[{id:"minecraft:written_book",tag:{author:"abc",pages:[0:"1",1:"2"]}}]}

In the future, you can use

/blockdata ~ ~-1 ~ {}

to look at a blocks BlockEntity.

/blockdata ~ ~1 ~ {}

can only used to change the block entity data for a block entity; isn't used to test if a block entity match certain data.

Also,
if the code likes:

/testforblock ~ ~1 ~ minecraft:chest -1 {Items:[{Slot:0b,id:"minecraft:written_book",tag:{title:"abc",author:"def",pages[0:"1",1:"2"]}}]}

,
it works properly now, but if I change it to

/testforblock ~ ~1 ~ minecraft:chest -1 {Items:[{Slot:0b,id:"minecraft:written_book",tag:{title:"abc",author:"def",pages[1:"1",2:"2"]}}]}

The chest still can be found. Even I make it

/testforblock ~ ~1 ~ minecraft:chest -1 {Items:[{Slot:0b,id:"minecraft:written_book",tag:{title:"abc",author:"def",pages[ffffff:"1",fsdafsdfaf:"2"]}}]}

The chest also can be found, so I think the list tag really ignore the page numbers, is it intended?

/blockdata ~ ~ ~ {}

- type it in the chat (with coordinates you need) and you'll see what data has this block (and what you can testfor it)

Order of arguments and pair names being ignored is MC-73887.

stop.x

(Unassigned)

Unconfirmed

json, testforblock, written-book

Minecraft 15w41b

Retrieved