Minecraft's sound settings are ignored
MisterJulsen opened this issue ยท 0 comments
Hello, when I change the volume in the Minecraft settings, the volume of the music doesn't change. I know that the volume can be adjusted in the video player interface, but I think that Minecraft's volume settings should limit the maximum volume since every sound in the game depends on these settings.
The problem can be easily solved by adding a line of code in the tick()
method of the TextureDisplay
class and the switchVideoMode()
method in the TextureDisplay
class after calculating the volume.
// ...
int volume;
if (block instanceof ProjectorTile projectorTile) {
Direction direction = projectorTile.getBlockState().getValue(ProjectorBlock.FACING);
volume = FrameTools.floorVolume(this.blockPos, direction, projectorTile.data.audioOffset, this.block.data.volume, this.block.data.minVolumeDistance, this.block.data.maxVolumeDistance);
} else {
volume = FrameTools.floorVolume(this.blockPos, this.block.data.volume, this.block.data.minVolumeDistance, this.block.data.maxVolumeDistance);
}
// ADD THIS LINE
volume *= Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.MASTER) * Minecraft.getInstance().options.getSoundSourceVolume(SoundSource.RECORDS);
if (currentVolume != volume) mediaPlayer.setVolume(currentVolume = volume);
// ...