Jump to content

[SOLVED] [1.15.2] Rotate Player's model


ArcaneDiver

Recommended Posts

Hi, i'm trying to put the player's model in a certain position when he's riding a Dolphin, and i tried use the RenderPlayerEvent event but it never get fired.

 

 

	@SubscribeEvent
    public static void onPlayerRideRender(RenderPlayerEvent.Pre e) {
        EmpireOfKnifeThrowers.LOGGER.debug("Pre");
        if(e.getPlayer().getRidingEntity() != null && e.getPlayer().getRidingEntity() instanceof RidableDolphinEnitity) {
            Minecraft.getInstance().player.sendChatMessage("Rendering");

            PlayerModel<AbstractClientPlayerEntity> model = e.getRenderer().getEntityModel();
            model.bipedBody.rotateAngleX = (float) (-Math.PI / 4);
        }
    }

    @SubscribeEvent
    public static void render(RenderPlayerEvent.Post e) {
        EmpireOfKnifeThrowers.LOGGER.debug("Post"); // DEBUG
    }

 

I also used debug mode in my IDE but it never hit the breakpoint.

Pls help.

Edited by ArcaneDiver
Link to comment
Share on other sites

The event is only thrown when you are in third person or when a other player looks at you. Is that the problem. 

I hope because it all looks fine!

  • Thanks 1

 I will make fun of you if you are not able to look into the (vanilla-) code.

Link to comment
Share on other sites

Now, how i can rotate the entire player model? Like 90deg.

 

I tried this, but i dont see any changes

 @SubscribeEvent
    public static void onPlayerRideRender(RenderPlayerEvent.Pre e) {
        if(e.getPlayer().getRidingEntity() != null && e.getPlayer().getRidingEntity() instanceof RidableDolphinEnitity) {
            GL11.glPushMatrix();
            GL11.glRotated(Math.PI/4, 0, 0 , 0);
        }
    }

 

Edited by ArcaneDiver
Link to comment
Share on other sites

Oh thanks probably i read some too old post?, i implemented that with the MatrixStack object but when this weir effect in third person, and the player position changes by rotating the visual.

 

Here is the code:

MatrixStack matrix = e.getMatrixStack();

matrix.push();
matrix.rotate(Vector3f.XN.rotationDegrees(90));

2020-05-06_16_10_20.thumb.png.9bf73614c1469173090483d76c866b90.png

Edited by ArcaneDiver
Link to comment
Share on other sites

1 hour ago, ArcaneDiver said:

and the player position changes by rotating the visual.

not really the position of the entity is still the same. 

 

But of course the rotation of the model is dependent on the rotation point.

And it looks to me that it would be harder than just rotate one axis.

  • Thanks 1

 I will make fun of you if you are not able to look into the (vanilla-) code.

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.

Announcements



×
×
  • Create New...

Important Information

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