Jump to content

(1.19.2) RenderPlayerEvent


ElTotisPro50

Recommended Posts

First, i know i have to use RenderPlayerEvent.Post for changing player stuff like size, rotation of player body parts, etc. And .Pre for capes, elytras, etc

 

Knowing that, i tried 2 things, rotate the player's arm and change the player's size(only visual but still) but non of them works

@EventBusSubscriber
public class PlayerRenderingEvent {

	@SubscribeEvent
	public void playerRendering(RenderPlayerEvent.Post event) {
		//This one
		PoseStack pose = new PoseStack();
		pose.pushPose();
		pose.scale(2, 2, 2);
		pose.popPose();
		
		//Or this one
		event.getRenderer().getModel().leftArm.xRot = (float) Math.toRadians(120);
	}
}

 

Link to comment
Share on other sites

 I know why it is not working, but I don't know enough about entity models/animations to tell you how to do it properly (if its even possible?)

 

Doing anything in Post will do nothing since its *after* the rendering.

 

Even if you did it in Pre:

Quote

PoseStack pose = new PoseStack();

pose.pushPose();

pose.scale(2, 2, 2);

pose.popPose();

Creating your own PoseStack isn't going to affect the one used by the renderer which you can get from the event state.

But since you popPose() your rescaling will be erased anyway.

 

I doubt you will be able to change the xRot like that.

These values are recalculated based on the animation state,

see: HumanoidModel.setupAnim() used by LivingEntityRender.render() before drawing the model parts, but after the call to Pre.

Like I said above. I don't know the correct way to do this?

 

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

5 hours ago, warjort said:

 I know why it is not working, but I don't know enough about entity models/animations to tell you how to do it properly (if its even possible?)

 

Doing anything in Post will do nothing since its *after* the rendering.

 

Even if you did it in Pre:

Creating your own PoseStack isn't going to affect the one used by the renderer which you can get from the event state.

But since you popPose() your rescaling will be erased anyway.

 

I doubt you will be able to change the xRot like that.

These values are recalculated based on the animation state,

see: HumanoidModel.setupAnim() used by LivingEntityRender.render() before drawing the model parts, but after the call to Pre.

Like I said above. I don't know the correct way to do this?

 

well there isn't enough information to learn how to to this well, so i have to wait until someone that knows a bit of this theme helps me, thank you anyway

Link to comment
Share on other sites

1 hour ago, ElTotisPro50 said:

well there isn't enough information to learn how to to this well

There is no helpful information for most things, in the mosts cases there is a vanilla example or something like that where you can take a look at.
Then try and hopeyou get the things to work.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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