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())
{
this.buttonList.add(new GuiButton(Make.make(new ActionPerformed() {
@Override
public void actionPerformed()
{
if (expansion.isActivated())
{
expansion.playSample();
}
}
}), _RIGHT - _UNIT, _MIX * (id + 1), _UNIT, _UNIT, "?"));
if (expansion.hasMoreInfo())
{
this.buttonList.add(new GuiButton(Make.make(new ActionPerformed() {
@Override
public void actionPerformed()
{