How to make custom books?

Started by Sfw_mage on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make custom books?

So I'm trying to make a mod that allows me to write large amounts of text on a single page of a book(I know I cant do this on vanilla books). How would I go about on creating a custom book that allows large amount of text to be written in it? The version is 1.19.4 if this helps any.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This will probably involve a…
Wed, 09/27/2023 - 15:45

This will probably involve a lot of weird workarounds- the proper way to do this would be to custom code a system that references text files included with your mod, like how the End Poem and Credits work. But if you want to try using Mcreator's built in systems, I recommend something like this: 

  • Make your custom item, then make a custom GUI with the book-pages and a large text box set to display a variable string. 
  • For the variable string, make a procedure that first assigns your book item some custom NBT text tags. (I would organize it per page; add tags for Page 1, Page 2, so on and so forth.)
  • For each NBT text tag, assign a localization key for the text you want to display. (You could also just assign the text itself, but you probably don't actually want an item with loads and loads of text data stored in it; and probably don't want to write all your text in the procedure interface. This will also allow the text to be translated if you plan on translating the mod.) 
  • Lastly, go to your mod's localization tab and add custom localization keys for all the possible pages.

Essentially, your book items, (which I assume are pre-written), will have a custom GUI that references NBT tags of the book item, which in turn reference the mod's localization.

If you actually want a book interface you can write in, that's going to be substantially more difficult, and will certainly require custom code.