I am creating a tabletop RPG map and I'm using books to display the player's current status, but as soon as the player activates a click event on the book the book closes. This is a problem because the book displays plus and minus buttons next to a multi-digit number and I need the player to be able to freely click and adjust the value without the book closing.

Is there a way to prevent books from closing on activating a JSON click event?

1 Answer 1


A written book is always closed upon clicking a JSON click event within the book unless it is a change_page click event, which will change the page of the book. The only way around this is to have the book on a lectern instead of in-inventory.

It is also impossible to update data dynamically while the book is being read. This is due to component resolution:

When you use the JSON text components score, selector, and nbt, the system cannot render the value directly. Instead, these components must be resolved, meaning, converted into a text tag with the correct value. For example:

{"score":{"name":"@p","objective":" text"}}
must be converted into…
with the correct value, of course
This means that the component is only resolved once, so the value displayed will not dynamically update.

So you can have your book on a lectern instead, which will prevent the automatic closure, but be warned that updating info of the book while someone is reading it may cause them to be kicked out.

You may instead want to interest yourself in having the book display a single button "Adjust Status" that when clicked, closes the book and /tellraws the buttons to change the status into the chat.

  • I keep getting kicked out with the book on a lectern too but that might be something else happening. Do you know if the resolution also affects hover data? A book has to have the page stay the same, but if I can put a score in a hoverEvent text that would be almost as good.
    – Daniel H
    Feb 13 at 18:36
  • Update: even hoverEvents need resolution and I still canʼt get a book to stay closed even in a lectern.
    – Daniel H
    Feb 14 at 2:01
  • Hi @DanielH; I'm sorry but I quite doubt it is possible to change a book's contents while the user is reading it. AFAIK the only way to display dynamic components is with resolution; there is no such thing as displaying a dynamic value without resolving it. Thus it will be fixed and no dynamic updates.
    – One 2 Many
    Mar 4 at 5:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .