Posted September 17, 201312 yr Currently Item.getIconIndex(ItemStack par1ItemStack) is final and calls another function (which is not) with a lower-typed parameter: getIconFromDamage(int par1). This means that I can't use NBT data to override the inventory icon, only the held model icon. 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.
September 17, 201312 yr Im pretty sure you can. *looks at all the other mods out there that have item stack senstive icons* Cant think off the top of my head but ya, pretty sure you can. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
September 17, 201312 yr Author Im pretty sure you can. *looks at all the other mods out there that have item stack senstive icons* Cant think off the top of my head but ya, pretty sure you can. public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) (which calls public Icon getIcon(ItemStack stack, int pass) and am currently overriding) doesn't work. The only other functions available are public Icon getIconFromDamageForRenderPass(int par1, int par2) and getIconFromDamage(int par1). which lacks the ItemStack. Oh look: //ItemStack.java public Icon getIconIndex() { return this.getItem().getIconIndex(this); } That calls the function I'm asking about. That's the only method on ItemStack that returns an Icon. I'd hazard a guess that those other mods wrote a custom renderer for their item, which would be unnecessary if the Item class didn't have this function as final. 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.
September 18, 201312 yr What exact code path are you looking at, there are many different places where icons are grabbed. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
September 18, 201312 yr Author Solution was to render in pass 2 (which is not obvious, but anyway). What exact code path are you looking at, there are many different places where icons are grabbed. I want the item icon when it appears in inventories. The only place an ItemStack gets its icon is the quoted function, which calls back to the finalized function in Item.java. I checked out all the other variants of getIcon in the Item class, as I'd said, but two of them don't take the item stack, two of them only cause the item to render in 3D with the indicated icon (the first passing its params to the second), and the last method is final. There aren't any others. So I'm not sure what you're question is. 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.
September 18, 201312 yr My question is. What is the exact stack, that is being called through, that makes you want this function to not be final. Yes I understand there is a function in ItemStack that calls that final function. But what calls that? And what calls that? And what calls that? ... WHY is that section of code being called. WHY does the change need to be done? Can the change be done in any other way? You should have a intimate understanding of what you're asking before you ask it. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
September 18, 201312 yr Author Its called by renderItemIntoGUI in RenderItem. There is one other function with the same name that also calls this funciton, passing an extra parameter doRenderItem also calls this function. renderItemIntoGUI also handles mutliple-pass rendering which calls the other function, so while there is a way to render the NBT data driven icon through the multiple-pass renderer, it should not be needed. It's a single icon that needs to be rendered once. 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.
September 19, 201312 yr @Override public boolean requiresMultipleRenderPasses()//kinda strange , but don't worry... { return true; } @Override public int getRenderPasses(int metadata)//we can save the other passes, actually { return 1; } @Override public Icon getIcon(ItemStack stack, int pass){//icons from NBT here... }
September 19, 201312 yr https://github.com/MinecraftForge/MinecraftForge/commit/0a7095afa9ad0073acfb7cabcd6daa407a3090b9 Forgive me if I am wrong, but isn't the new line already in the file from a previous commit? It's like, 4 lines up. Or am I just misreading it?
September 20, 201312 yr Author //kinda strange , but don't worry... That's kinda why I made the suggestion. http://forums.dumpshock.com/style_emoticons/default/sarcastic.gif[/img] It's completely bonkers for a protected method ("I'm sorry, this function does something absolutely critical to the functioning of the program that you can't change it") only calls a non-protected ("change this at your whim") method. 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.