Advertisement
Corosus

Untitled

Mar 15th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.19 KB | None | 0 0
  1. public void loadSoundSettings(GameSettings par1GameSettings)
  2.     {
  3.         this.soundPoolStreaming.isGetRandomSound = false;
  4.         this.options = par1GameSettings;
  5.  
  6.         if (!loaded && (par1GameSettings == null || par1GameSettings.soundVolume != 0.0F || par1GameSettings.musicVolume != 0.0F))
  7.         {
  8.             this.tryToSetLibraryAndCodecs();
  9.         }
  10.  
  11.         loadModAudio("minecraft/resources/mod/sound", this.soundPoolSounds);
  12.         loadModAudio("minecraft/resources/mod/streaming", this.soundPoolStreaming);
  13.         loadModAudio("minecraft/resources/mod/music", this.soundPoolMusic);
  14.         loadModAudio("minecraft/resources/mod/cavemusic", this.cave);
  15.  
  16.         try
  17.         {
  18.             Field var2 = Minecraft.class.getDeclaredFields()[1];
  19.             var2.setAccessible(true);
  20.             this.mc = (Minecraft)var2.get((Object)null);
  21.         }
  22.         catch (Throwable var3)
  23.         {
  24.             ;
  25.         }
  26.     }
  27.  
  28.     private static void loadModAudio(String var0, SoundPool var1)
  29.     {
  30.         File var2 = Minecraft.getAppDir(var0);
  31.  
  32.         try
  33.         {
  34.             walkFolder(var2, var2, var1);
  35.         }
  36.         catch (IOException var4)
  37.         {
  38.             var4.printStackTrace();
  39.         }
  40.     }
  41.  
  42.     private static void walkFolder(File var0, File var1, SoundPool var2) throws IOException
  43.     {
  44.         if (var1.exists() || var1.mkdirs())
  45.         {
  46.             File[] var3 = var1.listFiles();
  47.  
  48.             if (var3 != null && var3.length > 0)
  49.             {
  50.                 for (int var4 = 0; var4 < var3.length; ++var4)
  51.                 {
  52.                     if (!var3[var4].getName().startsWith("."))
  53.                     {
  54.                         if (var3[var4].isDirectory())
  55.                         {
  56.                             walkFolder(var0, var3[var4], var2);
  57.                         }
  58.                         else if (var3[var4].isFile())
  59.                         {
  60.                             String var5 = var3[var4].getPath().substring(var0.getPath().length() + 1).replace('\\', '/');
  61.                             var2.addSound(var5, var3[var4]);
  62.                         }
  63.                     }
  64.                 }
  65.             }
  66.         }
  67.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement