Posted July 22, 201312 yr I made a custom item model for a hammer just to test it out and it is only visible in 3rd person. In 1st person it just looks like the item icon I gave it. Here's the render code: public class RenderHammer implements IItemRenderer { protected ModelHammer hammerModel; public RenderHammer() { hammerModel = new ModelHammer(); } @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: 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: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("/assets/magicelements/textures/models/Hammer.png")); GL11.glRotatef(192F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(95F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-10F, 0.0F, 0.0F, 1.0F); float scale = 1.6F; GL11.glScalef(scale, scale, scale); this.hammerModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } default: } } } Anyone know whats wrong?
July 22, 201312 yr because you're telling it not to render it in 3d @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED: return true; default: return false; } } include EQUIPPED_FIRST_PERSON in there
July 22, 201312 yr Author I've switched it to: @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type) { case EQUIPPED_FIRST_PERSON: return true; default: return true; } } and now the items invisible?
July 22, 201312 yr *facepalm* you don't even need to know java to solve that. all you need is common sense. if you seriously can't figure out what you did wrong.. here.. i said include EQUIPPED_FIRST_PERSON. not to replace EQUIPPED with it. both of them should be there. common sense also dictates that you're going to have to edit this part @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { switch(type) { case EQUIPPED: { GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.func_110577_a(new ResourceLocation("/assets/magicelements/textures/models/Hammer.png")); GL11.glRotatef(192F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(95F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-10F, 0.0F, 0.0F, 1.0F); float scale = 1.6F; GL11.glScalef(scale, scale, scale); this.hammerModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); } default: } }
July 22, 201312 yr Author Sorry, I feel really dumb for not seeing that. I've figured it out and it works. Thanks
July 22, 201312 yr Author Also (sorry if i'm being a nuisance) the texture isn't loading and the model in 3rd person is horizontal instead of at a 45 degree angle into my hand. I don't know which rotation does that angling?
July 22, 201312 yr regarding the angle thing, you can figure out which one it is by yourself really. just play around with the GL11.glRotatef(angle, x, y, z) parts until you figure out which axis is which. regarding the texture, make sure the location of the texture that you put is correct and that your texture is actually there. if that doesn't work, maybe try RenderBlocks renderBlocks = (RenderBlocks) data[0]; renderBlocks.minecraftRB.renderEngine.func_110577_a(ResourceLocation); instead of Minecraft.getMinecraft().renderEngine.func_110577_a(ResourceLocation);
July 22, 201312 yr Author The thing is that I've changed each axis in the code that I posted and none of those three coralates to that axis. But I'll try it again just to make sure.
July 23, 201312 yr Well, in case you didn't know, once you rotate the object, the axes rotate along with it. So if you rotate the model along the x-axis, you change the y and z axes. I suggest you start out with only one line of glrotate and then add more of them if you need to rotate it again in a different axis
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.