Posted July 4, 201411 yr i followed a tutorial by ichun and kept my code mostly like in the tutorial. it worked in the video, but for me the model was only shown in third person, probably because it was slightly outdated and i had to do some things differently. what is it thats causing this? i assume its something that i have to set for my item that wasnt needed before 1.7.2. http://www.planetminecraft.com/member/sigurd4 I'm making the bioshock mod!
July 4, 201411 yr Author public class RenderPistolRapture implements IItemRenderer { private int ammo; private boolean damageUpgrade; private boolean clipUpgrade; protected ModelPistolRapture model; public RenderPistolRapture() { model = new ModelPistolRapture(); } @Override public boolean handleRenderType(ItemStack arg0, ItemRenderType arg1) { switch(arg1) { case EQUIPPED: return true; default: return false; } } @Override public void renderItem(ItemRenderType arg0, ItemStack itemstack, Object... data) { switch(arg0) { case EQUIPPED: { damageUpgrade = itemstack.getTagCompound().getBoolean("UpgradeDamage"); clipUpgrade = itemstack.getTagCompound().getBoolean("UpgradeClip"); ammo = itemstack.getTagCompound().getInteger("Ammo"); GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("bioshock:textures/entity/weapons/pistol_rapture.png")); GL11.glRotatef(190F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-13F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-10F, 0.0F, 0.0F, 1.0F); @SuppressWarnings("unused") boolean isFirstPerson = false; if (data[1] != null && data[1] instanceof EntityPlayer) { if(!((EntityPlayer)data[1] == Minecraft.getMinecraft().renderViewEntity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && !((Minecraft.getMinecraft().currentScreen instanceof GuiInventory || Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative) && RenderManager.instance.playerViewY == 180.0F))) { GL11.glTranslatef(0.41F, -0.4F, -0.55F); } else { isFirstPerson = true; GL11.glTranslatef(0.41F, -0.4F, -0.55F); } } else { GL11.glTranslatef(0.41F, -0.4F, -0.55F); } float scale = 1.1F; GL11.glScalef(scale, scale, scale); model.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, ammo, damageUpgrade, clipUpgrade); GL11.glPopMatrix(); } default: break; } } @Override public boolean shouldUseRenderHelper(ItemRenderType arg0, ItemStack arg1, ItemRendererHelper arg2) { return false; } } http://www.planetminecraft.com/member/sigurd4 I'm making the bioshock mod!
July 5, 201411 yr You can usually just return true unless you want it to render differently in different circumstances.
July 5, 201411 yr Topic: [1.7.2] custom item model wont show up in first person. I am pretty sure sigurd4 wants to render a custom model. They need to either handle EQUIPPED_FIRST_PERSON or remove the switch statement, lest the custom model will not be rendered.
July 5, 201411 yr Author that was it! (i needed the EQUIPPED_FIRST_PERSON as well) now it works perfectly! http://www.planetminecraft.com/member/sigurd4 I'm making the bioshock mod!
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.