Posted March 15, 201510 yr I am trying to render an item which looks different in first person and third person view. And in vanillia minecraft, filled map is the only item satisfies it. I read the code but got confused. I didn't find the methods rendering hands and map, and even json model named "item/filled_map" is rendered. So I need help about rendering mechanism of filled map. And is it feasible to render my own items in this way? Author of Tao Land Mod. http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img] Also, author of RenderTo ---- I'm not an English native speaker. I just try my best.
March 16, 201510 yr You can probably hack that by using Item.getModel, where you return a different model depending on whether the current view is first person or third person. Custom rendering like the map can probably be done the same way, perhaps using ISmartItemModel. Maps are rendered as a "special case" in ItemRenderer.renderItemInFirstPerson() - see if (this.itemToRender.getItem() == Items.filled_map) { this.func_178097_a(entityplayersp, f3, f1, f2); } It probably won't be much help to you... -TGG
March 16, 201510 yr Author You can probably hack that by using Item.getModel, where you return a different model depending on whether the current view is first person or third person. Thanks a lot. But my Item.getModel looks like this: public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { ... } There's no camera informations in this method. I don't know whether it's first person or third. Author of Tao Land Mod. http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img] Also, author of RenderTo ---- I'm not an English native speaker. I just try my best.
March 16, 201510 yr public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { ... } There's no camera informations in this method. I don't know whether it's first person or third. Inside the player perhaps? just you wait!
March 16, 201510 yr Author Minecraft.getMinecraft().gameSettings.thirdPersonView Considering multiplayer: @Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { Minecraft mc = Minecraft.getMinecraft(); boolean isFirstPersonView = mc.thePlayer.getUniqueID().equals(player.getUniqueID()) && mc.gameSettings.thirdPersonView == 0; if(isFirstPersonView) { /* ... */ } else { /* ... */ } return null; } Thank you, TGG. Author of Tao Land Mod. http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img] Also, author of RenderTo ---- I'm not an English native speaker. I just try my best.
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.