I am currently modifying a datapack that changes the skullowner (tag) of a player_head to a written book's title to get that player's head skin.

execute as @e[type=item,nbt={Item:{id:"minecraft:player_head"}}] at @s if entity @e[type=item,limit=1,distance=0.1..0.3,sort=nearest,nbt={Item:{id:"minecraft:written_book"}}] run

data modify entity @s Item.tag.SkullOwner set from entity @e[type=item,limit=1,distance=0.1..0.3,sort=nearest,nbt={Item:{id:"minecraft:written_book"}}] Item.tag.title

I tried to change it to Item.tag.pages[0], and it did display the first page's contents, but it was encased. Let's say I typed Notch in the first page then signed the book. When I tried to copy it as a player_head's skullowner tag it turned into {text:Notch}.

But when I change Item.tag.title to Item.tag.pages[0].text to get the text in the first page, it doesn't work.

My main goal is to change the player_head.skullowner.id from the book's first page and player_head.skullowner.properties.textures[0].value from the second page in order to be able to change the head into a custom head such as ones found in custom head websites.

The original datapack can be found here.


Book texts are stored as JSON. There is currently no way in Minecraft to properly handle existing JSON or do anything else with strings, apart from directly copying or checking for equality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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