Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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 by ctbe

  • Author

Thanks you, it works. However I am currently in 1.11 and I don't have any problems with hiding thetexture.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.