fcelon Posted July 2, 2017 Posted July 2, 2017 Hello, I have spent many hours trying to figure out how to rotate palyer's arm. I have already asked on forum, but it seems nobody knows how to do it. Now it seems I have found a solution, but there is a different problem. @SideOnly(Side.CLIENT) @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onEvent(RenderPlayerEvent.Pre event) { event.getRenderer().getMainModel().bipedRightArm.isHidden=true; } @SideOnly(Side.CLIENT) @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public void onEvent(RenderPlayerEvent.Post event) { EntityPlayer player = event.getEntityPlayer(); event.getRenderer().getMainModel().bipedRightArm.isHidden=false; event.getRenderer().getMainModel().bipedRightArm.rotationPointZ = -MathHelper.sin((float) Math.toRadians(player.renderYawOffset)) * 5.0F; event.getRenderer().getMainModel().bipedRightArm.rotationPointY = 20; event.getRenderer().getMainModel().bipedRightArm.rotationPointX = -MathHelper.cos((float) Math.toRadians(player.renderYawOffset)) * 5.0F; event.getRenderer().getMainModel().bipedRightArm.rotateAngleX = (float) X; event.getRenderer().getMainModel().bipedRightArm.rotateAngleY = (float) -Math.toRadians(player.renderYawOffset); event.getRenderer().getMainModel().bipedRightArm.rotateAngleZ = (float) Z; event.getRenderer().getMainModel().bipedRightArm.renderWithRotation(0.0625F); event.getRenderer().getMainModel().bipedRightArm.rotationPointY = 2; } It only works if player's hand is empty. If player is holding any item, texture of the arm starts to look realy wierd. Does anyone know why is this happening and how to fix it? Thanks for any help. Quote
ctbe Posted July 2, 2017 Posted July 2, 2017 (edited) Try this, it will fix the texture: event.getRenderer().bindTexture(event.getRenderer().getEntityTexture((AbstractClientPlayer)player)); At least it did for me in 1.12 version, where I was getting the weird texture things you describe. Although your code doesn't work entirely for me as intended. It rotates, but I have to eliminate the code that hides the arm in the Pre event or I get nothing rendered at all. But if I do I get two arms rendered. The second one out of position. Weird. But I won't ask in this thread for help since I don't want to hijack your thread. Hope it helps. Edited July 2, 2017 by ctbe Quote
fcelon Posted July 4, 2017 Author Posted July 4, 2017 Thanks you, it works. However I am currently in 1.11 and I don't have any problems with hiding thetexture. Quote
Recommended Posts
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.