[Suggestion] Load URL HTML as "section" and URL loading + Questions
Shazuli opened this issue ยท 6 comments
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:
- How do I add a custom cover?
- 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.
- How do I get my book through commands?
/give @p gbook:guidebook 1 0 {Book:"gbook:xml/guidebook.xml"}
doesn't seem to work.
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:
- You can see how I use a cover image in this gist: https://gist.github.com/gigaherz/7efeb2c17b05c179b970e4e0d3727714
- 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.
- 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"}
Ok, now I got that working. But I'm still having problems with getting the book from commands.
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
<library>
<template id="small_recipe" height="64">
<image src="gbook:things" w="100" h="60" tx="0" ty="64" />
<element index="0" x="3" y="3" />
<element index="1" x="22" y="3" />
<element index="2" x="3" y="22" />
<element index="3" x="22" y="22" />
<element index="4" x="60" y="13" />
</template>
<template id="big_recipe" height="64">
<image src="gbook:things" w="100" h="60" tx="0" ty="0" />
<element index="0" x="3" y="3" />
<element index="1" x="22" y="3" />
<element index="2" x="41" y="3" />
<element index="3" x="3" y="22" />
<element index="4" x="22" y="22" />
<element index="5" x="41" y="22" />
<element index="6" x="3" y="41" />
<element index="7" x="22" y="41" />
<element index="8" x="41" y="41" />
<element index="9" x="79" y="22" />
</template>
<template id="thingy" height="64">
<image src="gbook:things" w="100" h="60" tx="0" ty="0" />
<element index="0" x="3" y="3" />
<element index="1" x="22" y="3" />
<element index="2" x="41" y="3" />
<element index="3" x="3" y="22" />
<element index="4" x="22" y="22" />
<element index="5" x="41" y="22" />
<element index="6" x="3" y="41" />
<element index="7" x="22" y="41" />
<element index="8" x="41" y="41" />
<element index="9" x="79" y="22" />
</template>
</library>
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>