Jump to content

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


Recommended Posts

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!

Posted

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

Posted

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!

Posted

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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