TheAfroOfDoom / omega-flowey-minecraft-remastered

MIT License
3 stars 1 forks source link

🔇 delete vanilla `ambient` sounds #156

Closed WesLSmith closed 1 month ago

WesLSmith commented 1 month ago

Updated 8/18

This PR now handles removing sounds via updating the sounds.json in the minecraft namespace to remove all available sounds that can be played for the ambient sound event

Re-did the two test cases at the bottom of this PR and they still seem to check out


This PR removes all ambient biome sounds from the game via inputting blank ogg files.

For posterity creating these directories is a two step process:

First sounds must be extracted our of the hashed objects files into the directory structure the resourcepack requires

https://minecraft.fandom.com/wiki/Tutorials/Sound_directory

Second those sounds must be replaced with a silent ogg file which can be done faster with a script like this

import os
import shutil

def replace_files_in_directory(source_file_path, target_directory):
    # Ensure the source file exists
    if not os.path.isfile(source_file_path):
        print(f"Source file '{source_file_path}' does not exist.")
        return

    # Ensure the target directory exists
    if not os.path.isdir(target_directory):
        print(f"Target directory '{target_directory}' does not exist.")
        return

    # Iterate over all files in the target directory
    for filename in os.listdir(target_directory):
        file_path = os.path.join(target_directory, filename)

        # Check if it is a file
        if os.path.isfile(file_path):
            # Replace the content of the file while keeping the original filename
            try:
                shutil.copy2(source_file_path, file_path)
                print(f"Replaced content of: {file_path}")
            except Exception as e:
                print(f"Failed to replace content of '{file_path}': {e}")

# Example usage
source_file_path = r"C:\Users\WS\Desktop\MC_Sounds\sounds\ambient\silence.ogg"  # Replace with your source file path
target_directory = r"C:\Users\WS\Desktop\MC_Sounds\sounds\ambient\weather"  # Replace with your target directory

replace_files_in_directory(source_file_path, target_directory)`

Testing:

  1. Manually playing these sounds via playsound results in no audio playing
  2. Creating a nether biome and flying around results in no ambient audio playing

image