Posted March 19, 201411 yr Anyone knows how to access and rotate the player right arm a bit up? Of corse i have an ItemRedner class and its working. I want the player to hold something up. I've tryed with ModelBiped but no luck. Thanks
March 19, 201411 yr This tutorial by Ichun (the creator of the portalgun mod) shows how to create custom rendered Items. He also shows how to edit the players arm rotation. Its a bit old but most of the code is still working. Good luck Busti PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
March 21, 201411 yr Author I saw that video and bow anim isn't god fpr me. I want only the right hand up. Like holding a lantern.
March 23, 201411 yr You want to hold it like a lantern right? Go into the ModelBiped class, and then look into the setRotationAngles function: public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) { //ALL THAT DIFFERENT UNDERSTANABLE CODE HERE } The second step, is to add new code to the end of the function. public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) { //ALL THAT DIFFERENT UNDERSTANABLE CODE HERE if(par7Entity instanceof EntityPlayer){ //CHECKING IF THE ENTITY IS A PLAYER EntityPlayer player = (EntityPlayer) par7Entity; if(player.getCurrectItem().itemID == ItemSometgingasda.item_Lantern.itemID){ //CHECKING IF THE PLAYER IS HOLDING THE LANTERN. CHANGE THAT IF YOU NEED this.bipedRightArm.rotateAngleX+=90.0f/180f*3.14f; //APPLYING THE ROTATION TO THE RIGHT ARM } } Remember, the new code should be at the end of the setRotationAngles function .
March 23, 201411 yr Author Thaks for that, but in 1.7.2 i can't edit base classes. Any way wihout editing base classes. Im trying to get an instance of that class but no luck.
March 23, 201411 yr You have to make a new RenderPlayer class with a new ModelBiped class, and attack the new RenderPlayer class to the player. Do it the same as you would register a renderer for a mob, but do it for EntityPlayer instead. Copy RenderPlayer class, and rename it, and tweak a little bit.
March 23, 201411 yr Note that doing so will make your mod incompatible with any other mod that attempts to modify the player's rendering. It is much better for compatibility's sake if you can manage to do what you want using the Forge RenderPlayerEvent hooks. I imagine it would be basically the same, using the post player render event to hook in at the end of rendering to modify the player's arm rotation like GoblinBob mentioned above. http://i.imgur.com/NdrFdld.png[/img]
March 23, 201411 yr Author So far i made: LanternRenderEventHandler: @SideOnly(Side.CLIENT) @SubscribeEvent public void lanternHolding(RenderLivingEvent.Pre event) { if (!event.isCanceled() && event.entity instanceof EntityPlayer) { ItemStack item = event.entity.getHeldItem(); if (item == null) { return; } RenderPlayer rp; if (item.getItem() != Lantern.lanternonItem) { if (item.getItem() == Lantern.lanternoffItem) { rp = (RenderPlayer)event.renderer; rp.modelArmorChestplate.heldItemRight = rp.modelArmor.heldItemRight = rp.modelBipedMain.heldItemRight = 6; } } else { rp = (RenderPlayer)event.renderer; rp.modelArmorChestplate.heldItemRight = rp.modelArmor.heldItemRight = rp.modelBipedMain.heldItemRight = 6; } } } So in the RenderPlayer some methods are private. I have to create new one as GoblinBob said and its done?
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.