use of micdoodle8.mods.galacticraft.core.entities.player.EnumGravity in project Galacticraft by micdoodle8.
the class TransformerHooks method orientCamera.
@SideOnly(Side.CLIENT)
public static void orientCamera(float partialTicks) {
EntityPlayerSP player = ClientProxyCore.mc.thePlayer;
GCPlayerStatsClient stats = GCPlayerStatsClient.get(player);
Entity viewEntity = ClientProxyCore.mc.getRenderViewEntity();
if (player.ridingEntity instanceof ICameraZoomEntity && ClientProxyCore.mc.gameSettings.thirdPersonView == 0) {
Entity entity = player.ridingEntity;
float offset = ((ICameraZoomEntity) entity).getRotateOffset();
if (offset > -10F) {
offset += PLAYER_Y_OFFSET;
GL11.glTranslatef(0, -offset, 0);
float anglePitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks;
float angleYaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks;
GL11.glRotatef(-anglePitch, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(angleYaw, 0.0F, 1.0F, 0.0F);
GL11.glTranslatef(0, offset, 0);
}
}
if (viewEntity instanceof EntityLivingBase && viewEntity.worldObj.provider instanceof IZeroGDimension && !((EntityLivingBase) viewEntity).isPlayerSleeping()) {
float pitch = viewEntity.prevRotationPitch + (viewEntity.rotationPitch - viewEntity.prevRotationPitch) * partialTicks;
float yaw = viewEntity.prevRotationYaw + (viewEntity.rotationYaw - viewEntity.prevRotationYaw) * partialTicks + 180.0F;
float eyeHeightChange = viewEntity.width / 2.0F;
// GL11.glTranslatef(0.0F, -f1, 0.0F);
GL11.glRotatef(-yaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-pitch, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, 0.0F, 0.1F);
EnumGravity gDir = stats.getGdir();
GL11.glRotatef(180.0F * gDir.getThetaX(), 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F * gDir.getThetaZ(), 0.0F, 0.0F, 1.0F);
GL11.glRotatef(pitch * gDir.getPitchGravityX(), 1.0F, 0.0F, 0.0F);
GL11.glRotatef(pitch * gDir.getPitchGravityY(), 0.0F, 1.0F, 0.0F);
GL11.glRotatef(yaw * gDir.getYawGravityX(), 1.0F, 0.0F, 0.0F);
GL11.glRotatef(yaw * gDir.getYawGravityY(), 0.0F, 1.0F, 0.0F);
GL11.glRotatef(yaw * gDir.getYawGravityZ(), 0.0F, 0.0F, 1.0F);
// GL11.glTranslatef(sneakY * gDir.getSneakVecX(), sneakY * gDir.getSneakVecY(), sneakY * gDir.getSneakVecZ());
GL11.glTranslatef(eyeHeightChange * gDir.getEyeVecX(), eyeHeightChange * gDir.getEyeVecY(), eyeHeightChange * gDir.getEyeVecZ());
if (stats.getGravityTurnRate() < 1.0F) {
GL11.glRotatef(90.0F * (stats.getGravityTurnRatePrev() + (stats.getGravityTurnRate() - stats.getGravityTurnRatePrev()) * partialTicks), stats.getGravityTurnVecX(), stats.getGravityTurnVecY(), stats.getGravityTurnVecZ());
}
}
// omit this for interesting 3P views
// GL11.glTranslatef(0.0F, 0.0F, -0.1F);
// GL11.glRotatef(pitch, 1.0F, 0.0F, 0.0F);
// GL11.glRotatef(yaw, 0.0F, 1.0F, 0.0F);
// GL11.glTranslatef(0.0F, f1, 0.0F);
}
Aggregations