/**
* Sets the listener of sounds
*/
public void setSoundListenerOrientation()
{
SoundSystem sndSystem = null;
// Use reflection to get the sndManager
if (sndSystemReflect && _soundManagerSndSystemField == null)
{
try
{
_soundManagerSndSystemField = SoundManager.class.getDeclaredField("sndSystem");
System.out.println("VRRender: Reflected sndSystem");
}
catch (NoSuchFieldException e) {
try
{
_soundManagerSndSystemField = SoundManager.class.getDeclaredField("b"); //obfuscated name
System.out.println("VRRender: Reflected obfuscated b");
}
catch (NoSuchFieldException e1) {
System.out.println("VRRender: got sndSystem directly");
sndSystemReflect = false;
};
}
if (_soundManagerSndSystemField != null)
_soundManagerSndSystemField.setAccessible(true);
}
if(!sndSystemReflect ){
if( this.mc.sndManager != null )
sndSystem = this.mc.sndManager.sndSystem;
}
if (_soundManagerSndSystemField != null && this.mc.sndManager != null)
{
try
{
sndSystem = (SoundSystem)_soundManagerSndSystemField.get(this.mc.sndManager);
}
catch (IllegalArgumentException e) { }
catch (IllegalAccessException e) { };
}
float PIOVER180 = (float)(Math.PI/180);
Vec3 up = Vec3.createVectorHelper(0, 1, 0);
up.rotateAroundZ(-cameraRoll * PIOVER180);
up.rotateAroundX(-cameraPitch* PIOVER180);
up.rotateAroundY(-cameraYaw * PIOVER180);
if ( sndSystem != null && this.mc.gameSettings.soundVolume != 0.0F)
{
sndSystem.setListenerPosition((float)renderOriginX, (float)renderOriginY, (float)renderOriginZ);
sndSystem.setListenerOrientation(lookX, lookY, lookZ,
(float)up.xCoord, (float)up.yCoord, (float)up.zCoord);
}
if( mc.mumbleLink != null ) {
Vec3 forward = Vec3.createVectorHelper(0, 0 , -1);
forward.rotateAroundZ(-cameraRoll * PIOVER180);