Minecraft Java Edition – How to Handle Multiple Book Click Events

minecraft-commandsminecraft-java-edition

I am working on a Minecraft map and for the games, I have a written book with a click event, but how do you put multiple click events in one book?

Best Answer

For books what you need to do is add on things called clickEvents after each command. So if you had a command that looked like this:

/tellraw @p ["",{"text":"Tp","clickEvent":{"action":"run_command","value":"/tp @p 100 100 100"}}

This gives you a tp command simply called Tp ("text":"Tp") that teleports you to 100 100 100.

What you would do to add a command is add a comma and start the next line of command:

,{"text":"Tp","clickEvent":{"action":"run_command","value":"/tp @p 120 100 100"}}]

This will teleport them 20 blocks higher then the last command. If we add both commands together the end result should look like this:

  /tellraw @p ["",{"text":"Tp","clickEvent":{"action":"run_command","value":"/tp @p 100 100 100"}},{"text":"Tp","clickEvent":{"action":"run_command","value":"/tp @p 100 100 100"}}]

There are book generators out there that will do this for you without the need to type it out yourself, This is a link to one that is fairly popular and works great: https://www.minecraftjson.com/