Elix_x Posted March 12, 2015 Share Posted March 12, 2015 Well, title explains what i'm doing, now i'll explain the rest: To render item (or multiple), i'm using this code (in custom item renderer): @Override public void renderItem(ItemRenderType type, ItemStack itemstack, Object... data) { if(type == IItemRenderer.ItemRenderType.EQUIPPED || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON){ EntityLivingBase entity = (EntityLivingBase) data[1]; if(type == IItemRenderer.ItemRenderType.EQUIPPED) GL11.glTranslated(1, 0, 0.5); if(itemstack.getItemDamage() == 0){ for(int i = 1; i < 10; i++){ ItemStack item = ItemCompressedTools.getToolFromMeta(itemstack, i); if(item != null){ if(MinecraftForgeClient.getItemRenderer(item, type) != null) ForgeHooksClient.renderEquippedItem(type, MinecraftForgeClient.getItemRenderer(item, type), (RenderBlocks) data[0], entity, item); else renderer.renderItem(entity, item, 0, type); GL11.glTranslated(-0.1, 0, 0); } } } else { ItemStack item = ItemCompressedTools.getCurrentTool(itemstack); if(item != null){ if(MinecraftForgeClient.getItemRenderer(item, type) != null) ForgeHooksClient.renderEquippedItem(type, MinecraftForgeClient.getItemRenderer(item, type), (RenderBlocks) data[0], entity, item); else renderer.renderItem(entity, item, 0, type); } } } if(type == IItemRenderer.ItemRenderType.ENTITY){ EntityItem entity = (EntityItem) data[1]; if(itemstack.getItemDamage() == 0){ for(int i = 1; i < 10; i++){ ItemStack item = ItemCompressedTools.getToolFromMeta(itemstack, i); if(item != null){ entity.setEntityItemStack(item); if(!ForgeHooksClient.renderEntityItem(entity, item, 0, 0, new Random(), FMLClientHandler.instance().getClient().renderEngine, (RenderBlocks) data[0], 1)) RenderManager.instance.renderEntitySimple(entity, 1); GL11.glTranslated(-0.1, 0, 0); } } } else { ItemStack item = ItemCompressedTools.getCurrentTool(itemstack); if(item != null){ entity.setEntityItemStack(item); if(!ForgeHooksClient.renderEntityItem(entity, item, 0, 0, new Random(), FMLClientHandler.instance().getClient().renderEngine, (RenderBlocks) data[0], 1)) RenderManager.instance.renderEntitySimple(entity, 1); } } entity.setEntityItemStack(itemstack); } if(type == IItemRenderer.ItemRenderType.INVENTORY){ EntityPlayer player = Minecraft.getMinecraft().thePlayer; GL11.glTranslated(0.5, 0, 0); if(itemstack.getItemDamage() == 0){ for(int i = 1; i < 10; i++){ ItemStack item = ItemCompressedTools.getToolFromMeta(itemstack, i); if(item != null){ if(!ForgeHooksClient.renderInventoryItem((RenderBlocks) data[0], FMLClientHandler.instance().getClient().renderEngine, item, true, 0, 0, 0)) renderer.renderItem(player, item, 0, type); GL11.glTranslated(-0.1, 0, 0); } } } else { ItemStack item = ItemCompressedTools.getCurrentTool(itemstack); if(item != null){ if(!ForgeHooksClient.renderInventoryItem((RenderBlocks) data[0], FMLClientHandler.instance().getClient().renderEngine, item, true, 0, 0, 0)) renderer.renderItem(player, item, 0, type); } } } } But here we don't need full code, we just need one part of it, the one that is responsible for rendering actual item "in item". Here is one for equipped renderer: if(MinecraftForgeClient.getItemRenderer(item, type) != null) ForgeHooksClient.renderEquippedItem(type, MinecraftForgeClient.getItemRenderer(item, type), (RenderBlocks) data[0], entity, item); else renderer.renderItem(entity, item, 0, type); One for entity: if(!ForgeHooksClient.renderEntityItem(entity, item, 0, 0, new Random(), FMLClientHandler.instance().getClient().renderEngine, (RenderBlocks) data[0], 1)) RenderManager.instance.renderEntitySimple(entity, 1); And one for inventory: if(!ForgeHooksClient.renderInventoryItem((RenderBlocks) data[0], FMLClientHandler.instance().getClient().renderEngine, item, true, 0, 0, 0)) renderer.renderItem(player, item, 0, type); An well the problem is: -items that have custom model are rendered few times bigger -items with multiple render passes, are rendered with only one -for entity renderer, item is rendered weirdly somewhere far awy from actual entity And this applies for each renderer case! Any help will be appreciated! Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Elix_x Posted March 13, 2015 Author Share Posted March 13, 2015 Well well... Digging a bit more i found what may cause items with model to be wrongly rendered: in forge render methods i found fncts responsible for rotation and resizing... Do i need to rewrite those in order to rnder item correctly??? Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Draco18s Posted March 13, 2015 Share Posted March 13, 2015 My guess would be "yes." Quote 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. Link to comment Share on other sites More sharing options...
Elix_x Posted March 14, 2015 Author Share Posted March 14, 2015 I'll try so... And what about multiple render passes??? Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Elix_x Posted March 14, 2015 Author Share Posted March 14, 2015 By the way, i found this code in mc rendering classes... So why isn't it working??? Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Elix_x Posted March 15, 2015 Author Share Posted March 15, 2015 Anybody has any ideas??? Please??? Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Elix_x Posted March 15, 2015 Author Share Posted March 15, 2015 Anybody has any ideas??? Please??? Is it seriously so hard??? Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
shadowfacts Posted March 15, 2015 Share Posted March 15, 2015 You have to be patient. Eventually someone who known the answer will come along and tell you. Also: Continuously bumping your post is not going to help, it will, in fact, annoy some people, people who may known the answer. Quote Don't make mods if you don't know Java. Check out my website: http://shadowfacts.net Developer of many mods Link to comment Share on other sites More sharing options...
Elix_x Posted March 17, 2015 Author Share Posted March 17, 2015 @Shadowfacts Okay... Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Elix_x Posted April 5, 2015 Author Share Posted April 5, 2015 If you need any additional info, just ask! Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
N247S Posted April 6, 2015 Share Posted April 6, 2015 Hey, I don't know all the answers, but Ill try my verry best. Fisrt of all, in the methode "renderItem()", you should specify the coördinates relative to the player. if the item is showing up far away from the player, you should change the values in the "GL11.glTranslated()". If you want to change the scale you can use the "GL11.glScalef()" methode. these first to can be different for each renderType. and about your second point: "items with multiple render passes, are rendered with only one", what exactualy do you mean? Hope this helps a bit, other wise let us know ! GL Quote Projects: Discontinued: - N2ConfigAPI - Meachanical Crafting Table Latest: - CollectionUtils Coöperations: - InGameConfigManager Link to comment Share on other sites More sharing options...
Elix_x Posted April 6, 2015 Author Share Posted April 6, 2015 Hey, I don't know all the answers, but Ill try my verry best. Fisrt of all, in the methode "renderItem()", you should specify the coördinates relative to the player. if the item is showing up far away from the player, you should change the values in the "GL11.glTranslated()". If you want to change the scale you can use the "GL11.glScalef()" methode. these first to can be different for each renderType. and about your second point: "items with multiple render passes, are rendered with only one", what exactualy do you mean? Hope this helps a bit, other wise let us know ! GL 1) I tried using translateD, and for some reasons this is not working... (why???)... 2) I mean that only first layer of item is rendered. Example: leather armor has 2 layers of texture, but only one is rendered Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Abastro Posted April 6, 2015 Share Posted April 6, 2015 Pls post your current relevant code Quote I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP) II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium. Link to comment Share on other sites More sharing options...
Elix_x Posted April 6, 2015 Author Share Posted April 6, 2015 Pls post your current relevant code One for entity is the case of not working translateD. Just adding right before it translateD, doesn't change a lot... Well to explain better, it doesn't raproaches it to center, just to one point far away from it... (i'll post pics here as soon as will have them, and sorry for long awaited post)... Quote Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones Link to comment Share on other sites More sharing options...
Recommended Posts
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.