int id = 0;
{
final VolumeUpdatable globalVolumeControl = this.mod.getGlobalVolumeControl();
HGuiSliderControl sliderControl =
new HGuiSliderControl(
id, _LEFT, _MIX, _ELEMENT_WIDTH, _UNIT, "", globalVolumeControl.getVolume() * 0.5f);
sliderControl.setListener(new HSliderListener() {
@Override
public void sliderValueChanged(HGuiSliderControl slider, float value)
{
globalVolumeControl.setVolumeAndUpdate(value * 2);
slider.updateDisplayString();
MAtGuiMenu.this.mod.getConfig().setProperty("globalvolume.scale", globalVolumeControl.getVolume());
}
@Override
public void sliderPressed(HGuiSliderControl hGuiSliderControl)
{
}
@Override
public void sliderReleased(HGuiSliderControl hGuiSliderControl)
{
}
});
sliderControl.setDisplayStringProvider(new HDisplayStringProvider() {
@Override
public String provideDisplayString()
{
return "Global Volume Control: " + (int) Math.floor(globalVolumeControl.getVolume() * 100) + "%";
}
});
sliderControl.updateDisplayString();
this.buttonList.add(sliderControl);
id++;
}
List<String> sortedNames = new ArrayList<String>(expansions.keySet());
Collections.sort(sortedNames);
for (int expansionIndex = this.pageFromZero * this.IDS_PER_PAGE; expansionIndex < this.pageFromZero
* this.IDS_PER_PAGE + this.IDS_PER_PAGE
&& expansionIndex < sortedNames.size(); expansionIndex++)
{
final String uniqueIdentifier = sortedNames.get(expansionIndex);
final Expansion expansion = expansions.get(uniqueIdentifier);
this.expansionList.add(expansion);
HGuiSliderControl sliderControl =
new HGuiSliderControl(
id, _LEFT + _MIX, _MIX * (id + 1), _ELEMENT_WIDTH - _MIX * 2, _UNIT, "",
expansion.getVolume() * 0.5f);
sliderControl.setListener(new HSliderListener() {
@Override
public void sliderValueChanged(HGuiSliderControl slider, float value)
{
expansion.setVolumeAndUpdate(value * 2);
if (value > 0f && !expansion.isActivated())
{
expansion.activate();
}
slider.updateDisplayString();
}
@Override
public void sliderPressed(HGuiSliderControl hGuiSliderControl)
{
}
@Override
public void sliderReleased(HGuiSliderControl hGuiSliderControl)
{
if (MAtGuiMenu.this.isAutopreviewEnabled())
{
expansion.playSample();
}
}
});
sliderControl.setDisplayStringProvider(new HDisplayStringProvider() {
@Override
public String provideDisplayString()
{
String display = expansion.getFriendlyName() + ": ";
if (expansion.getVolume() == 0f)
{
if (expansion.isActivated())
{
display = display + "Will be disabled";
}
else
{
display = display + "Disabled";
}
}
else
{
display = display + (int) Math.floor(expansion.getVolume() * 100) + "%";
}
return ChatColorsSimple.THEN_ITALIC + display;
}
});
sliderControl.updateDisplayString();
this.buttonList.add(sliderControl);
if (!this.mod.isDebugMode())
{