summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/entities/renders/RenderHelper.java
blob: 8080251818fe06d4e84bf795ec3499c262af5c9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package darkknight.jewelrycraft.entities.renders;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;

public class RenderHelper {
	public static void rotateIfSneaking(EntityPlayer player) {
		if (player.isSneaking())
			applySneakingRotation();
	}

	public static void applySneakingRotation() {
		GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
	}

	public static void translateToHeadLevel(EntityPlayer player) {
		GL11.glTranslated(0,
				(player != Minecraft.getMinecraft().thePlayer ? 1.62F : 0F)
						- player.getDefaultEyeHeight()
						+ (player.isSneaking() ? 0.0625 : 0),
				0);
	}
}