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.

[1.7.10] Change the rotation of the player's arm when an item is held?

Featured Replies

Posted

Hello,

 

This is more of a hypothetical question (I don't have any code to show), but what's the best way to change the player's arm rotation? I imagine it would involve a RenderPlayerEvent, where you cancel the arm rendering and render new ones, but how would one get the player's skin to display on these arms?

 

Thanks!

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Hi

 

RenderPlayer.renderFirstPersonArm() does all that, called from renderItemInFirstPerson, so I imagine you would just need to copy the setup code out of there that you need. for example

            this.mc.getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());

and

        this.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, p_82441_1_);

 

-TGG

  • Author

Ok, I got the right arm rendering, but held items are no longer translated/rotated. Here's my code:

 

private ModelDismemberedArm model = new ModelDismemberedArm();

@SubscribeEvent
public void render(RenderPlayerEvent.Specials.Post evt) {
	evt.renderer.modelBipedMain.bipedRightArm.showModel = true;
	evt.renderer.modelBipedMain.bipedLeftArm.showModel = true;
	GL11.glPushMatrix();
	evt.renderer.modelBipedMain.bipedRightArm.postRender(0.0625f);
	if(evt.entityPlayer instanceof EntityClientPlayerMP)Minecraft.getMinecraft().renderEngine.bindTexture(((EntityClientPlayerMP)evt.entityPlayer).getLocationSkin());
	model.render();
	GL11.glPopMatrix();
	evt.renderer.modelBipedMain.bipedRightArm.showModel = false;
	evt.renderer.modelBipedMain.bipedLeftArm.showModel = false;
}

 

public class ModelDismemberedArm extends ModelBase {

public ModelRenderer arm;

public ModelDismemberedArm() {
	this.textureWidth = 64;
	this.textureHeight = 32;
	this.arm = new ModelRenderer(this, 40, 16);
        this.arm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, 0);
}

public void render() {
	this.arm.render(0.0625f);
}

}

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

What in the world? Why are you creating a new model? You said you wanted to change the rotation not make a new one!

  • Author

I've read that it's the only way to accomplish this. Do you know of another?

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Why didn't you do what TGG said?

 

this.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, p_82441_1_);

 

Should work.. (Of course on RenderPlayerEvent.Specials.Pre)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.