-
1.12 Custom resource location
So it turns out that Forge's RegistryDelegate doesn't populate their name parameter properly and when you have the same class in different implementations as the item, it disregards the differences. Basically what's been happening is that every single item custom model I register ends up setting the same "delegate" becaue their internal equals function only deals with the name attribute, not the actual object reference.
-
1.12 Custom resource location
And I'm telling you the 3rd time, that the texture gets set properly, even if I change the colours in the config. The thing that doesn't work is that all my items get the same texture - the model that I set as the last in the loop.
-
1.12 Custom resource location
And I'm telling you the 3rd time, it doesn't make a difference if I call it or not. Tried it. I'm having it as the base model, because my item is a book.
-
1.12 Custom resource location
To be fair, the ModelLoader.setCustomMeshDefinition(item, new ItemMashes(item)); doesn't seem to be doing anything. I've tried without it, it's the same.
-
1.12 Custom resource location
Book model: { "parent": "item/book" } Updated code: @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { l2.init(); registry = event.getRegistry(); for (final AchievementBookItem item : l2.items()) { registry.register(item); } } @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { for (final AchievementBookItem item : l2.items()) { System.out.println(String.format("Setting %s to %s", item.getUnlocalizedName(), item.getModelLocation().toString())); ModelLoader.setCustomModelResourceLocation(item, 0, item.getModelLocation()); ModelLoader.setCustomMeshDefinition(item, new ItemMashes(item)); } }
-
1.12 Custom resource location
Here they are: Again: it sort of works. All the items get the texture of the last setCustomModelResourceLocation call. So they are mapped properly, textures load. But for some reason, the same texture is mapped to _all_ items Orange: { "parent": "achievementbooks:item/book", "textures": { "layer0": "achievementbooks:items/book-orange" } } Yellow: { "parent": "achievementbooks:item/book", "textures": { "layer0": "achievementbooks:items/book-yellow" } } p.s.: I am going to eventually refactor the entire thing to variants and colours, but I just wanted to release a quick update to the people waiting for the 1.12 update ...
-
1.12 Custom resource location
What's happening, is that both the items get the same resource location. The output is: [STDOUT]: Setting item.achievementbooksbook_demo to achievementbooks:book-yellow#inventory [STDOUT]: Setting item.achievementbooksbook_demo2 to achievementbooks:book-orange#inventory yet both are now orange (I've changed the colour to verify my theory) This is the new code: @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { l2.init(); registry = event.getRegistry(); for (final AchievementBookItem item : l2.items()) { registry.register(item); } } @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { for (final AchievementBookItem item : l2.items()) { System.out.println(String.format("Setting %s to %s", item.getUnlocalizedName(), item.getModelLocation().toString())); // ModelLoader.setCustomModelResourceLocation(item, 0, item.getModelLocation()); ModelBakery.registerItemVariants(item, item.getModelLocation()); ModelLoader.setCustomMeshDefinition(item, new ItemMashes(item)); } } Same happens if I leave the setCustomModel* and remove the variants. If I don't have one of them, it reverts to the item name resolver. This is the resource location: public ModelResourceLocation getModelLocation() { return new ModelResourceLocation(MODID + ":book-" + book.colour(), "inventory"); }
-
1.12 Custom resource location
I just left `setCustomModelResourceLocation` and it's still not working That's why I started looking into the rest without any luck. According to all my research, it _should_ work. Why doesn't it then?
-
1.12 Custom resource location
Hello, I'm porting my mod over to 1.12 and I've bumped into a problem that I can't wrap my head around. Due to the functionality of the mod, the texture names don't correlate to the item name. Instead, they correlate to an internal property of the items. That is all dealt with in the item.getModelLocation(). In the example, I have 2 books. One configured to be yellow, the other to be blue. The println in the code tells me that the unlocalized name and the resource location match up perfectly, and if I change the model location up to an invalid string, it actually can't find the resources. So I know that I have the right values. However, after this runs, both of my books become blue, which was the last texture to load. What am I missing? @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { for (final AchievementBookItem item : l2.items()) { System.out.println(String.format("Setting %s to %s", item.getUnlocalizedName(), item.getModelLocation().toString())); ModelLoader.setCustomModelResourceLocation(item, 0, item.getModelLocation()); ModelBakery.registerItemVariants(item, item.getModelLocation()); ModelLoader.setCustomMeshDefinition(item, new ItemMashes(item)); } }
IPS spam blocked by CleanTalk.