Jump to content

Rotate Player Model


skatric

Recommended Posts

Hello there I have been trying to rotate player upside down but can`t for some reason I tried many events and codes but still not able and the latest code I used is this 

package net.skatric.tutorialmod.event;


import com.mojang.math.Axis;
import net.minecraft.client.model.PlayerModel;
import net.minecraft.client.player.AbstractClientPlayer;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.skatric.tutorialmod.TutorialMod;
import org.lwjgl.opengl.GL11;


@Mod.EventBusSubscriber(modid = TutorialMod.MOD_ID,bus = Mod.EventBusSubscriber.Bus.FORGE)
public class bodyrotation {
    static boolean checking = false;
    @SubscribeEvent
    public static void event(RenderPlayerEvent.Pre event) {
        if (checking == false) {
            checking = true;
        PlayerModel<AbstractClientPlayer> model = event.getRenderer().getModel();
        event.getPoseStack().mulPose(Axis.XN.rotationDegrees(0f));
        event.getPoseStack().mulPose(Axis.YN.rotationDegrees(0f));
        event.getPoseStack().mulPose(Axis.ZN.rotationDegrees(180f));

        }

    }
}

 

Link to comment
Share on other sites

5 hours ago, skatric said:

Hello there I have been trying to rotate player upside down but can`t for some reason I tried many events and codes but still not able and the latest code I used is this 

Strange that it does not work, the code looks OK to me. This works when I try it:

	@SubscribeEvent
	public static void event(RenderPlayerEvent.Pre event) {
		event.getPoseStack().scale(1, -1, 1);
	}

 

Link to comment
Share on other sites

Thx for replying I fixed it with some help 

 @SubscribeEvent
    public static void renderPlayer(RenderPlayerEvent.Pre event) {
        PoseStack poseStack = event.getPoseStack();
        poseStack.mulPose(Axis.XN.rotationDegrees(180));
        poseStack.mulPose(Axis.YP.rotationDegrees(180));
        poseStack.translate(0, - event.getEntity().getBbHeight(), 0);
    }

 

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.