Started by
honkarimero
on
Topic category: Help with Minecraft modding (Java Edition)
This GUI uses NBT tags to control pages, but with the current method, management becomes difficult as the number of pages increases. Could you please provide any ideas to make the page change button procedure more efficient?
The link below is currently an image of the procedure
I would, (firstly), use a player-persistant variable instead of an NBT tag, but they are basically the same thing, a variable's just slightly more reliable. (Though depending on whether you want this to be player or block based, the NBT tag might be the better option.)
What I usually do for recipe books is have the page change procedure set the page to +/- one, and then display the current page based on the number. (If you want them to loop, you can also take the result and MOD the current page out of the total pages- meaning whenever you go over the max, it will give you the remainder; that is, return you to page one.) You can also use a text-return function if you want to make a counter for the current page, like vanilla recipe books.
Unfortunately, not a great way to get around a clunky bunch of display functions. You kind of need a new one for each page. But yeah, you could save time on the page change function.