Posted December 21, 201311 yr Getting a strange error on my Item Renderer, first, it renders it at the shoulder, and no matter what I do, it is always on the shoulder. Second It pulls up the minecraft sprite texture sheet instead of the one I gave it... I am not sure what is wrong, here is the Item renderer class though. I can provide a screenie if necessary. package net.CJCutrone.LegendofZelda.render.Items; import net.CJCutrone.LegendofZelda.common.LegendofZelda; import net.CJCutrone.LegendofZelda.render.blocks.LegendofZeldaPot; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import org.lwjgl.opengl.GL11; public class RenderScroll implements IItemRenderer{ private Scroll scroll; private static final ResourceLocation texture = new ResourceLocation(LegendofZelda.modid,"textures/models/Scroll.png"); public RenderScroll(){ this.scroll = new Scroll(); } public void renderTileEntityAt(TileEntity e, double x, double y, double z, float f) { GL11.glScalef(1.4F, 1.4F, 1.4F); GL11.glPushMatrix(); scroll.renderModel(0.0625F); GL11.glPopMatrix(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type){ case EQUIPPED: return true; case EQUIPPED_FIRST_PERSON: return true; case INVENTORY: return true; } return true; } @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:{ GL11.glPushMatrix(); this.scroll.renderModel(.0625F); GL11.glTranslatef(0.5F, 20F, 0.5F); GL11.glRotatef(1, 0F, 50F, 1F); GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); GL11.glPopMatrix(); GL11.glPopMatrix(); } default: break; } } }
December 21, 201311 yr Author Erm..... Yes? I tried it before I rendered it originally and I had the same results, so I started flipping things and placing them before/after just in case. This was my end result. I'll try having it before again though...
December 22, 201311 yr Hi Your posted code there looks pretty messed up I have to say. Binding texture out of order, extra Pop and Pushes, a very large translate, and a strange looking rotate. I'd suggest you get rid of all the translates and rotates, see where it renders, then add them back one at a time, a little bit at a time. This link might help to figure out what range of coordinates you should be rendering over http://greyminecraftcoder.blogspot.com.au/2013/09/custom-item-rendering-using.html There's also some sample code which might be useful, although it uses Tessellator instead of Model. http://greyminecraftcoder.blogspot.com.au/2013/09/sample-code-for-rendering-items.html -TGG
December 22, 201311 yr Author I feel rather stupid now. I had a mess up originally so the render I had after was not rendering, I had a test method I forgot to take out... And a few other things. I fixed it though. Lesson learned: NEVER code when you are this wiped out... Thanks for the help guys!
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.