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

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

You have to use the "FORGE" event bus

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

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!

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

  • Author

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

you should use the MatrixStack of the event (RenderPlayerEvent.Pre#getMatrixStack)

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

  • Author

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

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.

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

  • Author

Here is how i resolved:

matrix.push();
matrix.rotate(Vector3f.XN.rotationDegrees(-90));
matrix.rotate(Vector3f.ZN.rotationDegrees(-playerEntity.rotationYaw));
matrix.rotate(Vector3f.YN.rotationDegrees(-playerEntity.rotationYaw));

 

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.