Jump to content

[1.9] Issue with player rotation


james090500

Recommended Posts

So I'm trying to rotate my player (like dinnerbone) and it's working ok (the rotation part)

 

But when a player looks at a rotated player and jump, they jump as well, if a person flys, the roated person flys up,

 

like the floor is reversed.

 

I've tried using GL to rotate translate etc, but nothing seems to work.

 

5e4ac689642d91aa912be6f26bbac338.gif

 

The Steve model is the only one moving, the alex model is stationary.

 

 

 

package RenderPlayer;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

import org.lwjgl.opengl.GL11;

import Config.getOS;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EnumPlayerModelParts;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;


public class UpsideDown {

@SubscribeEvent
public void doRender(RenderPlayerEvent.Pre event) {
	PreRotateCorpse(event.getEntityPlayer());
}

public void PreRotateCorpse(EntityPlayer bat) {
   if (System.getProperty("java.version").startsWith("1.8")) {
        try{
            String s = TextFormatting.getTextWithoutFormattingCodes(bat.getName());
            List<String> users = Files.readAllLines(Paths.get(getOS.OS + "/capes/Dinnerbone.txt"));
          	if (users.contains(s)|| s.equals("f") || s.equals("Grumm") && (!(bat instanceof EntityPlayer) || ((EntityPlayer)bat).isWearing(EnumPlayerModelParts.CAPE)))
            {
          		GL11.glPushMatrix();
				GlStateManager.translate(0.0F, 2, 0.0F);
        			GlStateManager.rotate(180.0F, 0.0F, 0.0F, 0.0F);
        			GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
            }
        } catch (IOException e) {}
    }
}

@SubscribeEvent
public void doRender(RenderPlayerEvent.Post event) {
	PostRotateCorpse(event.getEntityPlayer());
}

public void PostRotateCorpse(EntityPlayer bat) {
   if (System.getProperty("java.version").startsWith("1.8")) {
        try{
            String s = TextFormatting.getTextWithoutFormattingCodes(bat.getName());
            List<String> users = Files.readAllLines(Paths.get(getOS.OS + "/capes/Dinnerbone.txt"));
          	if (users.contains(s)|| s.equals("f") || s.equals("Grumm") && (!(bat instanceof EntityPlayer) || ((EntityPlayer)bat).isWearing(EnumPlayerModelParts.CAPE)))
          	{
        			GL11.glPopMatrix();
            }
        } catch (IOException e) {}
    }
}

}

 

 

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.