gigaherz / Guidebook

Minecraft book API and library
https://www.curseforge.com/minecraft/mc-mods/guidebook
Other
31 stars 16 forks source link

[Suggestion] Load URL HTML as "section" and URL loading + Questions #49

Open Shazuli opened 6 years ago

Shazuli commented 6 years ago

Hi!

I only discovered your mod a few hours ago after listing mods as "Last Updated" on Curse. I find it really interesting because of all the configuration it has! So here I come with a suggestion of my own: A way to load a new chapter or page from an existing web page basically reads a URL's HTML code and adds it as a chapter or section. I made a menu with Custom Main Menu mod to show server status of our server through our website, so a similar thing or a way to get elements of a page. My other suggestion is almost identical; a way to load images from URL.

Here is some question I have about the mod in general:

  1. How do I add a custom cover?
  2. Do you have a page with all the features listed and how they work? It's a bit of a hazzle to have to search around in the source code.
  3. How do I get my book through commands? /give @p gbook:guidebook 1 0 {Book:"gbook:xml/guidebook.xml"} doesn't seem to work.
gigaherz commented 6 years ago

Hello! Thanks for the suggestion. I will put it in my list of ideas, but I can't promise when I'll get to it. Converting html into the book's format is probably going to take a lot more effort than it might sound like.

As for the questions:

  1. You can see how I use a cover image in this gist: https://gist.github.com/gigaherz/7efeb2c17b05c179b970e4e0d3727714
  2. I'm a bit behind on the wiki, so many things are missing. I'll get to it someday... :P ... Meanwhile, you can take a look at the gist I just linked, to see many of those features as I have them in my debug testing book.
  3. I have just tested locally, and the command works: I have a book in config/books/demobook.xml, and I can give myself the book using /give @p gbook:guidebook 1 0 {Book:"gbook:demobook.xml"}
Shazuli commented 6 years ago

Hmm, I am still having problems with getting a custom cover to show up. It is just giving me a missing texture, texture: bild

Here is my file location: bild

And I'm still having problems getting my books through commands: d5948b29e17a0fbe72431e203f0620f1

gigaherz commented 6 years ago

It has to be in resources/textures/x

Shazuli commented 6 years ago

Ok, now I got that working. But I'm still having problems with getting the book from commands.

Shazuli commented 6 years ago

I figured it out by installing a mod to look at the NBT data inside my book: /give @p gbook:guidebook 1 0 {Book:"gbook:resources/demobook.xml"}

Something else I noticed was that templates didn't work for me. The pre-installed templates (big_recipe and small_recipe) worked fine for me, but when I added new templates it didn't show up in the book. I tried to just copy one of the crafting recipes templates with a different ID, but even then it didn't work.

standard.xml ```xml ```
gigaherz commented 6 years ago

Two notes about this: if you choose to use a separate template library, you'd have to reference it using an absolute path, like for the book xml. (so like gbook:resources/standard.xml)

But more importantly: you can put templates inside the same book, you don't need a separate library xml.

<book>
<template id="blah blah">
<!-- contents... -->
</template>

<!-- book chapters... -->
</book>