Posted July 8, 20178 yr Forge Version [14.21.1.2387] I am having trouble figuring out why my textures are not loading. If I press F3+T in-game the resources reload and the textures display as they should but if i restart the game the textures don't display again. What could be causing this?
July 8, 20178 yr Show your model registration code and the models itself Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
July 8, 20178 yr Author ///////// CODE/////////// public class ItemInit { public static ArrayList<esgItem> itemList; public static void init() { itemList = new ArrayList<esgItem>(); itemList.add(new ItemRawNaquadah("raw_naquadah")); itemList.add(new ItemRawNaquadah("raw_naquadria")); itemList.add(new ItemRawNaquadah("raw_trinium")); } public static void register() { // run through and register all items in itemList for (esgItem object: itemList) { registerItem(object); } } public static void registerItem(esgItem item) { ForgeRegistries.ITEMS.register(item); // Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, // new ModelResourceLocation(Reference.MODID + ":" + item.getUnlocalizedName().substring(5), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getItemName(), "inventory")); } } ///////// MODEL/////////// { "parent": "item/generated", "textures": { "layer0": "esg:items/raw_naquadah" } }
July 8, 20178 yr Author Is this how the model should be registered? ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getItemName(), "inventory")); as for registering the items im unsure as to how to implement the " RegistryEvent.Register<Item> " instead of "ForgeRegistries.ITEMS.register(item);"
July 8, 20178 yr 2 minutes ago, Luke6905 said: ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MODID + ":" + item.getItemName(), "inventory")); Yes, but you should use item.getRegistryName() instead of Reference.MODID + ":" + item.getItemName(). 6 minutes ago, Luke6905 said: as for registering the items im unsure as to how to implement the " RegistryEvent.Register<Item> " instead of "ForgeRegistries.ITEMS.register(item);" Take a look at this example code: @Mod.EventBusSubscriber(modid = Reference.MOD_ID) public class Test { public static Item testItem; @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().register(testItem = new Item().setUnlocalizedName("test").setRegistryName("test")); } } Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
July 8, 20178 yr Author 2 minutes ago, diesieben07 said: Check out the documentation on registries. I have had a look at the docs before coming here, was just getting a bit lost with the whole thing. 9 minutes ago, Kokkie said: Yes, but you should use item.getRegistryName() instead of Reference.MODID + ":" + item.getItemName(). Take a look at this example code: @Mod.EventBusSubscriber(modid = Reference.MOD_ID) public class Test { public static Item testItem; @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().register(testItem = new Item().setUnlocalizedName("test").setRegistryName("test")); } } Ok but what is passing the RegistryEvent into 'registerItems'? I think maybe how I have my classes setup is messing with it a bit
July 8, 20178 yr 6 minutes ago, Luke6905 said: Ok but what is passing the RegistryEvent into 'registerItems'? Forge itself does, again: 4 minutes ago, diesieben07 said: Check out the documentation on registries. Basically Forge calls every method annotated with @SubscribeEvent and passes the parameter into it... Classes: 94 Lines of code: 12173 Other files: 206 Github repo: https://github.com/KokkieBeer/DeGeweldigeMod
July 8, 20178 yr Author Okay, thank you so much for the help I have it all working now. I was just unfamiliar with all the '@' annotations and how they worked. Making a lot more sense now, cheers.
July 8, 20178 yr 6 hours ago, Luke6905 said: Okay, thank you so much for the help I have it all working now. I was just unfamiliar with all the '@' annotations and how they worked. Making a lot more sense now, cheers. Magic. All that is important to you as the mod developer is that methods marked with certain annotations are called automatically for you. SubscribeEvent and EventHandler are of that type. You only need to tell Forge about the class in some manner (in this case, that's handled by another annotation: @Mod.EventBusSubscriber). Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.