Posted December 27, 20186 yr I'm following this tutorial, I did everything that he did before the block part, i checked the image that its a 16x16 pixel img, but my item is still not rendering but there are no errors in the log, like forge is detecting it but not displaying it for some reason. Harry Talks Github
December 27, 20186 yr Author So the Code style: I have no idea how to avoid the IHasModel. The Common Proxy: in 1.9 i made a mod with a client/server proxy, no common but im not sure if that same method will work in 1.12 How do I the the registry beside the ForgeRegistryEvent? I compared my other working mod to this one, the registry looks to me exactly the same, here's the working one: CharacterMod Where do i call the registry from? Edited December 27, 20186 yr by DiamondMiner88
December 28, 20186 yr Author I gave up on that tutorial so ill try to work with the CharacterMod, that one I already have working. Where do i change the static initializers? I tried making onItemRegister non-static but it didn't even register the items. The proxies: is this how you do it? CrayfishTM Only I don't know what to put instead of ModItems.registerRenders() in ClientProxy. And i still dont get what you mean by: On 12/27/2018 at 10:24 AM, diesieben07 said: Subscribe to ModelRegistryEvent. In there go through all your items and call ModelLoader.setCustomModelResourceLocation (or whatever else you might need to register the model). There is no action needed in the Item class. In what class do i subscribe to ModelRegistryEvent and call ModelLoader.setCustomResourceLocation?
December 28, 20186 yr Author And in RegistryHandler it says: for (Item item : ModItems.ITEMS) { if (item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } what do i put instead of the item instanceof IHasModel
December 28, 20186 yr Author So do i just remove for (Item item : ModItems.ITEMS) { if (item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } Because doesn't it serve a point? It registersModels, right?
December 29, 20186 yr Author Wait i dont get it... how do i subscribe from the client proxy class what annotation do i use? I have no idea how subscribing works. I made the ServerProxy but in the Client i already have public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id)); } this i what is my ClientProxy class is: package com.diamondminer88.mod.character.proxy; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; public class ClientProxy implements CommonProxy { public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id)); } public void init() { ModelLoader.setCustomModelResourceLocation(); } } I updated my Github too.
December 29, 20186 yr Author Would I remove the method registerItemRenderer() or just subscribe it to that and what would i do with the init() method? The subscribing still makes no sense for me. What purpose does it serve? Edited December 29, 20186 yr by DiamondMiner88
December 30, 20186 yr Author Ok so i get what subscribing is but how do i subscribe to ModelRegistryEvent? And do i call ModelLoader from my RegistryHandler or my ClientProxy? i also added in my Main.init() proxy.init();
December 30, 20186 yr Author 10 minutes ago, diesieben07 said: 12 minutes ago, DiamondMiner88 said: i also added in my Main.init() proxy.init(); Why? Wait so you're saying that that's not needed to call the proxies? Does this call them at the right time? @SidedProxy(clientSide = Reference.CLIENT_PROXY, serverSide = Reference.SERVER_PROXY) public static CommonProxy proxy; 15 minutes ago, diesieben07 said: 17 minutes ago, DiamondMiner88 said: Ok so i get what subscribing is but how do i subscribe to ModelRegistryEvent? Like any other event. Other subscribing events i see are like this @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } Should i do @SubscribeEvent with WHAT underneath?
December 30, 20186 yr I think even I can help here so I will try so basically to make everything simpler for you First you want a registry_handler which registers the items through Forge( no not the textures just the item "unlocalizedname" and "registryName") and it should look something similar to this @EventBusSubscriber public class RegistryHandler { @SubscribeEvent //for @SubscribeEvent you would have to register your class BUT because of the @EventbusSubscriber you don't have to if i am correct public static void registerItemsasdasd(Register<Item> event) { final Item[] items = { new ItemBasic("BasicStar","basic_star_item"), //the item that you are making (you have the same class in your git so this should be ok }; event.getRegistry().registerAll(items); //this will use the register to tell the game that this thing even exceists } } Then if you registered your items you need some way to tell that you want a model or picture or whatever for your item so you do this @EventBusSubscriber(Side.CLIENT) public class ModelRegistryHandler { @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { registerModel(TutorialItems.BASIC_STAR_ITEM); //here comes the problem. You need a reference for your item(basically you could use just a "registryName" without getting the item reference but you will need later anyways } private static void registerModel(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } } To get your item reference one way is to do this: @ObjectHolder(MainModpls.MODID) public class TutorialItems { public static final Item BASIC_STAR_ITEM = null; //This will just simply look through items thats in the namespace of MainModpls.MODID and if it finds a match it fills the value of your variable in more easier way: you I constructed the basicItem with the registryName=basic_star_item(small letters and theese things _ ) and if it finds that name here with CAPITALS then it sets the value } To be honest if you implement theese things it should work just be aware from here for the "picture" of your item it will look for a .json file in: assets.yourMODID.models.item.registryNameofyouritem.json json contains this: { "parent": "item/generated", "textures": { "layer0": "yourMODID:items/name_of_the_picture_without_the_.png_at_the_and" } } and it looks for the picture which is .png here: assets.yourMODID.textures.items.yourpicture.png YES ITEMS NOT ITEM AND IN MODELS YES ITEM NOT ITEMS I hope from here you can decode what jumps to where and what happens cause I am sure nobody will give a more detailed explanation here
March 31, 20196 yr Author Sorry for the very late reply, (I started to play other games *cough cough fortnite* and forgot about MC but got back to finishing my mod.) I have one more question. The ItemBasic class contains what? I am trying to register it but have no idea what to put instead of the previous version with the IHasModel. I updated my Github. Here
March 31, 20196 yr Remember how in the ModelRegistry event subscriber you registered the models of items like: ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); Well, just invoke the method with each item in your mod instead of checking for IHasModel first. EDIT: Your current code should be fine. Just remove all references of IHasModel. 45 minutes ago, DiamondMiner88 said: ItemBasic class contains what? You should not be using anything like ItemBase of BlockBase (abusing inheritance). Instantiate, add to your modItems, and register your items in the subscriber for RegistryEvent.Register<Item>; there is no need for an ItemBase. Edited March 31, 20196 yr by DavidM Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
March 31, 20196 yr Author Sorry i don't know what you mean by 9 hours ago, DavidM said: invoke the method English is not my first language so i don't understand what that means. Also in my ItemBase it says ModItems.ITEMS.add(this); and @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } Since for the adding to the array one i already have a another one, do i just remove it? The registerModels() I'm pretty sure i just remove it since i already have @SubscribeEvent public static void registerModels(ModelRegistryEvent event) { for (Item item : ModItems.itemArray) { registerModel(item); } } private static void registerModel(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); } In my ModelRegistryHandler. If i were to avoid ItemBasics, etc. how would i do that? What about changing options for it like setCreativeTab(TabCharacterMod.TAB_CHARACTER_MOD); Isin't what i already have the same as what you said? Edited March 31, 20196 yr by DiamondMiner88
March 31, 20196 yr 9 hours ago, DavidM said: ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); This line of code registers the model for the item. The “item” variable is an instance of an Item. In order to register the models for all your items, run the line of code above for each one of your item; for each item, replace the “item” variable with that item. 21 minutes ago, DiamondMiner88 said: invoke the method This basically means “calling the method” (or running the method, if that’s easier to understand). Edited March 31, 20196 yr by DavidM Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
March 31, 20196 yr Author But I already have called ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory")); As i see, I made an item in ModItems and added it to the itemArray. Then in ModelRegistryHandler for every object in the array it calls that piece of code. Since i already called that i remove ModItems.ITEMS.add(this); and @Override public void registerModels() { ModelRegistryHandler.//Here } Right? And in my ClientProxy I have @SubscribeEvent public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id)); } I remove that too since i already registered the model client-side?
March 31, 20196 yr 49 minutes ago, DiamondMiner88 said: If i were to avoid ItemBasics, etc. how would i do that? What about changing options for it like setCreativeTab(TabCharacterMod.TAB_CHARACTER_MOD); Isin't what i already have the same as what you said? You can either 1) Do it in the constructor of your item or 2) Call the method son your item when you first instantiate it in Register<Item> subscriber. 10 minutes ago, DiamondMiner88 said: @Override public void registerModels() { ModelRegistryHandler.//Here } There is no need to put the method in your item class; all item models should be registered that way, and registering the model does not need any private data. Therefore, just call registerItemRenderer for each of your item in the subscriber for ModelRegistryEvent. In addition, the tutorial you are following has a lot of bad practices. You might want to take a look at Cadiboo's example mod to learn about good practices for modding: https://github.com/Cadiboo/Example-Mod Edited March 31, 20196 yr by DavidM Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.
March 31, 20196 yr Author Ur confusing me. Where do i call 44 minutes ago, DavidM said: registerItemRenderer from? From what you said i understand that i should call registerItemRender in my ClientProxy from registerModels in my ModelRegistryHandler. Right? And i think ill stick with ItemBases for now until i have the rest of the puzzle solved. Thanks for linking me Cadiboo's mod though ill look through it. Edited March 31, 20196 yr by DiamondMiner88
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.