public static void playSound(byte[] in) {
		
		ByteBuffer b = ByteBuffer.wrap(in);
		b.get();
		int sound = b.getInt();
		boolean surface = b.get() == 1;
		
		
		String soundName = "";
		switch(sound) {
		case 1:
			soundName = "/sound/effects/explosions/hullboom_1.wav";
		break;
		case 2:
			soundName = "/sound/effects/weapons/basic/fire_1.wav";
		break;
		case 3:
			soundName = "/sound/effects/weapons/basic/fire_2.wav";
		break;
		case 4:
			soundName = "/sound/effects/weapons/basic/fire_3.wav";
		break;
		case 5:
			soundName = "/sound/effects/explosions/hullhit_1.wav";
		break;
		case 6:
			soundName = "/sound/effects/explosions/hullhit_2.wav";
		break;
		default:
			System.err.println("WARNING: Unregistered soundID "+sound);
		}
if(!surface) {
	
	float gain = 0;
	//float pan = 0;
	double x = b.getDouble();
	double y = b.getDouble();
	double res[] = ClientData.world.ships[ClientData.world.players[ClientData.controlledPlayer].shipid].transform(ClientData.world.players[ClientData.controlledPlayer].pos.x, ClientData.world.players[ClientData.controlledPlayer].pos.y);
	gain = 0 - ((float) new Pos(x,y).distance(new Pos(res[0], res[1])))/1000;
	SoundHandler.playModSound(soundName, 1f,gain);
	System.out.println("Playing positioned sound:"+soundName+" "+gain);
		} else {
			System.out.println("Playing surface sound:"+soundName);
			SoundHandler.playSound(soundName);
		}
		
	}