Posted May 5, 20205 yr 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 May 7, 20205 yr by ArcaneDiver
May 5, 20205 yr 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.
May 5, 20205 yr Author I have already registered the class in the bus: MinecraftForge.EVENT_BUS.register(EventHandler.class);
May 5, 20205 yr 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.
May 5, 20205 yr Author Ohh, that's why at times it worked, i`m a fool. Thank you very much for helping.
May 6, 20205 yr 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 May 6, 20205 yr by ArcaneDiver
May 6, 20205 yr 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.
May 6, 20205 yr 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)); Edited May 6, 20205 yr by ArcaneDiver
May 6, 20205 yr 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.
May 6, 20205 yr Author Ok then i'll try to rotate the player following the dolphin. And then i'll make my rotation.
May 7, 20205 yr 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.