Posted August 26, 201411 yr Hi, I have an Item (a projectile launcher) that looks perfect when rendered in in the Player's hand but points the wrong way when rendered in the Player's inventory. Is there a way to rotate a texture, but only in the inventory? Thanks! Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
August 26, 201411 yr Hi yes there is, you can use an IItemRenderer, see the item rendering sections here http://greyminecraftcoder.blogspot.com.au/p/list-of-topics.html In your renderer, use GL11.glRotatef(180, 0, 1, 0); to rotate by 180 degrees around the vertical axis. http://www.glprogramming.com/red/chapter03.html -TGG
August 26, 201411 yr Author Where would I put glRotatef? Also, is there a way to use vanilla rendering in the IItemRenderer instead of using the Tessellator? Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
August 27, 201411 yr Author Never mind I got it to work by messing with vertices. Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
August 30, 201411 yr Author I have a problem now. It renders correctly in the inventory, but often has a weird colored background. Any ideas how to fix this? Here is my Item Renderer code: public class ItemRendererCannon implements IItemRenderer{ public static RenderItem renderitem = new RenderItem(); @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch (type) { case EQUIPPED: return false; case EQUIPPED_FIRST_PERSON: return false; case ENTITY: return false; case INVENTORY: return true; default: return false; } } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return false; } @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type){ case EQUIPPED: break; case EQUIPPED_FIRST_PERSON: break; case ENTITY: break; case INVENTORY: Draw2D(item); break; default: break; } } public void Draw2D(ItemStack item){ IIcon icon = item.getItem().getIcon(item, 0); Tessellator tessellator = Tessellator.instance; tessellator.startDrawingQuads(); double minU1 = (double)icon.getMinU(); double minV1 = (double)icon.getMinV(); double maxU1 = (double)icon.getMaxU(); double maxV1 = (double)icon.getMaxV(); tessellator.addVertexWithUV(16.0, 16.0, 0.0, minU1, maxV1); tessellator.addVertexWithUV(16.0, 0.0, 0.0, maxU1, maxV1); tessellator.addVertexWithUV( 0.0, 0.0, 0.0, maxU1, minV1); tessellator.addVertexWithUV( 0.0, 16.0, 0.0, minU1, minV1); tessellator.draw(); } } There is a screenshot at https://cloud.githubusercontent.com/assets/6693944/4097725/b5ba9626-2fe0-11e4-91e3-952fcab11ca9.png Note the colored background of the items in the hotbar. Any idea how to fix this? It it caused by messing with the image vertices? Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
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.