use of net.minecraft.client.audio.SoundHandler in project BetterRain by OreCruncher.
the class Emitter method update.
public void update() {
final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
if (this.activeSound != null) {
if (handler.isSoundPlaying(this.activeSound))
return;
ModLog.debug("FADE: " + this.activeSound.toString());
this.activeSound.fadeAway();
this.activeSound = null;
this.repeatDelay = this.effect.getRepeat(RANDOM);
if (this.repeatDelay > 0)
return;
} else if (this.repeatDelay > 0) {
if (--this.repeatDelay > 0)
return;
}
// down a sound.
if (SoundSystemConfig.getMasterGain() <= 0)
return;
final PlayerSound theSound = new PlayerSound(effect);
if (this.effect.type == SoundType.PERIODIC) {
this.repeatDelay = this.effect.getRepeat(RANDOM);
} else {
this.activeSound = theSound;
}
try {
SoundManager.playSound(theSound);
} catch (final Throwable t) {
;
}
}
use of net.minecraft.client.audio.SoundHandler in project BetterRain by OreCruncher.
the class DynSurroundConfigGui method generateSoundVolumeList.
protected void generateSoundVolumeList(final ConfigCategory cat) {
cat.setRequiresMcRestart(false);
cat.setRequiresWorldRestart(false);
final SoundHandler handler = Minecraft.getMinecraft().getSoundHandler();
final List<String> sounds = new ArrayList<String>();
for (final Object resource : handler.sndRegistry.getKeys()) sounds.add(resource.toString());
Collections.sort(sounds);
for (final String sound : sounds) {
final Property prop = new Property(sound, "100", Property.Type.INTEGER);
prop.setMinValue(0);
prop.setMaxValue(200);
prop.setDefaultValue(100);
prop.setRequiresMcRestart(false);
prop.setRequiresWorldRestart(false);
prop.set(MathHelper.floor_float(SoundRegistry.getVolumeScale(sound) * 100));
prop.setConfigEntryClass(NumberSliderEntry.class);
cat.put(sound, prop);
}
}
Aggregations