Guide-API

Guide-API

76M Downloads

Guidebook registration (new API) not working (MC 1.11)

desht opened this issue ยท 6 comments

commented

Hi, trying to use the new annotation-based API to get a guidebook for my mod registered, and it's not working (i.e. no book is appearing). The only relevant message I see in my log is:

[08:21:46] [Client thread/ERROR] [Guide-API]: Error registering book for class me.desht.modularrouters.integration.guideapi.Guidebook

No exceptions or anything to hint what the error might be...

The registration code is here: https://github.com/desht/ModularRouters/blob/MC1.11-master/src/main/java/me/desht/modularrouters/integration/guideapi/Guidebook.java

Note that the previous version (not using the annotation API) works fine and is here:

https://github.com/desht/ModularRouters/blob/master/src/main/java/me/desht/modularrouters/integration/guideapi/Guidebook.java

(The bulk of the book building method is unchanged)

commented

I'll take a look and ado a more useful error tonight.

commented

Could you try with 1.11-2.1.0-48? It'll print the exception if it fails to register, now.

Side note: If you change your Waila compile string to mcp.mobius.waila:Hwyla:1.8.5-B19_1.11, you can re-add your Waila integration.

commented

Thanks for that. It's because I'm creating recipes which reference my mod items, which haven't yet been registered, e.g.:

pages.add(new PageIRecipe(
                        new ShapedOreRecipe(new ItemStack(ModBlocks.itemRouter, 4),
                                "ibi", "bmb", "ibi", 'b', Blocks.IRON_BARS, 'i', Items.IRON_INGOT, 'm', ModItems.blankModule)
                )
        );

ModItems.blankModule is null there, presumably because GuideAPI's preInit is running before Modular Routers' preInit(). It was OK in 1.10 because my explicit call to register the book was right at the end of my preInit handler. So changing "after:guideapi" to "before:guideapi" in my @Mod dependencies should solve this (can't test right now). Might be worth stressing that in the GuideAPI docs?

(Thanks for the Hwyla tip - that worked fine once I remembered the modid is now "waila" not "Waila"...)

commented

Ah, yes, that would be an issue. In Blood Magic, we initialize and register our book in pre, but don't actually do our categories until post.

I'll make sure to note that in the docs, especially since it's the opposite of all the other versions.

commented

Just to note, loading Modular Routers before Guide-API works fine, and the guidebook is created.

commented

Sweet. I'll close this once I add that documentation else I'll forget