Search in sources :

Example 1 with AcousticsManager

use of org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.implem.AcousticsManager in project BetterRain by OreCruncher.

the class Footsteps method reloadAcoustics.

private void reloadAcoustics(final List<IResourcePack> repo) {
    AcousticsManager acoustics = new AcousticsManager(this.isolator);
    Scanner scanner = null;
    InputStream stream = null;
    for (final IResourcePack pack : repo) {
        try {
            stream = this.dealer.openAcoustics(pack);
            if (stream != null) {
                scanner = new Scanner(stream);
                final String jasonString = scanner.useDelimiter("\\Z").next();
                new AcousticsJsonReader("").parseJSON(jasonString, acoustics);
            }
        } catch (final IOException e) {
            ModLog.debug("Unable to load acoustic data from pack %s", pack.getPackName());
        } finally {
            try {
                if (scanner != null)
                    scanner.close();
                if (stream != null)
                    stream.close();
            } catch (final IOException e) {
                ;
            }
        }
    }
    this.isolator.setAcoustics(acoustics);
    this.isolator.setSoundPlayer(new UserConfigSoundPlayerWrapper(acoustics));
    this.isolator.setDefaultStepPlayer(acoustics);
}
Also used : AcousticsManager(org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.implem.AcousticsManager) Scanner(java.util.Scanner) UserConfigSoundPlayerWrapper(org.blockartistry.mod.DynSurround.client.footsteps.game.system.UserConfigSoundPlayerWrapper) AcousticsJsonReader(org.blockartistry.mod.DynSurround.client.footsteps.parsers.AcousticsJsonReader) InputStream(java.io.InputStream) IOException(java.io.IOException) IResourcePack(net.minecraft.client.resources.IResourcePack)

Aggregations

IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Scanner (java.util.Scanner)1 IResourcePack (net.minecraft.client.resources.IResourcePack)1 UserConfigSoundPlayerWrapper (org.blockartistry.mod.DynSurround.client.footsteps.game.system.UserConfigSoundPlayerWrapper)1 AcousticsManager (org.blockartistry.mod.DynSurround.client.footsteps.mcpackage.implem.AcousticsManager)1 AcousticsJsonReader (org.blockartistry.mod.DynSurround.client.footsteps.parsers.AcousticsJsonReader)1