Compare commits
No commits in common. "6c2265f18477fdfbcbac30350473f9e0f9eb010b" and "03ea6d3bc93cafc7500c4763072a9b894f3578df" have entirely different histories.
6c2265f184
...
03ea6d3bc9
3 changed files with 7 additions and 45 deletions
|
@ -9,7 +9,7 @@ Add GUI to edit client-config that can be opened with /tbm-client-edit command.
|
||||||
|
|
||||||
Add option in client-config to set battle/silly music volume, and an option for
|
Add option in client-config to set battle/silly music volume, and an option for
|
||||||
whether or not battle/silly music volume is affected by global music volume
|
whether or not battle/silly music volume is affected by global music volume
|
||||||
setting and whether or not it is affected by master volume setting.
|
setting.
|
||||||
|
|
||||||
# Version NeoForge-1.25.2
|
# Version NeoForge-1.25.2
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ public class ClientConfig {
|
||||||
public final ModConfigSpec.ConfigValue<List<? extends String>> battleMusicList;
|
public final ModConfigSpec.ConfigValue<List<? extends String>> battleMusicList;
|
||||||
public final ModConfigSpec.ConfigValue<List<? extends String>> sillyMusicList;
|
public final ModConfigSpec.ConfigValue<List<? extends String>> sillyMusicList;
|
||||||
public final ModConfigSpec.DoubleValue sillyMusicThreshold;
|
public final ModConfigSpec.DoubleValue sillyMusicThreshold;
|
||||||
public final ModConfigSpec.BooleanValue volumeAffectedByMasterVolume;
|
|
||||||
public final ModConfigSpec.BooleanValue volumeAffectedByMusicVolume;
|
public final ModConfigSpec.BooleanValue volumeAffectedByMusicVolume;
|
||||||
public final ModConfigSpec.DoubleValue musicVolume;
|
public final ModConfigSpec.DoubleValue musicVolume;
|
||||||
|
|
||||||
|
@ -56,11 +55,6 @@ public class ClientConfig {
|
||||||
.translation(TurnBasedMinecraftMod.MODID + ".clientconfig.silly_percentage")
|
.translation(TurnBasedMinecraftMod.MODID + ".clientconfig.silly_percentage")
|
||||||
.defineInRange("sillyMusicThreshold", 0.4, 0.0, 1.0);
|
.defineInRange("sillyMusicThreshold", 0.4, 0.0, 1.0);
|
||||||
|
|
||||||
this.volumeAffectedByMasterVolume = builder.comment(
|
|
||||||
"If \"true\", music volume will be affected by global Master volume setting")
|
|
||||||
.translation(TurnBasedMinecraftMod.MODID + ".clientconfig.volume_affected_by_master")
|
|
||||||
.define("volumeAffectedByMasterVolume", true);
|
|
||||||
|
|
||||||
this.volumeAffectedByMusicVolume = builder.comment(
|
this.volumeAffectedByMusicVolume = builder.comment(
|
||||||
"If \"true\", music volume will be affected by global Music volume setting")
|
"If \"true\", music volume will be affected by global Music volume setting")
|
||||||
.translation(TurnBasedMinecraftMod.MODID + ".clientconfig.volume_affected_by_volume")
|
.translation(TurnBasedMinecraftMod.MODID + ".clientconfig.volume_affected_by_volume")
|
||||||
|
@ -81,7 +75,6 @@ public class ClientConfig {
|
||||||
private EditBox battleListEditBox = null;
|
private EditBox battleListEditBox = null;
|
||||||
private EditBox sillyListEditBox = null;
|
private EditBox sillyListEditBox = null;
|
||||||
private SliderPercentage sillyMusicThresholdSlider = null;
|
private SliderPercentage sillyMusicThresholdSlider = null;
|
||||||
private Checkbox affectedByMasterVolCheckbox = null;
|
|
||||||
private Checkbox affectedByMusicVolCheckbox = null;
|
private Checkbox affectedByMusicVolCheckbox = null;
|
||||||
private SliderPercentage volumeSlider = null;
|
private SliderPercentage volumeSlider = null;
|
||||||
|
|
||||||
|
@ -174,29 +167,6 @@ public class ClientConfig {
|
||||||
|
|
||||||
top_offset += widget_height;
|
top_offset += widget_height;
|
||||||
|
|
||||||
addRenderableWidget(
|
|
||||||
new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
|
|
||||||
widget_width, widget_height, Component.literal("Affected by Master Vol.")
|
|
||||||
.setStyle(Style.EMPTY.withColor(TextColor.fromRgb(0XFFFFFFFF)).withHoverEvent(
|
|
||||||
new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(
|
|
||||||
"If enabled, volume is affected by global master volume.")))), font));
|
|
||||||
if (affectedByMasterVolCheckbox == null) {
|
|
||||||
affectedByMasterVolCheckbox = Checkbox.builder(Component.literal(""), font)
|
|
||||||
.pos(this.width / 2 + widget_x_offset, top_offset).build();
|
|
||||||
} else {
|
|
||||||
affectedByMasterVolCheckbox.setPosition(this.width / 2 + widget_x_offset,
|
|
||||||
top_offset);
|
|
||||||
}
|
|
||||||
if ((CLIENT.volumeAffectedByMasterVolume.get() &&
|
|
||||||
!affectedByMasterVolCheckbox.selected()) ||
|
|
||||||
(!CLIENT.volumeAffectedByMasterVolume.get() &&
|
|
||||||
affectedByMasterVolCheckbox.selected())) {
|
|
||||||
affectedByMasterVolCheckbox.onPress();
|
|
||||||
}
|
|
||||||
addRenderableWidget(affectedByMasterVolCheckbox);
|
|
||||||
|
|
||||||
top_offset += widget_height;
|
|
||||||
|
|
||||||
addRenderableWidget(
|
addRenderableWidget(
|
||||||
new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
|
new StringWidget(this.width / 2 - widget_width + widget_x_offset, top_offset,
|
||||||
widget_width, widget_height, Component.literal("Affected by Music Vol.")
|
widget_width, widget_height, Component.literal("Affected by Music Vol.")
|
||||||
|
@ -271,8 +241,6 @@ public class ClientConfig {
|
||||||
|
|
||||||
CLIENT.sillyMusicThreshold.set(sillyMusicThresholdSlider.percentage);
|
CLIENT.sillyMusicThreshold.set(sillyMusicThresholdSlider.percentage);
|
||||||
|
|
||||||
CLIENT.volumeAffectedByMasterVolume.set(affectedByMasterVolCheckbox.selected());
|
|
||||||
|
|
||||||
CLIENT.volumeAffectedByMusicVolume.set(affectedByMusicVolCheckbox.selected());
|
CLIENT.volumeAffectedByMusicVolume.set(affectedByMusicVolCheckbox.selected());
|
||||||
|
|
||||||
CLIENT.musicVolume.set(volumeSlider.percentage);
|
CLIENT.musicVolume.set(volumeSlider.percentage);
|
||||||
|
|
|
@ -94,27 +94,21 @@ public class ClientProxy extends CommonProxy {
|
||||||
@Override
|
@Override
|
||||||
public void playBattleMusic() {
|
public void playBattleMusic() {
|
||||||
Options gs = Minecraft.getInstance().options;
|
Options gs = Minecraft.getInstance().options;
|
||||||
float volume = ClientConfig.CLIENT.musicVolume.get().floatValue();
|
|
||||||
if (ClientConfig.CLIENT.volumeAffectedByMasterVolume.get()) {
|
|
||||||
volume *= gs.getSoundSourceVolume(SoundSource.MASTER);
|
|
||||||
}
|
|
||||||
if (ClientConfig.CLIENT.volumeAffectedByMusicVolume.get()) {
|
if (ClientConfig.CLIENT.volumeAffectedByMusicVolume.get()) {
|
||||||
volume *= gs.getSoundSourceVolume(SoundSource.MUSIC);
|
battleMusic.playBattle(gs.getSoundSourceVolume(SoundSource.MUSIC) * gs.getSoundSourceVolume(SoundSource.MASTER) * ClientConfig.CLIENT.musicVolume.get().floatValue());
|
||||||
|
} else {
|
||||||
|
battleMusic.playBattle(gs.getSoundSourceVolume(SoundSource.MASTER) * ClientConfig.CLIENT.musicVolume.get().floatValue());
|
||||||
}
|
}
|
||||||
battleMusic.playBattle(volume);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playSillyMusic() {
|
public void playSillyMusic() {
|
||||||
Options gs = Minecraft.getInstance().options;
|
Options gs = Minecraft.getInstance().options;
|
||||||
float volume = ClientConfig.CLIENT.musicVolume.get().floatValue();
|
|
||||||
if (ClientConfig.CLIENT.volumeAffectedByMasterVolume.get()) {
|
|
||||||
volume *= gs.getSoundSourceVolume(SoundSource.MASTER);
|
|
||||||
}
|
|
||||||
if (ClientConfig.CLIENT.volumeAffectedByMusicVolume.get()) {
|
if (ClientConfig.CLIENT.volumeAffectedByMusicVolume.get()) {
|
||||||
volume *= gs.getSoundSourceVolume(SoundSource.MUSIC);
|
battleMusic.playSilly(gs.getSoundSourceVolume(SoundSource.MUSIC) * gs.getSoundSourceVolume(SoundSource.MASTER) * ClientConfig.CLIENT.musicVolume.get().floatValue());
|
||||||
|
} else {
|
||||||
|
battleMusic.playSilly(gs.getSoundSourceVolume(SoundSource.MASTER) * ClientConfig.CLIENT.musicVolume.get().floatValue());
|
||||||
}
|
}
|
||||||
battleMusic.playSilly(volume);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue