Guide-API

Guide-API

76M Downloads

Models for the book items are not working (or I'm doing something wrong)

Eladkay opened this issue ยท 11 comments

commented

Using GuideAPI.setModel(book); for a confirmed nonnull book doesn't set its texture, it stays a missing texture (and there are no errors in the log).
When I tried to specify my own texture (GuideAPI.setModel(book, new ModelResourceLocation(LibMisc.MOD_ID + ":" + LibNames.BOOK), "inventory");) I was presented with a similar issue, but something weird happened: the book still displayed a missing texture, and there's no log errors, but when I changed the name of the texture to a nonexistent one, I did get an error in the log, proving that the model IS referenced.
My thoughts are that it's something stupid like forgetting that arrays are 0 indexed or something. It's more likely I'm doing something wrong though.

Here is my model:
{
"parent": "item/generated",
"textures": {
"layer0": "quaritum:items/book"
}
}

commented

You are setting the model during preInit, correct?

commented

No I am not, I'm registering it after the rest of the book in init, and for some reason the game crashes when I try to register my book on preinit. I'll get you a crash report, one sec.

commented

Hm, that looks like an issue I fixed a while ago. Could I see all the relevant classes?

commented

That sounds redundantly complicated, but I'll try it.

commented

Where is the model for the book magic book? I can't find it.

commented

Update: I had to do some questionably valid things to get this to work, I made a new book item registered along with the regular guide-api item. That doesn't seem like the sort of things I was supposed to do. Thanks for helping though :P

commented

I'm... not really sure. Here's how we do it in BloodMagic.

The book and model are registered in pre with empty categories. Then in post we build the categories.

commented

Yeah no creating your own item will do nothing. And the BM method is neither redundant nor complicated. Models must be registered in pre. To register the model for a book, the book must be registered. However, not all of our content is registered in pre, so we handle that later on.

commented

I created my own item and it works well.
The method used in blood magic just doesn't work for me and you said yourself you don't know why.
Edit: the error is when initializing the book instance.